Commit 12cd726
committed
fix(test): use tmpdir for patch discover test to avoid spawn failures
The test "should show error when no node_modules directory found" was
using a nonexistent-dir path as cwd. On Unix systems, spawn() fails
with ENOENT before the CLI even starts when cwd doesn't exist.
Fix: Create a temporary directory using mkdtemp(), which guarantees:
- Directory exists (spawn won't fail)
- No node_modules present (test condition is valid)
- Isolated test environment
- Automatic cleanup in finally block
This eliminates the Unix flaky test failure.1 parent 5734a2e commit 12cd726
1 file changed
+14
-6
lines changedLines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
0 commit comments