Skip to content

Commit

Permalink
chore: replace test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 9, 2024
1 parent 433726e commit db31543
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ Expected ";" but found "code"
exports[`parse error 2`] = `
{
"frame": "",
"frame": "1 | invalid code
| ^
2 | ",
"id": "",
"loc": undefined,
"loc": {
"column": 9,
"file": "/fixtures/errors/syntax-error.js",
"line": 1,
},
"message": "Expected ';', '}' or <eof>",
}
`;
Expand All @@ -49,9 +55,15 @@ Expected ";" but found "code"
exports[`parse error 4`] = `
{
"frame": "",
"frame": "1 | invalid code
| ^
2 | ",
"id": "",
"loc": undefined,
"loc": {
"column": 9,
"file": "/fixtures/errors/syntax-error.js",
"line": 1,
},
"message": "Expected ';', '}' or <eof>",
}
`;
22 changes: 0 additions & 22 deletions packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,25 +1205,3 @@ console.log(bar)
"
`)
})

test('parse error', async () => {
try {
await ssrTransform(`some bad code`, null, '/file.js', '')
expect.unreachable()
} catch (e) {
expect(e).toMatchInlineSnapshot(`[RollupError: Expected ';', '}' or <eof>]`)
expect({ ...e }).toMatchInlineSnapshot(`
{
"code": "PARSE_ERROR",
"frame": "1 | some bad code
| ^",
"loc": {
"column": 6,
"file": "/file.js",
"line": 1,
},
"pos": 5,
}
`)
}
})

0 comments on commit db31543

Please sign in to comment.