Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage broken when using isolate: false #771

Closed
6 tasks done
EvHaus opened this issue Feb 16, 2022 · 1 comment · Fixed by #776
Closed
6 tasks done

Coverage broken when using isolate: false #771

EvHaus opened this issue Feb 16, 2022 · 1 comment · Fixed by #776
Assignees

Comments

@EvHaus
Copy link
Contributor

EvHaus commented Feb 16, 2022

Describe the bug

I've found that when using isolate: false, code coverage is returned as blank:

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

Reproduction

Wasn't able to create a repro on StackBlitz because it crashes (sample) with:

TypeError: Cannot read properties of undefined (reading 'setCoverageDirectory')
    at setupCoverageHooks (https://vitest-dev-vitest-8topul.w.staticblitz.com/blitz.e1937cc6e2ee7e7a1da198d43493f4063378a564.js:6:234055)

Instead, you can repro by cloning this repo and running npm run test.

Note that it prints:

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

But if you go to vitest.config.js and comment out isolate: false it prints:

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |      100 |     100 |     100 |                   
 basic.ts |     100 |      100 |     100 |     100 |                   
----------|---------|----------|---------|---------|-------------------

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 29.48 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
    Watchman: 2022.02.14.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 98.0.4758.102
    Chrome Canary: 100.0.4892.0
    Firefox: 96.0.2
    Safari: 15.3
  npmPackages:
    vite: latest => 2.8.3 
    vitest: latest => 0.3.6

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

/cc @Demivan

@Demivan Demivan self-assigned this Feb 17, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants