istanbuljs / nyc

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

nyc ignores files ending with `-test.ts` #1545

Open ericmorand opened 5 months ago

ericmorand commented 5 months ago

Link to bug demonstration repository

Twing is plagued by this issue: we have a module named src/lib/helpers/get-test.ts which contains the getTest helper method that returns a Twing test from its name. This is not a test file, we did not ask it to be ignored but still it is missing from the report: https://coveralls.io/builds/65055920

Renaming it to get-foo.ts restores its presence in the report.

Interestingly enough, we also have a file named src/lib/node/expression/call/test.ts and it is not ignored.

I don't think I understand why nyc is ignoring files by itself. We already include files, so it is unclear why nyc assumes that we want to ignore certain files that are among those that we explicitly include.

Expected Behavior

Files ending with -test.ts are not ignored.

Observed Behavior

Files ending with -test.ts are ignored.

Environment Information

  System:
    OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 18.50 GB / 31.07 GB
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
  npmPackages:
    typescript: ^5.2.2 => 5.3.3