Skip to content

[Bug]: V8 coverage does not work with native ESM #11891

@mrazauskas

Description

@mrazauskas

Version

27.2.0

Steps to reproduce

As it was mentioned in #9430 (comment), I was trying out V8 coverage with native ESM. Babel coverage works well, but for some reason there are issues with V8 coverage.

I was testing:

  • ESM without transforming, hence without source maps included
  • TypeScript modules transformed into ESM with source maps included

@SimenB thanks for quick response and hints. I started from creating failing tests inside a clone of Jest repo. The same result – coverage works well with Babel, but not with V8. So I will dig into the code and will try to find the reason.

Expected behavior

I also tried out coverage using c8 module directly on an ESM file (without involving Jest). All is good. Quick, nice and precise.

Similar result is expected.

Actual behavior

V8 coverage reports seems to be buggy.

Additional context

No response

Environment

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  Binaries:
    Node: 16.9.1 - /usr/local/bin/node
    Yarn: 2.4.3 - /usr/local/bin/yarn
    npm: 7.21.1 - /usr/local/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions