Skip to content

jest coverage misses subprocesses #5274

@mnmkng

Description

@mnmkng

Hello,

some time ago I opened an issue with nyc, which is a CLI interface to istanbul, the instrumenter used by jest #729. It is related to getting incorrect coverage out of jest (+ nyc) combination. I'll briefly summarize and hopefully explain why I'm also opening the issue with Jest.

We use Jest as our test platform and would like to also use its --coverage feature. However, even after thorough testing, we weren't able to get coverage output for files executed in a forked subprocess (we spawn servers and hit them with requests to test their API). Parent files would report coverage correctly, while no coverage would be output for child files.

So we introduced nyc to the mix. Surprisingly, nyc would output correct coverage for the child process files, but no coverage for the parent files. Gentlemen at nyc suggested running tests twice and merging the results, but that has proven difficult for our use case.

Expected behavior

Jest should correctly output coverage for forked processes.

Observed behavior

Jest outputs no coverage for forked processes.

Repo that reproduces the issue

https://github.com/mnmkng/nyc-jest-issue

The nice gentlemen at nyc offered coordination in resolution of this issue, so feel free to refer back to the original nyc issue #729 for more details and discussion.

Thank you for your time.

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