Skip to content

Commit f1b716e

Browse files
committed
chore: supersede Vitest with Rstest
temp
1 parent 1e274ac commit f1b716e

File tree

114 files changed

+349
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+349
-435
lines changed

.github/renovate.json5

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@
6666
// umd tests need to lock this version
6767
'react-18',
6868
'react-dom-18',
69-
// bundled dts tests need to lock this version
70-
'@vitest/expect',
7169
// see https://github.com/web-infra-dev/rslib/pull/992
7270
'@ast-grep/napi',
7371
],

.github/workflows/benchmark.yml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,34 @@ jobs:
2020
node-version: [20]
2121

2222
steps:
23-
- name: Checkout
24-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
25-
with:
26-
fetch-depth: 10
27-
ref: ${{ inputs.ref || 'main' }}
28-
29-
- name: Install pnpm
30-
run: |
31-
npm install -g corepack@latest --force
32-
corepack enable
33-
34-
- name: Setup Node.js ${{ matrix.node-version }}
35-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
36-
with:
37-
node-version: ${{ matrix.node-version }}
38-
cache: 'pnpm'
39-
40-
- name: Install Dependencies
41-
run: pnpm install && cd ./tests && pnpm playwright install chromium
42-
43-
# only run benchmark in Ubuntu
44-
- name: Benchmarks (Vitest)
45-
uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3
46-
with:
47-
run: pnpm run test:benchmark
48-
# token retrieved from the CodSpeed app at the previous step
49-
token: ${{ secrets.CODSPEED_TOKEN }}
23+
# just a dummy step
24+
- name: Dummy Step
25+
run: echo "TODO:\ Support benchmark in Rstest, this job is only a placeholder for the time being."
26+
27+
# - name: Checkout
28+
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29+
# with:
30+
# fetch-depth: 10
31+
# ref: ${{ inputs.ref || 'main' }}
32+
33+
# - name: Install pnpm
34+
# run: |
35+
# npm install -g corepack@latest --force
36+
# corepack enable
37+
38+
# - name: Setup Node.js ${{ matrix.node-version }}
39+
# uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
40+
# with:
41+
# node-version: ${{ matrix.node-version }}
42+
# cache: 'pnpm'
43+
44+
# - name: Install Dependencies
45+
# run: pnpm install && cd ./tests && pnpm playwright install chromium
46+
47+
# # only run benchmark in Ubuntu
48+
# - name: Benchmarks (Rstest)
49+
# uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3
50+
# with:
51+
# run: pnpm run test:benchmark
52+
# # token retrieved from the CodSpeed app at the previous step
53+
# token: ${{ secrets.CODSPEED_TOKEN }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
if: steps.changes.outputs.changed == 'true'
122122
run: pnpm install && cd ./tests && pnpm playwright install chromium
123123

124-
- name: Integration Test (Vitest)
124+
- name: Integration Test (Rstest)
125125
if: steps.changes.outputs.changed == 'true'
126126
run: pnpm run test:integration
127127

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ test-results
2525
**/@mf-types
2626
**/@mf-types/**
2727
.env.local
28-
.env.*.local
28+
.env.*.local
29+
.rslib/**/*

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ npx nx build @rslib/core --watch
7272

7373
If you've fixed a bug or added code that should be tested, then add some tests.
7474

75-
You can add unit test cases in the `<PACKAGE_DIR>/tests` folder. The test runner is based on [Vitest](https://vitest.dev/).
75+
You can add unit test cases in the `<PACKAGE_DIR>/tests` folder. The test runner is based on [Rstest](https://rstest.rs/).
7676

7777
### Run unit tests
7878

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"includes": [
4747
"**",
4848
"!**/*.vue",
49+
"!**/dist/**",
4950
"!**/.rslib/**/*",
5051
"!tests/integration/**/*/src/**/*",
5152
"!tests/e2e/react-component/public/umd/**/*"

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
"test:benchmark": "cd ./tests && pnpm run test:benchmark",
1919
"test:e2e": "pnpm run build:examples && cd tests && pnpm run test:e2e",
2020
"test:ecosystem-ci": "pnpm run test:unit && cross-env ECO_CI=1 pnpm run test:integration && pnpm run test:e2e",
21-
"test:integration": "cross-env NODE_OPTIONS='--experimental-vm-modules' vitest run --project integration",
22-
"test:integration:watch": "cross-env NODE_OPTIONS='--experimental-vm-modules' vitest --project integration",
23-
"test:unit": "vitest run --project unit*",
24-
"test:unit:watch": "vitest --project unit*",
21+
"test:integration": "pnpm -r --filter \"./tests\" run test",
22+
"test:unit": "pnpm -r --filter \"./packages/**\" run test",
2523
"testu": "pnpm run test:unit -u && pnpm run test:integration -u",
2624
"type-check": "pnpm -r run type-check",
2725
"update:rsbuild": "npx taze minor --include /rsbuild/ -w -r -l",
@@ -44,6 +42,7 @@
4442
"devDependencies": {
4543
"@biomejs/biome": "^2.0.6",
4644
"@changesets/cli": "^2.29.5",
45+
"@rstest/core": "https://pkg.pr.new/web-infra-dev/rstest/@rstest/core@9105246",
4746
"@types/fs-extra": "^11.0.4",
4847
"@types/node": "^22.15.34",
4948
"check-dependency-version-consistency": "^5.0.1",
@@ -57,7 +56,6 @@
5756
"prettier-plugin-packagejson": "^2.5.17",
5857
"simple-git-hooks": "^2.13.0",
5958
"typescript": "^5.8.3",
60-
"vitest": "^3.2.4",
6159
"zx": "^8.6.0"
6260
},
6361
"packageManager": "[email protected]",

packages/core/__mocks__/fs/promises.cjs

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { promises } from 'memfs';
2+
export default promises;

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"build": "rslib build",
4040
"dev": "rslib build --watch",
4141
"prebundle": "prebundle",
42+
"test": "rstest run",
4243
"type-check": "tsc --noEmit && tsc --noEmit -p tests"
4344
},
4445
"dependencies": {

0 commit comments

Comments
 (0)