Skip to content

Conversation

@AriPerkkio
Copy link
Member

Description

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:.

@netlify
Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9b463d6
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/66c4d354e59534000850e13c
😎 Deploy Preview https://deploy-preview-6372--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 site configuration.

Comment on lines +20 to +21
// Uncovered files outside project root should also be included
expect(files).toContain('<project-root>/test/test-utils/fixtures/uncovered.ts')
Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually working correctly already. Uncovered files are resolved from the project root:

const allFiles = await this.testExclude.glob(this.ctx.config.root)
let includedFiles = allFiles.map(file =>
resolve(this.ctx.config.root, file),
)
if (this.ctx.config.changed) {
includedFiles = (this.ctx.config.related || []).filter(file =>
includedFiles.includes(file),
)
}
const uncoveredFiles = includedFiles
.map(file => pathToFileURL(file))
.filter(file => !testedFiles.includes(file.pathname))

const allFiles = await this.testExclude.glob(this.ctx.config.root)
let includedFiles = allFiles.map(file =>
resolve(this.ctx.config.root, file),
)
if (this.ctx.config.changed) {
includedFiles = (this.ctx.config.related || []).filter(file =>
includedFiles.includes(file),
)
}
const uncoveredFiles = includedFiles
.filter(file => !coveredFiles.includes(file))
.sort()

@AriPerkkio AriPerkkio closed this Aug 21, 2024
@AriPerkkio AriPerkkio deleted the fix/coverage-allow-external-uncovered branch August 21, 2024 04:55
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.

1 participant