Visitar URL original
feat!: inline `@vitest/runner` package, do not publish it anymore by sheremet-va · Pull Request #10511 · vitest-dev/vitest · GitHub
Skip to content

feat!: inline @vitest/runner package, do not publish it anymore - #10511

Merged
sheremet-va merged 12 commits into
mainfrom
feat/remove-runner=package
Jun 3, 2026
Merged

sheremet-va merged 12 commits into
mainfrom
feat/remove-runner=package

Conversation

@sheremet-va

@sheremet-va sheremet-va commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

This package is very tightly connected to Vitest and is not used outside of vitest. We had to develop a lot of hacky workaround to augment types or pass down objects in a strange way to keep it agnostic, but the benefits do not outweght the negatives at this point.

The runner config option still works the same way as it did before, the public types are also not touched. This is mostly a refactor change.

TODO:

  • Make utils modules not be bundled together with the runner (like createFileTask) since these modules are also used on node side

@netlify

netlify Bot commented Jun 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 35802ac
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a1f0e8d54910f0008f64c44
😎 Deploy Preview https://deploy-preview-10511--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@sheremet-va
sheremet-va requested a review from hi-ogawa June 2, 2026 19:11

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

Looks clean to me.

Can we dedupe this copy of generateFileHash now?

// TODO: copied from packages/runner/src/utils/collect.ts
interface HashMeta {
typecheck?: boolean
__vitest_label__?: string
}
function generateFileHash(
file: string,
projectName: string | undefined,
meta?: HashMeta,
): string {
const seed = [
file,
projectName || '',
meta?.typecheck ? '__typecheck__' : '',
meta?.__vitest_label__ || '',
].join('\0')
return generateHash(seed)
}

@sheremet-va
sheremet-va merged commit 6d6e46b into main Jun 3, 2026
8 checks passed
@sheremet-va
sheremet-va deleted the feat/remove-runner=package branch June 3, 2026 13:25
themattspiral added a commit to themattspiral/vitest-pool-assemblyscript that referenced this pull request Jul 6, 2026
vitest 5 inlined the @vitest/runner package into `vitest` and stopped
publishing it as of 5.0.0-beta5 (vitest-dev/vitest#10511)
so importing types from `@vitest/runner/types` and the
calculateSuiteHash / createFileTask / someTasksAreOnly utilities from
`@vitest/runner/utils` breaks on v5 now.

Fix:
- Source the task-tree types from `vitest` under their public re-export
  names which resolve across v3, v4, and v5
- Recreate the three runner utilities locally as none are exposed from a
  public `vitest` entry point in latest v5, placing them alongside the
  existing interpretTaskModes helper, with MIT attribution
  calculateSuiteHash is renamed to assignPositionalTaskIds for clarity
- Replace the @vitest/runner Retry/SerializableRetry types with a local type
- Drop @vitest/runner from peer/dev deps and the three external templates

The recreated file id must equal what vitest core computes for a spec
(TestSpecification.taskId), otherwise reported results and errors fail to
correlate through its idMap. vitest changed the hash seed in v5 (null-
separated) from v3/v4 (plain concatenation), so the seed is selected by
the running major, resolved once from `vitest/node`'s `version`.
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants