Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filename to transform error (#10511)
* polish: use “unknown” as a default filename in buildCodeFrameError * feat: add filename to transform error * fix: incorrect warning message * fix: add filename to generate phrase error message * address review comment from Nicolò
- Loading branch information
1 parent
80d99b4
commit 298c9a6
Showing
7 changed files
with
46 additions
and
8 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
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
2 changes: 1 addition & 1 deletion
2
packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json
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,3 +1,3 @@ | ||
{ | ||
"throws": "undefined: someMsg\n> 1 | function f() {}" | ||
"throws": "unknown: someMsg\n> 1 | function f() {}" | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-core/test/fixtures/plugins/transform-error/exec.js
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 @@ | ||
var code = "function f() {}"; | ||
transform(code, { | ||
plugins: [ | ||
function() { | ||
return { | ||
visitor: { | ||
FunctionDeclaration: function(path) { | ||
throw new Error("someMsg"); | ||
}, | ||
}, | ||
}; | ||
}, | ||
], | ||
filename: "/fake/path/example.js" | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/babel-core/test/fixtures/plugins/transform-error/options.json
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,4 @@ | ||
{ | ||
"throws": "/fake/path/example.js: someMsg", | ||
"os": ["linux", "darwin"] | ||
} |