fix: remove filename annotation in buildCodeFrameError (#10539)
This commit is contained in:
parent
1b19608a5a
commit
dcf7d89b8e
@ -259,8 +259,6 @@ export default class File {
|
||||
): Error {
|
||||
let loc = node && (node.loc || node._loc);
|
||||
|
||||
msg = `${this.opts.filename ?? "unknown"}: ${msg}`;
|
||||
|
||||
if (!loc && node) {
|
||||
const state = {
|
||||
loc: null,
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
var code = "function f() {}";
|
||||
transform(code, {
|
||||
plugins: [
|
||||
function() {
|
||||
return {
|
||||
visitor: {
|
||||
FunctionDeclaration: function(path) {
|
||||
throw path.buildCodeFrameError("someMsg");
|
||||
expect(() => {
|
||||
var code = "function f() {}";
|
||||
transform(code, {
|
||||
plugins: [
|
||||
function() {
|
||||
return {
|
||||
visitor: {
|
||||
FunctionDeclaration: function(path) {
|
||||
throw path.buildCodeFrameError("someMsg");
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
],
|
||||
// hard to assert on ANSI escape codes
|
||||
highlightCode: false,
|
||||
});
|
||||
};
|
||||
},
|
||||
],
|
||||
// hard to assert on ANSI escape codes
|
||||
highlightCode: false,
|
||||
});
|
||||
}).toThrow(/^unknown: someMsg\s+> 1 \| function f\(\) {}/);
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "unknown: someMsg\n> 1 | function f() {}"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user