Skip to content

Migrate test toolchain to vitest 4 - #144

Merged
rwjblue-glean merged 3 commits into
masterfrom
deps/vitest-4-migration
Jun 18, 2026
Merged

Migrate test toolchain to vitest 4#144
rwjblue-glean merged 3 commits into
masterfrom
deps/vitest-4-migration

Conversation

@scalvert

Copy link
Copy Markdown
Collaborator

Migrates the dev/test toolchain to the current major versions and makes the suite pass under them.

Changes

  • vitest ^0.34.6^4.1.9 (pulls in vite 8).
  • Replaced the removed --no-threads CLI flag with pool: 'forks' + maxWorkers: 1 in vitest.config.ts. The tests process.chdir() into temp dirs, which is unsupported in worker threads, so a single forked child process is required.
  • defineConfig now imported from vitest/config (idiomatic for v4; makes test a typed property).
  • Updated two inline snapshots (vitest 4 stopped double-escaping inner quotes; the data is identical).

Supersedes #126 and #139

Both were dependabot bumps that failed all CI. #126 bumped a transitive esbuild; under vite 8's rolldown-based toolchain esbuild is no longer in the dependency tree at all, so that bump is moot.

npm test is green: lint + 40/40 tests.

🤖 Generated with Claude Code

@scalvert
scalvert requested a review from rwjblue June 17, 2026 23:42
@scalvert scalvert added internal dependencies Pull requests that update a dependency file labels Jun 18, 2026
@scalvert
scalvert force-pushed the deps/vitest-4-migration branch from a314349 to e5eb7ff Compare June 18, 2026 02:11
scalvert and others added 3 commits June 18, 2026 09:17
Bump vitest from ^0.34.6 to ^4.1.9, which pulls in vite 8. esbuild is no
longer part of the dependency tree (vite 8 uses rolldown), so the previous
transitive esbuild dependency is dropped entirely.

The npm scripts used the `--no-threads` flag to avoid running tests in
worker threads, which is required because the suite calls `process.chdir()`
into temp dirs (unsupported in worker threads, throws
ERR_WORKER_UNSUPPORTED_OPERATION). That flag was removed in modern vitest,
so configure the equivalent in vitest.config.ts via `pool: 'forks'` +
`maxWorkers: 1` and drop the dead flags from the scripts.

Update two inline snapshots whose only change is vitest 4 no longer
double-escaping inner quotes in the snapshot literal (data is identical).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This plugin fully replaces release-it's built-in `npm` plugin, but if the
built-in plugin is left enabled release-it also runs `npm version` and tries
to publish the root package, producing confusing errors. Detect this in the
constructor and emit a clear warning telling users to set `npm: false`
(`npm: { publish: false }` is not sufficient). Also document the correct
configuration and the TypeScript `Config` type gotcha in the README.

Closes #125
Closes #132

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The warning was emitted from the constructor and the test read it via
`log.warn.mock.calls`. release-it 19's test factory pre-wraps the logger as a
spy so `.mock` exists, but release-it 17/18 do not, so the tests threw
`Cannot read properties of undefined (reading 'calls')` on those versions.

Move the check to the top of `init()` (before the `skipChecks` guard) so it
still fires on every release but after the test harness can install a log
capture. The harness now overrides `log.warn` into a plain `warnings` array
(version-independent), and the three tests drive `init()` with `skipChecks`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scalvert
scalvert force-pushed the deps/vitest-4-migration branch from baeaa26 to 7a6a92c Compare June 18, 2026 16:18
@rwjblue-glean
rwjblue-glean merged commit 7f6f1af into master Jun 18, 2026
6 checks passed
@rwjblue-glean
rwjblue-glean deleted the deps/vitest-4-migration branch June 18, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants