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

chore(vue3-jest): add missing code coverage e2e for #422 #423

Closed
wants to merge 4 commits into from
Closed

chore(vue3-jest): add missing code coverage e2e for #422 #423

wants to merge 4 commits into from

Conversation

wopian
Copy link

@wopian wopian commented Dec 3, 2021

See #422 for details on the issue.

This minimal reproduction reproduces the bug I see in our project, with SFC Vue files that are imported in test files vanish from coverage reports. Untested SFC Vue files are reported correctly with no code coverage.

Both Basic.vue and Untested.vue are identical and use the current SFC
<script setup> syntax as of Vue 3.2.22

Screenshot 2021-12-03 at 15 14 23

@wopian
Copy link
Author

wopian commented Dec 3, 2021

Should the following be added to jest.config.js to deliberately fail the test script when coverage from Basic.vue is not collected? (it should be somewhere between 25-50% as the method function is unused, but 1% works too)

  coverageThreshold: {
    global: {
      lines: 1
    }
  }

@wopian wopian changed the title chore: add missing code coverage e2e for #422 chore(vue3-jest): add missing code coverage e2e for #422 Dec 3, 2021
@wopian
Copy link
Author

wopian commented Dec 10, 2021

@lmiller1990 this appears to be an issue between Vue Jest and the default (babel) coverage provider used by Jest.

Running these tests (and in production repo) with the experimental v8 engine as the coverage provider correctly outputs coverage data for SFC Vue files - --coverageProvider=v8

Though I'm unable to use that as a temporary client-side fix in GitHub Actions as V8 is 6x slower to run (and without increasing heap size to 4GB, also crashes from OOM)

@lmiller1990
Copy link
Member

I see. What's the next step here, then, to get this fixed and merged?

@jolting
Copy link
Contributor

jolting commented Dec 20, 2021

Related?
jestjs/jest#11776

@wopian
Copy link
Author

wopian commented Dec 24, 2021

Unfortunately I do not have the available time to investigate why and what package between vue-jest, jest and whichever babel package is responsible for coverage is causing the issue.

Related? facebook/jest#11776

Checking that issue, it seems to be the exact opposite behaviour of this issue - no (javascript) coverage with v8 and coverage with the default babel coverage provider.

Here, there's no Vue SFC coverage (javascript is covered fine) with the default babel coverage provider, but v8 coverage provider has Vue SFC coverage.

@Roriz
Copy link

Roriz commented May 21, 2022

@lmiller1990 this appears to be an issue between Vue Jest and the default (babel) coverage provider used by Jest.

Running these tests (and in production repo) with the experimental v8 engine as the coverage provider correctly outputs coverage data for SFC Vue files - --coverageProvider=v8

Though I'm unable to use that as a temporary client-side fix in GitHub Actions as V8 is 6x slower to run (and without increasing heap size to 4GB, also crashes from OOM)

Thank you for this workaround, it works just fine in my specific case.

If helps anyone in the future, my setup:

  "@vue/cli-service": "5.0.4",
  "@vue/vue3-jest": "28.0.0",
  "babel-jest": "28.1.0",
  "jest": "28.1.0"

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants