Skip to content

Code coverage with "all" option does not report uncovered source code #1415

@toaditoad

Description

@toaditoad

Link to bug demonstration repository

https://github.com/toaditoad/code-coverage-mwe

Expected Behavior

Code coverage should be less than 100% because there is only one test spec FooPage.spec.js covering the source code of FooPage.vue. BarPage.vue should be reported as uncovered.

Observed Behavior

The code coverage is 100%. The all option of nyc includes all source code but does not indicate untouched source code (like BarPage.vue) as uncovered.

unexpectedCodeCoverage

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config

Environment Information

$ npx envinfo@latest --preset nyc
npx: installed 1 in 0.773s

  System:
    OS: Linux 4.15 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 15.50 GB / 31.27 GB
  Binaries:
    Node: 14.16.1 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.12 - /usr/local/bin/npm
  npmPackages:
    @babel/register: 7.14.5 => 7.14.5 
    @istanbuljs/nyc-config-babel: 3.0.0 => 3.0.0 
    @vue/cli-plugin-babel: 4.5.13 => 4.5.13 
    babel-core: 7.0.0-bridge.0 => 7.0.0-bridge.0 
    babel-loader: 8.2.2 => 8.2.2 
    babel-plugin-istanbul: 6.0.0 => 6.0.0 
    babel-preset-typescript-vue: 1.1.1 => 1.1.1 
    source-map-support: 0.5.19 => 0.5.19 
    typescript: 4.2.2 => 4.2.2 

Possibly related issues

see also https://stackoverflow.com/questions/68194900/cypress-code-coverage-with-nyc-all-option-does-not-report-source-code-as-unco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions