istanbuljs / nyc

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

nyc not working with project type module (esm) #1544

Open manuelbarzi opened 5 months ago

manuelbarzi commented 5 months ago

Expected Behavior

to extract a code coverage report in text and html format for my node project working as a module (with esm)

Observed Behavior

NOT WORKING!

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================

Troubleshooting steps

Environment Information

  System:
    OS: macOS 14.1.1
    CPU: (8) arm64 Apple M2
    Memory: 40.91 MB / 16.00 GB
  Binaries:
    Node: 21.6.0 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    nyc: ^15.1.0 => 15.1.0 
nuxy commented 4 months ago

Experiencing the same issue in Node: v20.11.0 when running ESM code.

Tested with, or without --require esm

adamreisnz commented 1 week ago

Duplicate of https://github.com/istanbuljs/nyc/issues/1530 I think