Skip to content

Empty code coverage on transpiled JS code #558

Open

Description

@gpradeepjain

I am inside a folder that has the below structure
src/ -> this has *.js and *.js.map
test/ -> this has *.js and *.js.map

I run the command c8@10.1.3/node_modules/c8/bin/c8.js --include src//*.js mocha@11.1.0/node_modules/mocha/bin/mocha.js test/unit//*.js --verbose

It does the tests but my coverage report says 0

----------|---------|----------|---------|---------|-------------------

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 0 0 0 0
---------- --------- ---------- --------- --------- -------------------

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

I tried --src src as well. But nothing worked. Does C8 work for transpiled JS code? How do I debug the above problem?

Activity

  1. bcoe commented on May 1, 2025

    @bcoe
    Owner

    @gpradeepjain could you provide a repository with a minimal reproduction please 👏

  2. kuba-orlik commented on Jul 21, 2025

    @kuba-orlik

    In my case the coverage showed as empty if I killed the running process with ctrl+C. If I run process.exit(0) to terminate the js script, then everything gets picked up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions