istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.6k stars 359 forks source link

Coverage configuration in .nycrc overrides package.json config. #1406

Open MattRoss34 opened 3 years ago

MattRoss34 commented 3 years ago

We have a default configuration specified in our .nycrc with the following:

{
    "extends": "@istanbuljs/nyc-config-typescript",
    "reporter": ["text", "html", "lcov"],
    "check-coverage": true,
    "lines": 0,
    "statements": 0,
    "functions": 0,
    "branches": 0
}

In each package, we override with package-specific settings via the nyc package.json stanza:

    "nyc": {
        "check-coverage": true,
        "branches": 100,
        "functions": 100,
        "lines": 100,
        "statements": 100
    },

With nyc 14.1.1 this worked fine, but after upgrading to nyc 15.1.0 this seems to be broken/switched. i.e. the .nycrc coverage config now takes precedence.

Link to bug demonstration repository

Expected Behavior

Coverage specs in the package.json "nyc" stanza should override coverage specs in the .nycrc file.

Observed Behavior

The coverage specs in the .nycrc file are taking precedence over the package.json config.

Troubleshooting steps

Environment Information

  System:
    OS: macOS 11.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 1.67 GB / 32.00 GB
  Binaries:
    Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
    Yarn: 1.22.0 - ~/.nvm/versions/node/v12.22.1/bin/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stefandoorn commented 2 years ago

@MattRoss34 Did you find a solution to this? Experiencing exactly the same issue here right now.