Skip to content

Commit 722f8ba

Browse files
test: update test for lateset swc
1 parent 78f9192 commit 722f8ba

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/errors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function isSwcError(error: unknown): error is SwcError {
1616

1717
// Since swc throw an object, we need to wrap it in a proper error
1818
export function wrapAndReThrowSwcError(error: SwcError): never {
19-
const errorHints = `${error.filename}:${error.startLine}${error.snippet}`;
19+
const errorHints = `${error.filename}:${error.startLine}\n${error.snippet}\n`;
2020
switch (error.code) {
2121
case "UnsupportedSyntax": {
2222
const unsupportedSyntaxError = new Error(error.message);

test/snapshots/transform.test.js.snapshot

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exports[`should have proper error code 1`] = `
22
{
33
"code": "UnsupportedSyntax",
44
"message": "\`module\` keyword is not supported. Use \`namespace\` instead.",
5-
"snippet": " \\n \\n module F { export type x = number }\\n ^^^^^^^^\\n \\n",
5+
"snippet": "module F { export type x = number }\\n^^^^^^^^\\n",
66
"filename": "<anon>",
77
"startLine": 1,
88
"startColumn": 0,
@@ -15,7 +15,7 @@ exports[`should have proper error code 2`] = `
1515
{
1616
"code": "InvalidSyntax",
1717
"message": "'const' declarations must be initialized",
18-
"snippet": " \\n \\n const foo;\\n ^^^\\n \\n",
18+
"snippet": "const foo;\\n ^^^\\n",
1919
"filename": "<anon>",
2020
"startLine": 1,
2121
"startColumn": 6,

0 commit comments

Comments
 (0)