GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix (jest-runtime): correct `wrapperLength` value for ESM modules by mrazauskas · Pull Request #11893 · jestjs/jest

Conversation

@mrazauskas

@mrazauskas mrazauskas commented Sep 25, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Resolves #11891.

v8 coverage reports were incorrect in ESM mode. Seems like wrapperLength value was the problem. If I got it right, transformFileAsync is called only in ESM mode. And if I get it right, the wrapper is CJS module wrapper. ESM is not using it, so perhaps the best solution is to keep the value of wrapperLength undefined. Simply: the wrapper does not exist.

Test plan

I started form failing tests. The failing ones were: esm-native-without-sourcemap and esm-with-custom-transformer.

It seemed useful to rename the v8 test directory by prefixing it with coverage- (coverage-provider-v8 instead of v8-coverage). This way all coverage related tests live next to each other. Easier to find them.

I created tests for both native cjs and native ems. The wrapperLength value is the imporntant difference, which has to be covered by tests. The wrapper is only important for v8 coverage.

cjs-native and esm-native tests are also proving that coverage report looks good if source map is not included. Here the source code is not transformed at all, hence we do not have source map. These two tests are fully replacing current no-sourcemap test, which I removed as unnecessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@facebook-github-bot facebook-github-bot added the cla signed label Sep 25, 2021
SimenB
SimenB requested changes Sep 25, 2021
View reviewed changes

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

this looks pretty good! I'd like to keep the existent test as is, but beyond that this LGTM 🙂

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/jest-reporters/src/CoverageReporter.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/jest-runtime/src/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/jest-test-result/src/types.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread e2e/v8-coverage/no-sourcemap/cssTransform.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

SimenB
SimenB reviewed Sep 25, 2021
View reviewed changes
Comment thread CHANGELOG.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

mrazauskas added 3 commits September 25, 2021 13:02
@mrazauskas
test: extend v8 coverage test suite
de74997
@mrazauskas
fix: set wrapperLength to 0
733ddcd
@mrazauskas
chore: update CHANGELOG.md
3e69ad2
@mrazauskas

mrazauskas commented Sep 25, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@SimenB All (should be) fixed as suggested. Thanks for the review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

SimenB
SimenB reviewed Sep 25, 2021
View reviewed changes
Comment thread e2e/__tests__/__snapshots__/coverageProviderV8.test.ts-.snap Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mrazauskas
test: clean up
74a040b
@mrazauskas mrazauskas changed the title fix (jest-runtime): do not add wrapperLength to fileTransforms for ESM modules fix (jest-runtime): correct wrapperLength value for ESM modules Sep 25, 2021
mrazauskas added 2 commits September 25, 2021 13:35
@mrazauskas
test(fix): do not run ESM tests on Node 10
38d2c32
@mrazauskas
test: fix snapshots
6727a01
@codecov-commenter

codecov-commenter commented Sep 25, 2021

Copy link
Copy Markdown

Codecov Report

Merging #11893 (6727a01) into main (da7c4a4) will decrease coverage by 0.13%.
The diff coverage is 54.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11893      +/-   ##
==========================================
- Coverage   68.87%   68.73%   -0.14%     
==========================================
  Files         312      322      +10     
  Lines       16432    16580     +148     
  Branches     4768     4784      +16     
==========================================
+ Hits        11318    11397      +79     
- Misses       5087     5150      +63     
- Partials       27       33       +6     
Impacted Files Coverage Δ
...vider-v8/cjs-native-without-sourcemap/uncovered.js 0.00% <0.00%> (ø)
...ge-provider-v8/cjs-with-babel-transformer/types.ts 0.00% <0.00%> (ø)
...rovider-v8/cjs-with-babel-transformer/uncovered.ts 0.00% <0.00%> (ø)
e2e/coverage-provider-v8/empty-sourcemap/types.ts 100.00% <ø> (ø)
...vider-v8/esm-native-without-sourcemap/uncovered.js 0.00% <0.00%> (ø)
...e-provider-v8/esm-with-custom-transformer/types.ts 0.00% <0.00%> (ø)
...ovider-v8/esm-with-custom-transformer/uncovered.ts 0.00% <0.00%> (ø)
e2e/coverage-provider-v8/no-sourcemap/Thing.js 100.00% <ø> (ø)
e2e/coverage-provider-v8/no-sourcemap/x.css 100.00% <ø> (ø)
packages/jest-runtime/src/index.ts 56.44% <ø> (ø)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da7c4a4...6727a01. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SimenB
only one onNodeVersions
6d03a58
SimenB
SimenB approved these changes Sep 25, 2021
View reviewed changes

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mrazauskas reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@SimenB
SimenB merged commit d4fff6a into jestjs:main Sep 25, 2021
@mrazauskas
mrazauskas deleted the fix-v8-coverage branch September 25, 2021 13:22
@SimenB

SimenB commented Sep 25, 2021

Copy link
Copy Markdown
Member

https://github.com/facebook/jest/releases/tag/v27.2.2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 26, 2021

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@SimenB SimenB SimenB approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mrazauskas @codecov-commenter @SimenB @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.