Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@jest/transform): do not attempt instrumenting .json modules #14048

Merged
merged 5 commits into from Apr 8, 2023

Conversation

mrazauskas
Copy link
Contributor

Fixes #13980

Summary

Currently Babel coverage provider is attempting to collect coverage collection from imported .json files, because in ESM these are treated as just another modules.

This PR is adding a check in shouldInstrument() function to exclude .json files. It is still possible to override this using forceCoverageMatch option.

Test plan

Unit tests added.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SimenB SimenB merged commit e5b6287 into jestjs:main Apr 8, 2023
12 of 18 checks passed
@mrazauskas mrazauskas deleted the fix-do-not-instrument-json-modules branch April 8, 2023 08:47
DmitryMakhnev pushed a commit to DmitryMakhnev/jest that referenced this pull request May 5, 2023
@github-actions
Copy link

github-actions bot commented May 9, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2023
@SimenB
Copy link
Member

SimenB commented Jul 4, 2023

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: import JSON fails when coverage is enabled
3 participants