Skip to content

test(config): give each run its own temp home directory - #653

Merged
sirmalloc merged 1 commit into
sirmalloc:mainfrom
eric-engberg:fix/config-test-temp-dir
Oct 6, 2026
Merged

sirmalloc merged 1 commit into
sirmalloc:mainfrom
eric-engberg:fix/config-test-temp-dir

Conversation

@eric-engberg

Copy link
Copy Markdown
Contributor

No demo: only a test changes.

Summary

src/utils/__tests__/config.test.ts used a fixed directory, /tmp/ccstatusline-config-test-home, and deleted it before every test. Two test runs on the same machine at once delete each other's settings files mid-test and fail at random. Examples: an editor's test runner alongside a terminal run, or parallel CI jobs on one runner.

The directory now comes from fs.mkdtempSync(path.join(os.tmpdir(), 'ccstatusline-config-test-home-')), unique to each run. Everything else in the file is unchanged: it still clears the directory before each test and removes it at the end.

Testing

  • Ran config.test.ts under Node three at a time, five rounds:
    • main: 128 of 345 tests failed.
    • This branch: 0 failed.
  • bun run lint and bun test pass; the file passes under Bun and under Node with Vitest.

The config tests used a fixed /tmp/ccstatusline-config-test-home and deleted
it before every test. Two test runs at once (an editor's test runner plus a
terminal run, or parallel CI jobs on one machine) deleted each other's
settings files mid-test and failed at random. Run three at a time, the file
failed 128 of 345 tests on main. A directory from mkdtempSync is unique to
each run, so they no longer collide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants