Skip to content

Commit 18671f6

Browse files
authored
test: migrate integration tests to rstest (#8512)
1 parent acb0b23 commit 18671f6

183 files changed

Lines changed: 529 additions & 2509 deletions

File tree

Some content is hidden

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

.github/workflows/integration-test-Linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ jobs:
7171

7272
- name: Test - Adapter Rstest
7373
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
74-
run: cd ./tests && pnpm run test:rstest
74+
run: cd ./tests && pnpm run test:rstest-adapter

.github/workflows/integration-test-Windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ jobs:
7777

7878
- name: Test - Adapter Rstest
7979
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
80-
run: cd ./tests && pnpm run test:rstest
80+
run: cd ./tests && pnpm run test:rstest-adapter

.github/workflows/ut-Windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Unit Test (Windows)
22

3-
# TODO: migrate jest tests to rstest later
43
concurrency:
54
group: windows-unit-test-${{ github.head_ref }}
65
cancel-in-progress: true

.github/workflows/ut-macOS.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Unit Test (macOS)
22

3-
# TODO: migrate jest tests to rstest later
43
concurrency:
54
group: macos-unit-test-${{ github.head_ref }}
65
cancel-in-progress: true

packages/cli/plugin-styled-components/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"@modern-js/rslib": "workspace:*",
3939
"@modern-js/runtime": "workspace:*",
4040
"@rslib/core": "0.20.3",
41-
"@types/jest": "^29.5.14",
4241
"@types/node": "^20",
4342
"@types/styled-components": "^5.1.36",
4443
"styled-components": "^5.3.1",

packages/document/docs/en/community/contributing-guide.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pnpm run reset
125125

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

128-
You can add unit test cases in the `<PACKAGE_DIR>/tests` folder. The test syntax is based on [Jest](https://jestjs.io/) and [Rstest](https://rstest.rs/).
128+
You can add unit test cases in the `<PACKAGE_DIR>/tests` folder. The test syntax is based on [Rstest](https://rstest.rs/).
129129

130130
### Run Unit Tests
131131

@@ -155,7 +155,7 @@ If you need to run a specified test, you can add keywords to filter:
155155

156156
```sh
157157
# Only run test cases with the copy-assets keyword
158-
npx jest copy-assets
158+
npx rstest copy-assets
159159
```
160160

161161
## Linting

packages/document/docs/zh/community/contributing-guide.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pnpm run reset
124124

125125
如果你进行了 bugfix,或者添加了需要测试的代码,请添加一些测试代码。
126126

127-
你可以在 `<PACKAGE_DIR>/tests` 文件夹中添加单元测试用例。测试语法基于 [Jest](https://jestjs.io/)[Rstest](https://rstest.rs/)
127+
你可以在 `<PACKAGE_DIR>/tests` 文件夹中添加单元测试用例。测试语法基于 [Rstest](https://rstest.rs/)
128128

129129
### 运行单元测试
130130

@@ -154,7 +154,7 @@ pnpm run test:e2e
154154

155155
```sh
156156
# 只运行带有 copy-assets 关键词的测试用例
157-
npx jest copy-assets
157+
npx rstest copy-assets
158158
```
159159

160160
## Linting

packages/runtime/plugin-i18n/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,11 @@
118118
"@modern-js/rslib": "workspace:*",
119119
"@modern-js/runtime": "workspace:*",
120120
"@rslib/core": "0.20.3",
121-
"@types/jest": "^29.5.14",
122121
"@types/node": "^20",
123122
"i18next": "25.7.4",
124-
"jest": "^29.7.0",
125123
"react": "^19.2.4",
126124
"react-dom": "^19.2.4",
127125
"react-i18next": "15.7.4",
128-
"ts-jest": "^29.4.6",
129126
"ts-node": "^10.9.2",
130127
"typescript": "^5"
131128
},

packages/server/create-request/env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { wait } from '../src';
22

3-
jest.useRealTimers();
3+
rstest.useRealTimers();
44

55
describe('wait', () => {
66
test('basic usage', async () => {
7-
const fn1 = jest.fn();
8-
const fn2 = jest.fn();
7+
const fn1 = rstest.fn();
8+
const fn2 = rstest.fn();
99
const fn3 = async () => {
1010
fn1();
1111
await wait();
@@ -20,8 +20,8 @@ describe('wait', () => {
2020
});
2121

2222
test('delay', async () => {
23-
const fn1 = jest.fn();
24-
const fn2 = jest.fn();
23+
const fn1 = rstest.fn();
24+
const fn2 = rstest.fn();
2525
const time = 100;
2626
const fn3 = async () => {
2727
fn1();

0 commit comments

Comments
 (0)