You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/guide/integration/rsbuild.mdx
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ To add Rstest to an existing project, follow the [Quick Start](/guide/start/quic
24
24
25
25
## Reuse Rsbuild config
26
26
27
-
[@rstest/adapter-rsbuild](https://www.npmjs.com/package/@rstest/adapter-rsbuild) is an official adapter that allows Rstest to automatically inherit configuration from your existing Rsbuild config file. This ensures your test environment matches your build configuration without duplication.
27
+
[@rstest/adapter-rsbuild](https://www.npmjs.com/package/@rstest/adapter-rsbuild) is an official adapter that allows Rstest to automatically inherit test-relevant configuration from your existing Rsbuild config file. This keeps your test environment aligned with your build setup without carrying over options that only matter to dev servers or page output.
28
28
29
29
### Install adapter
30
30
@@ -49,9 +49,11 @@ export default defineConfig({
49
49
This will automatically:
50
50
51
51
- Load your `rsbuild.config.ts` file
52
-
-Map compatible Rsbuild options to Rstest configuration
52
+
-Extract and map test-relevant Rsbuild options to Rstest configuration
53
53
- Merge with any additional Rstest config you provide
54
54
55
+
The adapter does not reuse the entire Rsbuild config as-is. It keeps the parts that matter for test execution, such as module resolution, transforms, CSS Modules, and `target`, and automatically drops options like `dev`, `server`, and `html` that are specific to the dev server, page entry, or production output.
56
+
55
57
By default, the adapter uses `process.cwd()` to resolve the Rsbuild config. If your config lives elsewhere, you can use the `cwd` option. See [API](#api) for more details.
56
58
57
59
## API
@@ -171,6 +173,8 @@ export default defineConfig({
171
173
172
174
The adapter automatically maps these Rsbuild options to Rstest:
173
175
176
+
Only the fields listed below are inherited. Rsbuild options that are not listed are ignored by default, which means test-irrelevant sections such as `dev`, `server`, and `html` are automatically pruned during conversion.
Copy file name to clipboardExpand all lines: website/docs/en/guide/integration/rslib.mdx
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ To add Rstest to an existing project, follow the [Quick Start](/guide/start/quic
24
24
25
25
## Reuse Rslib config
26
26
27
-
[@rstest/adapter-rslib](https://www.npmjs.com/package/@rstest/adapter-rslib) is an official adapter that allows Rstest to automatically inherit configuration from your existing Rslib config file. This ensures your test environment matches your build configuration without duplication.
27
+
[@rstest/adapter-rslib](https://www.npmjs.com/package/@rstest/adapter-rslib) is an official adapter that allows Rstest to automatically inherit test-relevant configuration from your existing Rslib config file. This keeps your test environment aligned with your build setup without carrying over options that only matter to build output.
28
28
29
29
### Install adapter
30
30
@@ -49,9 +49,11 @@ export default defineConfig({
49
49
This will automatically:
50
50
51
51
- Load your `rslib.config.ts` file
52
-
-Map compatible Rslib options to Rstest configuration
52
+
-Extract and map test-relevant Rslib options to Rstest configuration
53
53
- Merge with any additional Rstest config you provide
54
54
55
+
The adapter does not reuse the entire Rslib config as-is. It keeps the parts that matter for test execution, such as module resolution, transforms, CSS Modules, decorator-related settings, and `target`, and automatically drops unmapped fields like `dev`, `server`, and `html`, along with other options that only exist for dev server, page entry, or build output.
56
+
55
57
By default, the adapter uses `process.cwd()` to resolve the Rslib config. If your config lives elsewhere, you can use the `cwd` option. See [API](#api) for more details.
56
58
57
59
## API
@@ -123,6 +125,8 @@ export default defineConfig({
123
125
124
126
You can then reference specific lib configurations in your Rstest config. Rstest will adapt the Rslib shared configuration and the lib configuration with a matching `libId` to Rstest format.
125
127
128
+
This still does not copy the whole lib config verbatim. The adapter only takes the lib's `source`, `output`, `tools`, `plugins`, and `resolve` fields that are relevant to test execution, then merges them with the shared config before converting the result to Rstest format.
129
+
126
130
```ts
127
131
// For testing the 'core' environment
128
132
exportdefaultdefineConfig({
@@ -172,6 +176,8 @@ export default defineConfig({
172
176
173
177
The adapter automatically maps these Rslib options to Rstest:
174
178
179
+
Only the fields listed below are inherited. Rslib options that are not listed are ignored by default, which means test-irrelevant sections such as `dev`, `server`, and `html` are automatically pruned during conversion.
0 commit comments