Skip to content

Commit 2b0d023

Browse files
committed
docs(standards): add process.chdir() prohibition to code style
Added working directory rule to CLAUDE.md: - Never use process.chdir() as it breaks tests, worker threads, and causes race conditions - Always use { cwd } options and absolute paths instead - Pass { cwd: absolutePath } to spawn/exec/fs operations This rule prevents global state mutation anti-pattern that causes test failures in worker threads.
1 parent f6793a5 commit 2b0d023

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ Use path utilities from `#lib/paths`:
277277
import { normalizePath } from '#lib/paths'
278278
```
279279

280+
#### Working Directory
281+
- **🚨 NEVER use `process.chdir()`** - use `{ cwd }` options and absolute paths instead
282+
- Breaks tests, worker threads, and causes race conditions
283+
- Always pass `{ cwd: absolutePath }` to spawn/exec/fs operations
284+
280285
### Debugging
281286

282287
#### Common Issues

0 commit comments

Comments
 (0)