Skip to content

Commit

Permalink
Clarify missing css file error message
Browse files Browse the repository at this point in the history
  • Loading branch information
RolfBabijn authored and weaverryan committed Mar 1, 2021
1 parent c4e3fd2 commit 897c107
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/friendly-errors/formatters/missing-css-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function formatErrors(errors) {
chalk.red('Module build failed: Module not found:')
);
for (let error of errors) {
messages.push(`${error.file} contains a reference to the file ${error.ref}.`);
messages.push(`"${error.file}" contains a reference to the file "${error.ref}".`);
messages.push('This file can not be found, please check it for typos or update it if the file got moved.');
messages.push('');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/friendly-errors/formatters/missing-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function formatErrors(errors) {
if (error.loaderName) {
messages.push(`${chalk.bgGreen.black('', 'FIX', '')} To ${loaderFeatures.getFeatureDescription(error.loaderName)}:`);
} else {
messages.push(`${chalk.bgGreen.black('', 'FIX', '')} To load ${error.file}:`);
messages.push(`${chalk.bgGreen.black('', 'FIX', '')} To load "${error.file}":`);
}

let index = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/friendly-errors/formatters/missing-css-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('formatters/missing-css-file', () => {
};

const actualErrors = formatter([error]);
expect(JSON.stringify(actualErrors)).to.contain('/some/file.css contains a reference to the file ../images/foo.png');
expect(JSON.stringify(actualErrors)).to.contain('\\"/some/file.css\\" contains a reference to the file \\"../images/foo.png\\"');
expect(JSON.stringify(actualErrors)).to.contain('This file can not be found, please check it for typos or update it if the file got moved.');
// all needed packages will be present when running tests
expect(JSON.stringify(actualErrors)).to.not.contain('yarn add');
Expand Down
2 changes: 1 addition & 1 deletion test/friendly-errors/formatters/missing-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('formatters/missing-loader', () => {
};

const actualErrors = formatter([error]);
expect(JSON.stringify(actualErrors)).to.contain('To load /some/file.jpg');
expect(JSON.stringify(actualErrors)).to.contain('To load \\"/some/file.jpg\\"');
expect(JSON.stringify(actualErrors)).to.contain('You may need to install and configure a special loader');
});

Expand Down

0 comments on commit 897c107

Please sign in to comment.