chore(infra): Migrate test runner from Vitest to Rstest#23
Merged
Conversation
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate from Vitest to latest Rstest version
Migrate test runner from Vitest to Rstest
Mar 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s test runner/tooling from Vitest to Rstest, aligning the test setup with the current Rslib-based build stack and updating CI to run the new runner.
Changes:
- Replaced Vitest with
@rstest/core+@rstest/adapter-rslib, updated test scripts, and bumped@rslib/coreaccordingly. - Updated unit/e2e test files and snapshot headers to use Rstest imports/output.
- Updated GitHub Actions workflows to run tests/releases under a newer Node version.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Removed the old Vitest config. |
| rstest.config.ts | Added Rstest config using the Rslib adapter. |
| package.json | Switched test scripts to rstest; replaced Vitest dev dependency with Rstest deps; bumped @rslib/core. |
| pnpm-lock.yaml | Lockfile updates for the new Rstest/Rslib toolchain versions and transitive deps. |
| src/normalize.test.ts | Updated test framework imports; minor loop refactor for lint compatibility. |
| e2e/transformCLR.test.ts | Updated imports to @rstest/core. |
| e2e/replaceRootWithFileProtocol.test.ts | Updated imports to @rstest/core. |
| e2e/pnpmInnerWin32.test.ts | Updated imports to @rstest/core. |
| e2e/pnpmGlobalVirtualStore.test.ts | Updated imports to @rstest/core. |
| e2e/index.test.ts | Updated imports to @rstest/core. |
| e2e/features.test.ts | Consolidated Vitest imports into @rstest/core. |
| e2e/escapeEOL.test.ts | Consolidated Vitest imports into @rstest/core. |
| e2e/snapshots/index.test.ts.snap | Updated snapshot header to Rstest format. |
| .github/workflows/test-windows.yml | Updated test matrix Node version. |
| .github/workflows/test-ubuntu.yml | Updated test matrix Node version. |
| .github/workflows/release.yml | Updated release workflow Node version. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| node-version: 24 |
Comment on lines
+1
to
+7
| import { fileURLToPath } from 'node:url'; | ||
| import { withRslibConfig } from '@rstest/adapter-rslib'; | ||
| import { defineConfig } from '@rstest/core'; | ||
|
|
||
| export default defineConfig({ | ||
| extends: withRslibConfig(), | ||
| include: ['./src/**/*.test.ts', './e2e/**/*.test.ts'], |
Comment on lines
37
to
+53
| "devDependencies": { | ||
| "vitest": "^2.1.6", | ||
| "@biomejs/biome": "^1.9.4", | ||
| "@microsoft/api-extractor": "^7.48.0", | ||
| "@rslib/core": "0.1.1", | ||
| "@rslib/core": "0.18.6", | ||
| "@rstest/adapter-rslib": "0.2.1", | ||
| "@rstest/core": "0.9.2", | ||
| "@types/lodash-es": "^4.17.12", | ||
| "@types/node": "^22.10.1", | ||
| "execa": "9.5.1", | ||
| "fs-extra": "11.2.0", | ||
| "lodash-es": "^4.17.21", | ||
| "nano-staged": "^0.8.0", | ||
| "semver": "7.6.3", | ||
| "simple-git-hooks": "^2.11.1", | ||
| "slash": "5.1.0", | ||
| "typescript": "^5.7.2", | ||
| "upath": "^2.0.1", | ||
| "execa": "9.5.1", | ||
| "fs-extra": "11.2.0", | ||
| "semver": "7.6.3" | ||
| "upath": "^2.0.1" |
| strategy: | ||
| matrix: | ||
| node-version: [18] | ||
| node-version: [24] |
| strategy: | ||
| matrix: | ||
| node-version: [18] | ||
| node-version: [24] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the repository from Vitest to the latest Rstest toolchain. The migration keeps the existing test coverage and e2e package self-import pattern intact while aligning test configuration with the Rslib-based project setup.
Test runner migration
vitestwith@rstest/corepackage.jsonscripts:test→rstesttest:watch→rstest --watchRstest configuration
vitest.config.tswithrstest.config.ts@rstest/adapter-rslibpath-serializerso e2e tests resolve the package to source instead of requiring a prebuiltdistDependency alignment
@rstest/core@rstest/adapter-rslibvitest@rslib/coreto a version compatible with the current Rstest adapterTest source updates
vitestwith@rstest/coresrc/normalize.test.tsExample of the API/config migration:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
rsbuild.rs/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)rstest.rs/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.