Skip to content

Coverage cleanOnRerun: false causes crash #5521

@asportnoy

Description

@asportnoy

Describe the bug

When setting coverage.cleanOnRerun to false, saving a file will cause the CLI to crash with Error: ENOENT: no such file or directory, open '/path/to/repo/coverage/.tmp/coverage-[num].json'.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-7cu7ag?file=vite.config.ts

  1. Press "Fork" so you can edit
  2. Wait for the coverage to be outputted in the CLI
  3. Make any change to src/basic.ts. The CLI will crash with the error above.

If it doesn't crash, just wait for the coverage output again and try making another change.

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 177.73 MB / 16.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.11.1 - ~/.local/share/nvm/v20.11.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.2.4 - ~/.local/share/nvm/v20.11.1/bin/npm
  Browsers:
    Chrome: 123.0.6312.122
    Safari: 17.4.1
  npmPackages:
    @vitejs/plugin-react: ^4.2.1 => 4.2.1 
    @vitest/coverage-istanbul: ^1.4.0 => 1.4.0 
    @vitest/ui: ^1.4.0 => 1.4.0 
    vitest: ^1.4.0 => 1.4.0

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: coverageIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions