Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 8, 2024
1 parent e99b2ee commit 15c13f7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,3 +1205,25 @@ 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 15c13f7

Please sign in to comment.