Skip to content

Commit 563ad03

Browse files
committed
test: tweak
1 parent 481e1d4 commit 563ad03

File tree

3 files changed

+101
-99
lines changed

3 files changed

+101
-99
lines changed

test/cli/fixtures/stacktraces-helper/basic.test.ts renamed to test/cli/fixtures/assertion-helper/basic.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ const myEqualSoftAsync = vi.helper(async (a: any, b: any) => {
1919
});
2020

2121
test("sync", () => {
22-
myEqual("left", "right");
22+
myEqual("sync", "x");
2323
});
2424

2525
test("async", async () => {
26-
await myEqualAsync("left", "right");
26+
await myEqualAsync("async", "x");
2727
});
2828

2929
test("soft", () => {
30-
myEqualSoft("left", "right");
30+
myEqualSoft("soft", "x");
3131
});
3232

3333
test("soft async", async () => {
34-
await myEqualSoftAsync("left", "right");
34+
await myEqualSoftAsync("soft async", "x");
3535
});
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { resolve } from 'pathe'
2+
import { expect, it } from 'vitest'
3+
import { runVitest } from '../../test-utils'
4+
5+
it('assertion helper', async () => {
6+
const { stderr, errorTree } = await runVitest({
7+
root: resolve(import.meta.dirname, '../fixtures/assertion-helper'),
8+
})
9+
expect(stderr).toMatchInlineSnapshot(`
10+
"
11+
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
12+
13+
FAIL basic.test.ts > sync
14+
AssertionError: expected 'sync' to deeply equal 'x'
15+
16+
Expected: "x"
17+
Received: "sync"
18+
19+
❯ basic.test.ts:22:3
20+
20|
21+
21| test("sync", () => {
22+
22| myEqual("sync", "x");
23+
| ^
24+
23| });
25+
24|
26+
27+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
28+
29+
FAIL basic.test.ts > async
30+
AssertionError: expected 'async' to deeply equal 'x'
31+
32+
Expected: "x"
33+
Received: "async"
34+
35+
❯ basic.test.ts:26:3
36+
24|
37+
25| test("async", async () => {
38+
26| await myEqualAsync("async", "x");
39+
| ^
40+
27| });
41+
28|
42+
43+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
44+
45+
FAIL basic.test.ts > soft
46+
AssertionError: expected 'soft' to deeply equal 'x'
47+
48+
Expected: "x"
49+
Received: "soft"
50+
51+
❯ basic.test.ts:30:3
52+
28|
53+
29| test("soft", () => {
54+
30| myEqualSoft("soft", "x");
55+
| ^
56+
31| });
57+
32|
58+
59+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯
60+
61+
FAIL basic.test.ts > soft async
62+
AssertionError: expected 'soft async' to deeply equal 'x'
63+
64+
Expected: "x"
65+
Received: "soft async"
66+
67+
❯ basic.test.ts:34:3
68+
32|
69+
33| test("soft async", async () => {
70+
34| await myEqualSoftAsync("soft async", "x");
71+
| ^
72+
35| });
73+
36|
74+
75+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/4]⎯
76+
77+
"
78+
`)
79+
expect(errorTree()).toMatchInlineSnapshot(`
80+
{
81+
"basic.test.ts": {
82+
"async": [
83+
"expected 'async' to deeply equal 'x'",
84+
],
85+
"soft": [
86+
"expected 'soft' to deeply equal 'x'",
87+
],
88+
"soft async": [
89+
"expected 'soft async' to deeply equal 'x'",
90+
],
91+
"sync": [
92+
"expected 'sync' to deeply equal 'x'",
93+
],
94+
},
95+
}
96+
`)
97+
})

test/cli/test/stacktraces.test.ts

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -193,98 +193,3 @@ it('custom helper with captureStackTrace', async () => {
193193
}
194194
`)
195195
})
196-
197-
// browser mode tested in test/browser/specs/assertion-helper.test.ts
198-
it('assertion helper', async () => {
199-
const { stderr, errorTree } = await runVitest({
200-
root: resolve(import.meta.dirname, '../fixtures/stacktraces-helper'),
201-
})
202-
expect(stderr).toMatchInlineSnapshot(`
203-
"
204-
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
205-
206-
FAIL basic.test.ts > sync
207-
AssertionError: expected 'left' to deeply equal 'right'
208-
209-
Expected: "right"
210-
Received: "left"
211-
212-
❯ basic.test.ts:22:3
213-
20|
214-
21| test("sync", () => {
215-
22| myEqual("left", "right");
216-
| ^
217-
23| });
218-
24|
219-
220-
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
221-
222-
FAIL basic.test.ts > async
223-
AssertionError: expected 'left' to deeply equal 'right'
224-
225-
Expected: "right"
226-
Received: "left"
227-
228-
❯ basic.test.ts:26:3
229-
24|
230-
25| test("async", async () => {
231-
26| await myEqualAsync("left", "right");
232-
| ^
233-
27| });
234-
28|
235-
236-
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
237-
238-
FAIL basic.test.ts > soft
239-
AssertionError: expected 'left' to deeply equal 'right'
240-
241-
Expected: "right"
242-
Received: "left"
243-
244-
❯ basic.test.ts:30:3
245-
28|
246-
29| test("soft", () => {
247-
30| myEqualSoft("left", "right");
248-
| ^
249-
31| });
250-
32|
251-
252-
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯
253-
254-
FAIL basic.test.ts > soft async
255-
AssertionError: expected 'left' to deeply equal 'right'
256-
257-
Expected: "right"
258-
Received: "left"
259-
260-
❯ basic.test.ts:34:3
261-
32|
262-
33| test("soft async", async () => {
263-
34| await myEqualSoftAsync("left", "right");
264-
| ^
265-
35| });
266-
36|
267-
268-
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/4]⎯
269-
270-
"
271-
`)
272-
expect(errorTree()).toMatchInlineSnapshot(`
273-
{
274-
"basic.test.ts": {
275-
"async": [
276-
"expected 'left' to deeply equal 'right'",
277-
],
278-
"soft": [
279-
"expected 'left' to deeply equal 'right'",
280-
],
281-
"soft async": [
282-
"expected 'left' to deeply equal 'right'",
283-
],
284-
"sync": [
285-
"expected 'left' to deeply equal 'right'",
286-
],
287-
},
288-
}
289-
`)
290-
})

0 commit comments

Comments
 (0)