Commit cdca330
committed
fix(windows): add file flush delay to prevent ENOENT errors in tests
On Windows, file operations can be asynchronous at the OS level. After writeFile() completes, the file handle may not be fully released immediately, causing ENOENT errors when code tries to read the file right after writing.
Enhanced retryWrite() to:
- Increase initial delay to 20ms (was 10ms) for more reliable file flushing
- Add retry loop for file accessibility check (up to 3 retries)
- Use exponential backoff within access retries (20ms per retry)
- Use node:timers/promises sleep instead of raw setTimeout for cleaner async handling
This fixes the intermittent test failures in Windows CI runners, including:
- "should handle load -> update -> save workflow"
- "should use default 2-space indent for new files"1 parent 1fb817e commit cdca330
1 file changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
61 | 83 | | |
62 | 84 | | |
63 | 85 | | |
| |||
74 | 96 | | |
75 | 97 | | |
76 | 98 | | |
77 | | - | |
| 99 | + | |
78 | 100 | | |
79 | 101 | | |
80 | 102 | | |
| |||
0 commit comments