Skip to content

chore(infra): Migrate test runner from Vitest to Rstest#23

Merged
SoonIter merged 7 commits intomainfrom
copilot/migrate-from-vitest-to-rstest
Mar 17, 2026
Merged

chore(infra): Migrate test runner from Vitest to Rstest#23
SoonIter merged 7 commits intomainfrom
copilot/migrate-from-vitest-to-rstest

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

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

    • Replaced vitest with @rstest/core
    • Updated package.json scripts:
      • testrstest
      • test:watchrstest --watch
  • Rstest configuration

    • Replaced vitest.config.ts with rstest.config.ts
    • Switched to the Rslib adapter via @rstest/adapter-rslib
    • Added a local alias for path-serializer so e2e tests resolve the package to source instead of requiring a prebuilt dist
  • Dependency alignment

    • Added:
      • @rstest/core
      • @rstest/adapter-rslib
    • Removed:
      • vitest
    • Bumped @rslib/core to a version compatible with the current Rstest adapter
  • Test source updates

    • Replaced test imports from vitest with @rstest/core
    • Kept test structure and assertions unchanged aside from framework import updates
    • Applied a small test-file cleanup for lint compatibility in src/normalize.test.ts

Example of the API/config migration:

// rstest.config.ts
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'],
  resolve: {
    alias: {
      'path-serializer': fileURLToPath(new URL('./src/index.ts', import.meta.url)),
    },
  },
});

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
    • Triggering command: /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
    • Triggering command: /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.

Copilot AI and others added 3 commits March 17, 2026 10:25
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
Copilot AI requested a review from SoonIter March 17, 2026 10:30
@SoonIter SoonIter changed the title Migrate test runner from Vitest to Rstest chore(infra): Migrate test runner from Vitest to Rstest Mar 17, 2026
@SoonIter SoonIter marked this pull request as ready for review March 17, 2026 11:52
Copilot AI review requested due to automatic review settings March 17, 2026 11:52
@SoonIter SoonIter merged commit 50b8bce into main Mar 17, 2026
8 checks passed
@SoonIter SoonIter deleted the copilot/migrate-from-vitest-to-rstest branch March 17, 2026 11:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/core accordingly.
  • 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]
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.

3 participants