Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/fixtures/module-missing-loader-error/existing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions test/fixtures/module-missing-loader-error/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./existing.json');
21 changes: 21 additions & 0 deletions test/fixtures/module-missing-loader-error/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

const FriendlyErrorsWebpackPlugin = require('../../../index');

module.exports = {
entry: __dirname + "/index.js",
output: {
path: __dirname + "/dist",
filename: "bundle.js"
},
module: {
rules: [
{
test: /\.json$/,
loader: 'missing-loader',
},
]
},
plugins: [
new FriendlyErrorsWebpackPlugin()
]
};
17 changes: 17 additions & 0 deletions test/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,20 @@ it('integration : webpack multi compiler : module-errors', async() => {
'Did you forget to run npm install --save for them?'
]);
});

it('integration : missing loader', async() => {

// We apply the plugin directly to the compiler when targeting multi-compiler
let globalPlugins = [new FriendlyErrorsWebpackPlugin()];
const logs = await executeAndGetLogs('./fixtures/module-missing-loader-error/webpack.config', globalPlugins);

expect(logs).toEqual([
'ERROR Failed to compile with 1 errors',
'',
'This dependency was not found in node_modules:',
'',
'* missing-loader in ./test/fixtures/module-missing-loader-error/index.js',
'',
'Install the missing loader with: npm install --save missing-loader'
]);
});