Skip to content

Commit 75a557e

Browse files
authored
test: fix snapshot on vite 8 (#9686)
1 parent 695a86b commit 75a557e

File tree

1 file changed

+83
-1
lines changed

1 file changed

+83
-1
lines changed

test/cli/test/stacktraces.test.ts

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { resolve } from 'pathe'
22
import { glob } from 'tinyglobby'
33
import { describe, expect, it } from 'vitest'
4+
import { rolldownVersion } from 'vitest/node'
45
import { runInlineTests, runVitest } from '../../test-utils'
56

67
// To prevent the warning coming up in snapshots
@@ -217,7 +218,87 @@ it('resolves/rejects', async () => {
217218
`,
218219
})
219220

220-
expect(stderr).toMatchInlineSnapshot(`
221+
if (rolldownVersion) {
222+
expect(stderr).toMatchInlineSnapshot(`
223+
"
224+
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
225+
226+
FAIL repro.test.ts > resolves: resolved promise with mismatched value
227+
AssertionError: expected 3 to be 4 // Object.is equality
228+
229+
- Expected
230+
+ Received
231+
232+
- 4
233+
+ 3
234+
235+
❯ repro.test.ts:5:41
236+
3|
237+
4| test('resolves: resolved promise with mismatched value', async (…
238+
5| await expect(Promise.resolve(3)).resolves.toBe(4)
239+
| ^
240+
6| })
241+
7|
242+
243+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
244+
245+
FAIL repro.test.ts > rejects: rejected promise with mismatched value
246+
AssertionError: expected 3 to be 4 // Object.is equality
247+
248+
- Expected
249+
+ Received
250+
251+
- 4
252+
+ 3
253+
254+
❯ repro.test.ts:9:40
255+
7|
256+
8| test('rejects: rejected promise with mismatched value', async ()…
257+
9| await expect(Promise.reject(3)).rejects.toBe(4)
258+
| ^
259+
10| })
260+
11|
261+
262+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
263+
264+
FAIL repro.test.ts > rejects: resolves when rejection expected
265+
AssertionError: promise resolved "3" instead of rejecting
266+
267+
- Expected:
268+
Error {
269+
"message": "rejected promise",
270+
}
271+
272+
+ Received:
273+
3
274+
275+
❯ repro.test.ts:13:41
276+
11|
277+
12| test('rejects: resolves when rejection expected', async () => {
278+
13| await expect(Promise.resolve(3)).rejects.toBe(4)
279+
| ^
280+
14| })
281+
15|
282+
283+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯
284+
285+
FAIL repro.test.ts > resolves: rejects when resolve expected
286+
AssertionError: promise rejected "3" instead of resolving
287+
❯ repro.test.ts:17:40
288+
15|
289+
16| test('resolves: rejects when resolve expected', async () => {
290+
17| await expect(Promise.reject(3)).resolves.toBe(4)
291+
| ^
292+
18| })
293+
19|
294+
295+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/4]⎯
296+
297+
"
298+
`)
299+
}
300+
else {
301+
expect(stderr).toMatchInlineSnapshot(`
221302
"
222303
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
223304
@@ -294,6 +375,7 @@ it('resolves/rejects', async () => {
294375
295376
"
296377
`)
378+
}
297379
expect(errorTree()).toMatchInlineSnapshot(`
298380
{
299381
"repro.test.ts": {

0 commit comments

Comments
 (0)