Skip to content

/* istanbul ignore if */ does not change coverage reporting for if condition #2021

@smtchahal

Description

@smtchahal

Describe the bug

/* istanbul ignore if */ should ignore an if path from being considered for code coverage, but it doesn't with vitest. See the stackblitz for a reproducable example.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-ogxiag?file=util.ts

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
    Memory: 11.06 GB / 15.47 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
  Browsers:
    Chrome: 105.0.5195.102
    Firefox: 104.0.2
  npmPackages:
    @vitejs/plugin-react: ^2.1.0 => 2.1.0 
    vite: ^3.1.0 => 3.1.0 
    vitest: ^0.23.2 => 0.23.2

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: coverageIssues and PRs related to the coverage featureupstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions