Commit 64420d8
committed
fix(test): use vi.fn() for TTY method stubs instead of plain functions
Changed stub creation from plain functions `() => {}` to `vi.fn()` to prevent
double-counting of mock calls. When spying on a plain function stub, some test
environments were counting both the spy call and the underlying stub call,
causing tests to fail with "expected 2 calls, got 5" errors.
Using vi.fn() creates a proper mock function that integrates correctly with
vitest's spy system, ensuring spy call counts are accurate across all platforms.
Fixes test failures in test/stdio/stderr.test.ts and test/stdio/stdout.test.ts
that occurred in CI environments.1 parent 3f72964 commit 64420d8
2 files changed
+24
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 35 | + | |
44 | 36 | | |
45 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
46 | 43 | | |
47 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 39 | | |
51 | 40 | | |
52 | 41 | | |
53 | | - | |
| 42 | + | |
54 | 43 | | |
55 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
56 | 50 | | |
57 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
58 | 56 | | |
59 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
0 commit comments