Skip to content

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

Merged
SimenB merged 5 commits into
jestjs:mainfrom
mrazauskas:fix-do-not-instrument-json-modules
Apr 8, 2023
Merged

SimenB merged 5 commits into
jestjs:mainfrom
mrazauskas:fix-do-not-instrument-json-modules

Conversation

@mrazauskas

Copy link
Copy Markdown
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.

Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

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
@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

github-actions Bot commented May 9, 2023

Copy link
Copy Markdown

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

SimenB commented Jul 4, 2023

Copy link
Copy Markdown
Member

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