Skip to content

Test race: platform-binary.test.ts creates src/node_modules while api-deprecated-paths.test.ts scans src/ #694

Closed

Description

@theCodeDrift

What happens

A full local `pnpm test` can fail intermittently in `packages/cli/test/api-deprecated-paths.test.ts` with `ENOENT` on `packages/cli/src/node_modules`. The test passes when run alone, and CI hasn't hit it yet.

Why

  • `platform-binary.test.ts` ("reports node_modules/.bin as the source when that tier answers", around line 208–221) creates `packages/cli/src/node_modules` as a fake workspace, then removes it.
  • `api-deprecated-paths.test.ts` walks `SOURCE_ROOT` (`packages/cli/src`) recursively with `readdir` (around line 32/52).
  • Vitest runs the files in parallel. When the walk lists `src/node_modules` and then descends into it after the other test has removed it, the walk throws `ENOENT`.

Found while iterating on #689; it isn't caused by that PR and is already on `main`.

Done when

  • `platform-binary.test.ts` no longer writes inside `packages/cli/src`. It should use a temp directory, or a fixture location the source walk never visits.
  • The source walk in `api-deprecated-paths.test.ts` skips `node_modules` (and tolerates entries that vanish mid-walk), so a stray directory can't break it.
  • Running both files together repeatedly (e.g. `pnpm exec vitest run test/platform-binary.test.ts test/api-deprecated-paths.test.ts` in a loop) passes every time.

Activity

  1. added
    bugSomething isn't working
    CLIRelated to the taskless CLI
    on Nov 12, 2026
  2. added a commit that references this issue on Nov 12, 2026
    43f6493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIRelated to the taskless CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions