Skip to content

Commit 5e1f6f9

Browse files
authored
test: fix vite 8 stack trace snapshot (#9747)
1 parent e5aeced commit 5e1f6f9

1 file changed

Lines changed: 35 additions & 15 deletions

File tree

test/browser/specs/errors.test.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from 'pathe'
22
import { expect, test } from 'vitest'
3+
import { rolldownVersion } from 'vitest/node'
34
import { buildTestProjectTree } from '../../test-utils'
45
import { instances, runBrowserTests, runInlineBrowserTests } from './utils'
56

@@ -163,21 +164,40 @@ test('prints source-mapped stack for optimized dependency', async () => {
163164

164165
for (const [name, tree] of Object.entries(projectTree)) {
165166
if (name === 'webkit') {
166-
expect(tree).toMatchInlineSnapshot(`
167-
{
168-
"basic.test.ts": {
169-
"fail": [
170-
{
171-
"message": "this is test dependency error",
172-
"stacks": [
173-
"throwDepError at ../../../../node_modules/.pnpm/<normalized>/node_modules/test-dep-error/index.js:2:18",
174-
" at basic.test.ts:5:16",
175-
],
176-
},
177-
],
178-
},
179-
}
180-
`)
167+
if (rolldownVersion) {
168+
expect(tree).toMatchInlineSnapshot(`
169+
{
170+
"basic.test.ts": {
171+
"fail": [
172+
{
173+
"message": "this is test dependency error",
174+
"stacks": [
175+
"throwDepError at ../../../../node_modules/.pnpm/<normalized>/node_modules/test-dep-error/index.js:2:18",
176+
" at basic.test.ts:5:2",
177+
],
178+
},
179+
],
180+
},
181+
}
182+
`)
183+
}
184+
else {
185+
expect(tree).toMatchInlineSnapshot(`
186+
{
187+
"basic.test.ts": {
188+
"fail": [
189+
{
190+
"message": "this is test dependency error",
191+
"stacks": [
192+
"throwDepError at ../../../../node_modules/.pnpm/<normalized>/node_modules/test-dep-error/index.js:2:18",
193+
" at basic.test.ts:5:16",
194+
],
195+
},
196+
],
197+
},
198+
}
199+
`)
200+
}
181201
}
182202
else {
183203
expect(tree).toMatchInlineSnapshot(`

0 commit comments

Comments
 (0)