From 897c1078ec5d24da44acb2e5852f9d0838a2e38b Mon Sep 17 00:00:00 2001 From: Rolf Babijn Date: Wed, 24 Feb 2021 13:11:03 +0100 Subject: [PATCH] Clarify missing css file error message --- lib/friendly-errors/formatters/missing-css-file.js | 2 +- lib/friendly-errors/formatters/missing-loader.js | 2 +- test/friendly-errors/formatters/missing-css-file.js | 2 +- test/friendly-errors/formatters/missing-loader.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/friendly-errors/formatters/missing-css-file.js b/lib/friendly-errors/formatters/missing-css-file.js index d5bf67ee..1130e535 100644 --- a/lib/friendly-errors/formatters/missing-css-file.js +++ b/lib/friendly-errors/formatters/missing-css-file.js @@ -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(''); } diff --git a/lib/friendly-errors/formatters/missing-loader.js b/lib/friendly-errors/formatters/missing-loader.js index 746763e9..3d6fc977 100644 --- a/lib/friendly-errors/formatters/missing-loader.js +++ b/lib/friendly-errors/formatters/missing-loader.js @@ -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; diff --git a/test/friendly-errors/formatters/missing-css-file.js b/test/friendly-errors/formatters/missing-css-file.js index c83e324d..67b17688 100644 --- a/test/friendly-errors/formatters/missing-css-file.js +++ b/test/friendly-errors/formatters/missing-css-file.js @@ -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'); diff --git a/test/friendly-errors/formatters/missing-loader.js b/test/friendly-errors/formatters/missing-loader.js index 4d447983..94dfb1cc 100644 --- a/test/friendly-errors/formatters/missing-loader.js +++ b/test/friendly-errors/formatters/missing-loader.js @@ -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'); });