Skip to content

fix(coverage): non-awaited module imports cause wrong offsets#10643

Merged
AriPerkkio merged 1 commit into
vitest-dev:mainfrom
AriPerkkio:fix/coverage-pending-module-imports
Jun 23, 2026
Merged

fix(coverage): non-awaited module imports cause wrong offsets#10643
AriPerkkio merged 1 commit into
vitest-dev:mainfrom
AriPerkkio:fix/coverage-pending-module-imports

Conversation

@AriPerkkio

@AriPerkkio AriPerkkio commented Jun 22, 2026

Copy link
Copy Markdown
Member

Description

Resolves #10581

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.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

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

@AriPerkkio
AriPerkkio force-pushed the fix/coverage-pending-module-imports branch from 09d5dae to 6797760 Compare June 22, 2026 14:14
@AriPerkkio
AriPerkkio marked this pull request as ready for review June 22, 2026 14:39
@AriPerkkio
AriPerkkio force-pushed the fix/coverage-pending-module-imports branch from 6797760 to 5b7e5f4 Compare June 22, 2026 16:42

@hi-ogawa hi-ogawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

Comment on lines +334 to +340
// Initialize execution info in case worker exited before module evaluation finished
this.options.moduleExecutionInfo?.set(options.filename, {
duration: 0,
selfTime: 0,
startOffset: codeDefinition.length,
importer,
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This also allows showing pending dynamic import in import duration list. 0 isn't intended but probably better than being not tracked at all.

@AriPerkkio
AriPerkkio merged commit c409014 into vitest-dev:main Jun 23, 2026
23 of 30 checks passed
@AriPerkkio
AriPerkkio deleted the fix/coverage-pending-module-imports branch June 23, 2026 05:10
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.

V8 coverage intermittently reports uncovered TypeScript ranges in full-suite runs

2 participants