Skip to content

fix(coverage): in-source test cases excluded #7985

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

Merged

Conversation

AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented May 15, 2025

Description

  • Exclude in-source tests' if (import.meta.vitest) contents from coverage
  • Applied to Istanbul and AST-aware V8 only
    • the old V8 would require hacky solutions and is being deprecated soon so leaving it out of scope

Before-after:

image

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented May 15, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a905f42
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/683ab4975c697c0008148c9b
😎 Deploy Preview https://deploy-preview-7985--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@AriPerkkio AriPerkkio force-pushed the fix/coverage-in-source-test-exclusion branch from 4b5441a to 1dc899b Compare May 21, 2025 15:44
@AriPerkkio AriPerkkio force-pushed the fix/coverage-in-source-test-exclusion branch from 1dc899b to ccd28db Compare May 27, 2025 08:58
@AriPerkkio AriPerkkio force-pushed the fix/coverage-in-source-test-exclusion branch from ccd28db to 1e00a98 Compare May 27, 2025 10:47
@AriPerkkio AriPerkkio marked this pull request as ready for review May 27, 2025 10:52
@AriPerkkio AriPerkkio force-pushed the fix/coverage-in-source-test-exclusion branch from 1e00a98 to a905f42 Compare May 31, 2025 07:49
@AriPerkkio AriPerkkio merged commit 407c0e4 into vitest-dev:main May 31, 2025
13 checks passed
@AriPerkkio AriPerkkio deleted the fix/coverage-in-source-test-exclusion branch May 31, 2025 08:16
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.

2 participants