Debian Codegraph @

packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js

raw
1 expect(() => {
2 var code = "function f() {}";
3 transform(code, {
4 plugins: [
5 function() {
6 return {
7 visitor: {
8 FunctionDeclaration: function(path) {
9 throw path.buildCodeFrameError("someMsg");
10 },
11 },
12 };
13 },
14 ],
15 // hard to assert on ANSI escape codes
16 highlightCode: false,
17 });
18 }).toThrow(/^unknown file: someMsg\s+> 1 \| function f\(\) {}/);