-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve formatting of error messages
- Loading branch information
Showing
7 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`should fail if a file is tried to be loaded from include paths and with webpack's resolver simultaneously 1`] = ` | ||
"Module build failed: | ||
@import \\"some/module.less\\"; | ||
@import \\"~some/module.less\\"; | ||
^ | ||
'~some/module.less' wasn't found. Tried - /test/fixtures/less/~some/module.less,/test/fixtures/node_modules/~some/module.less,~some/module.less | ||
in /test/fixtures/less/error-mixed-resolvers.less (line 3, column 0)" | ||
`; | ||
|
||
exports[`should provide a useful error message if the import could not be found 1`] = ` | ||
"Module build failed: | ||
@import \\"not-existing\\"; | ||
^ | ||
Can't resolve './not-existing.less' in '/test/fixtures/less' | ||
in /test/fixtures/less/error-import-not-existing.less (line 1, column 0)" | ||
`; | ||
|
||
exports[`should provide a useful error message if there was a syntax error 1`] = ` | ||
"Module build failed: | ||
but this is a syntax error | ||
^ | ||
Unrecognised input. Possibly missing something | ||
in /test/fixtures/less/error-syntax.less (line 6, column 0)" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
@import "not-existing"; | ||
@import "not-existing"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.this-less-code-works { | ||
background: hotpink; | ||
} | ||
|
||
but this is a syntax error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require('path'); | ||
|
||
const projectPath = path.resolve(__dirname, '..', '..'); | ||
const projectPathPattern = new RegExp(projectPath, 'g'); | ||
|
||
// We need to remove all environment dependent features | ||
function compareErrorMessage(msg) { | ||
const envIndependentMsg = msg | ||
.replace(projectPathPattern, '') | ||
.replace(/\\/g, '/'); | ||
|
||
expect(envIndependentMsg).toMatchSnapshot(); | ||
} | ||
|
||
module.exports = compareErrorMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters