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

Inconsistent coverage reporting between test runs #371

Closed
6 tasks done
wtchnm opened this issue Dec 30, 2021 · 3 comments
Closed
6 tasks done

Inconsistent coverage reporting between test runs #371

wtchnm opened this issue Dec 30, 2021 · 3 comments

Comments

@wtchnm
Copy link
Contributor

wtchnm commented Dec 30, 2021

Describe the bug

First test run:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 100 89.47 100 100
src 100 100 100 100
App.tsx 100 100 100 100
setupTests.ts 100 100 100 100
testUtils.tsx 100 100 100 100
utils.ts 100 100 100 100
src/api 100 100 100 100
getFruits.ts 100 100 100 100
src/components 100 100 100 100
Fruit.tsx 100 100 100 100
Head.tsx 100 100 100 100
ImageAttribution.tsx 100 100 100 100
LoadingOrError.tsx 100 100 100 100
src/mocks 100 100 100 100
handlers.ts 100 100 100 100
server.ts 100 100 100 100
src/pages 100 75 100 100
Details.tsx 100 75 100 100 57
Gallery.tsx 100 100 100 100

Second test run:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 100 100 100 100
src 100 100 100 100
setupTests.ts 100 100 100 100
testUtils.tsx 100 100 100 100
utils.ts 100 100 100 100
src/components 100 100 100 100
LoadingOrError.tsx 100 100 100 100
src/mocks 100 100 100 100
handlers.ts 100 100 100 100
server.ts 100 100 100 100

Third test run:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 98.85 87.5 77.77 98.85
src 100 100 100 100
App.tsx 100 100 100 100
setupTests.ts 100 100 100 100
testUtils.tsx 100 100 100 100
utils.ts 100 100 100 100
src/api 100 100 100 100
getFruits.ts 100 100 100 100
src/components 96.64 100 50 96.64
Fruit.tsx 94.87 100 50 94.87 62-65
Head.tsx 100 100 100 100
ImageAttribution.tsx 97.56 100 50 97.56 17
LoadingOrError.tsx 100 100 100 100
src/mocks 100 100 100 100
handlers.ts 100 100 100 100
server.ts 100 100 100 100
src/pages 100 75 100 100
Details.tsx 100 75 100 100 57
Gallery.tsx 100 100 100 100

Reproduction

  1. Clone the project: pnpx -y degit wtchnm/Vitamin#feat/vitest vitest-coverage-bug && cd vitest-coverage-bug
  2. Install dependencies: pnpm install
  3. Run the test command multiple times: pnpm test:ci

System Info

System:
    OS: Linux 5.15 undefined
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 5.39 GB / 15.60 GB
    Container: Yes
    Shell: 3.3.1 - /usr/bin/fish
  Binaries:
    Node: 16.13.1 - /usr/bin/node
    npm: 8.3.0 - /usr/bin/npm
  Browsers:
    Brave Browser: 96.1.33.106
    Firefox: 95.0.2
  npmPackages:
    @vitejs/plugin-react: 1.1.3 => 1.1.3 
    vite: 2.7.10 => 2.7.10 
    vitest: 0.0.124 => 0.0.124

Used Package Manager

pnpm

Validations

@wtchnm
Copy link
Contributor Author

wtchnm commented Dec 30, 2021

@Monkatraz maybe it's of interest to you

@bompus bompus mentioned this issue Dec 31, 2021
6 tasks
@sheremet-va sheremet-va added the bug label Jan 1, 2022
@Demivan
Copy link
Member

Demivan commented Jan 23, 2022

@wtchnm This should be fixed with Vitest v0.2.0

@wtchnm
Copy link
Contributor Author

wtchnm commented Jan 24, 2022

@Demivan it's fixed now. Thanks!

@wtchnm wtchnm closed this as completed Jan 24, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
* feat(useFetch): add beforeFetch option

* beforeFetch now accepts a normal function and provides abort parameter

* unify beforeFetch args

* beforeFetch return parameters are now optional

* Update packages/core/useFetch/index.ts

Co-authored-by: Anthony Fu <[email protected]>

* fix errors

* added in way to cancel requests

* isCanceled doesn't need to be a ref

* Update packages/core/useFetch/index.ts

Co-authored-by: Anthony Fu <[email protected]>

* converted Context from type to interface and renamed to BeforeFetchContext

Co-authored-by: Anthony Fu <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 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

No branches or pull requests

3 participants