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(coverage): Yarn PnP virtual module resolving #7357

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AriPerkkio
Copy link
Member

Description

  • Some package managers require rest of the ecosystem to add runtime checks for them

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

pkg-pr-new bot commented Jan 24, 2025

@vitest/browser

npm i https://pkg.pr.new/@vitest/browser@7357

@vitest/coverage-istanbul

npm i https://pkg.pr.new/@vitest/coverage-istanbul@7357

@vitest/expect

npm i https://pkg.pr.new/@vitest/expect@7357

@vitest/mocker

npm i https://pkg.pr.new/@vitest/mocker@7357

@vitest/coverage-v8

npm i https://pkg.pr.new/@vitest/coverage-v8@7357

@vitest/pretty-format

npm i https://pkg.pr.new/@vitest/pretty-format@7357

@vitest/runner

npm i https://pkg.pr.new/@vitest/runner@7357

@vitest/snapshot

npm i https://pkg.pr.new/@vitest/snapshot@7357

@vitest/spy

npm i https://pkg.pr.new/@vitest/spy@7357

@vitest/ui

npm i https://pkg.pr.new/@vitest/ui@7357

@vitest/utils

npm i https://pkg.pr.new/@vitest/utils@7357

vite-node

npm i https://pkg.pr.new/vite-node@7357

vitest

npm i https://pkg.pr.new/vitest@7357

@vitest/web-worker

npm i https://pkg.pr.new/@vitest/web-worker@7357

@vitest/ws-client

npm i https://pkg.pr.new/@vitest/ws-client@7357

commit: 770c99c

for (const file of Object.keys(coverage) as (keyof typeof coverage)[]) {
const fileCoverage = coverage[file]

const filename = pnp.resolveVirtual(file)
Copy link
Contributor

@mrginglymus mrginglymus Jan 24, 2025

Choose a reason for hiding this comment

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

This should only be called on virtual paths, otherwise it will return null.

if (!file.includes('__virtual__')) continue?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, on windows this will return a \ separated path, where the coverage map contains / separated paths (even on windows), so you'll need to apply your favourite slash function (or just .replaceAll('\\', '/'))

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

Successfully merging this pull request may close these issues.

2 participants