Skip to content

Commit 5380395

Browse files
committed
chore: supersede Vitest with Rstest
temp
1 parent 2824c1b commit 5380395

File tree

123 files changed

+977
-718
lines changed

Some content is hidden

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

123 files changed

+977
-718
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.5/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
33
"assist": {
44
"actions": {
55
"source": {
@@ -46,6 +46,7 @@
4646
"includes": [
4747
"**",
4848
"!**/*.vue",
49+
"!**/dist/**",
4950
"!**/.rslib/**/*",
5051
"!tests/integration/**/*/src/**/*",
5152
"!tests/e2e/react-component/public/umd/**/*"

examples/module-federation/mf-host/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react-dom": "^19.1.0"
1313
},
1414
"devDependencies": {
15-
"@module-federation/rsbuild-plugin": "^0.15.0",
15+
"@module-federation/rsbuild-plugin": "^0.16.0",
1616
"@rsbuild/core": "~1.4.2",
1717
"@rsbuild/plugin-react": "^1.3.2",
1818
"@types/react": "^19.1.8",

examples/module-federation/mf-host/rsbuild.config.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@ import { pluginReact } from '@rsbuild/plugin-react';
55
export default defineConfig({
66
plugins: [
77
pluginReact(),
8-
pluginModuleFederation({
9-
name: 'rsbuild_host',
10-
remotes: {
11-
rslib: 'rslib@http://localhost:3001/mf/mf-manifest.json',
12-
},
13-
shared: {
14-
react: {
15-
singleton: true,
8+
pluginModuleFederation(
9+
{
10+
name: 'rsbuild_host',
11+
remotes: {
12+
rslib: 'rslib@http://localhost:3001/mf/mf-manifest.json',
1613
},
17-
'react-dom': {
18-
singleton: true,
14+
shared: {
15+
react: {
16+
singleton: true,
17+
},
18+
'react-dom': {
19+
singleton: true,
20+
},
1921
},
22+
// Enable this when the output of Rslib is build under 'production' mode, while the host app is 'development'.
23+
// Reference: https://rslib.rs/guide/advanced/module-federation#faqs
24+
shareStrategy: 'loaded-first',
2025
},
21-
// Enable this when the output of Rslib is build under 'production' mode, while the host app is 'development'.
22-
// Reference: https://rslib.rs/guide/advanced/module-federation#faqs
23-
shareStrategy: 'loaded-first',
24-
}),
26+
{},
27+
),
2528
],
2629
});

examples/module-federation/mf-react-component/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"storybook": "storybook dev -p 6006"
1919
},
2020
"devDependencies": {
21-
"@module-federation/enhanced": "^0.15.0",
22-
"@module-federation/rsbuild-plugin": "^0.15.0",
21+
"@module-federation/enhanced": "^0.16.0",
22+
"@module-federation/rsbuild-plugin": "^0.16.0",
2323
"@module-federation/storybook-addon": "^4.0.20",
2424
"@rsbuild/plugin-react": "^1.3.2",
2525
"@rslib/core": "workspace:*",

examples/module-federation/mf-react-component/rslib.config.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,23 @@ export default defineConfig({
3434
assetPrefix: 'http://localhost:3001/mf',
3535
},
3636
plugins: [
37-
pluginModuleFederation({
38-
name: 'rslib_provider',
39-
exposes: {
40-
'.': './src/index.tsx',
41-
},
42-
shared: {
43-
react: {
44-
singleton: true,
37+
pluginModuleFederation(
38+
{
39+
name: 'rslib_provider',
40+
exposes: {
41+
'.': './src/index.tsx',
4542
},
46-
'react-dom': {
47-
singleton: true,
43+
shared: {
44+
react: {
45+
singleton: true,
46+
},
47+
'react-dom': {
48+
singleton: true,
49+
},
4850
},
4951
},
50-
}),
52+
{},
53+
),
5154
],
5255
},
5356
],

0 commit comments

Comments
 (0)