Skip to content

Commit bd5949a

Browse files
authored
docs: polish up (#375)
1 parent fa0cd8d commit bd5949a

22 files changed

+64
-60
lines changed

packages/core/tests/rstestEnv.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rstest/core/globals" />

packages/core/tests/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": "@rstest/tsconfig/base",
33
"compilerOptions": {
4-
"baseUrl": "./",
5-
"types": ["@rstest/core/globals"]
4+
"baseUrl": "./"
65
},
76
"include": ["./**/*.ts"]
87
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rstest/core/globals" />
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": "@rstest/tsconfig/base",
33
"compilerOptions": {
4-
"baseUrl": "./",
5-
"types": ["@rstest/core/globals"]
4+
"baseUrl": "./"
65
},
76
"include": ["./**/*.ts"]
87
}

tests/in-source/fixtures/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineConfig({
99
],
1010
source: {
1111
define: {
12-
'import.meta.rstest': undefined,
12+
'import.meta.rstest': false,
1313
},
1414
},
1515
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rstest/core/importMeta" />

tests/in-source/fixtures/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"isolatedModules": true,
1010
"resolveJsonModule": true,
1111
"moduleResolution": "bundler",
12-
"useDefineForClassFields": true,
13-
"types": ["@rstest/core/importMeta"]
12+
"useDefineForClassFields": true
1413
},
1514
"include": ["src"]
1615
}

website/docs/en/config/test/disableConsoleIntercept.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
Disable interception of console logs. By default, Rstest intercepts the console log, which will help track log sources.
88

9-
If you don't want Rstest to intercept console logs, you can set this configuration to `true`. It should be noted that when you disable interception of console logs, the `onConsoleLog` and `printConsoleTrace` configurations will not take effect.
9+
If you don't want Rstest to intercept console logs, you can set this configuration to `true`. It should be noted that when you disable interception of console logs, the [onConsoleLog](/config/test/onConsoleLog) and [printConsoleTrace](/config/test/printConsoleTrace) configurations will not take effect.

website/docs/en/config/test/globals.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default defineConfig({
2222

2323
## Usage
2424

25-
When you enable `globals`, you can use the global APIs directly without `import from '@rstest/core'`.
25+
When you enable `globals`, you can use the global APIs directly without `import { ... } from '@rstest/core'`.
2626

2727
```diff title="index.test.ts"
2828
- import { describe, expect, it } from '@rstest/core';
@@ -36,12 +36,8 @@ describe('Index', () => {
3636

3737
### TypeScript support
3838

39-
To get TypeScript working with the global APIs, add `@rstest/core/globals` to the types field in your `tsconfig.json`
39+
To get TypeScript working with the global APIs, you can create a `src/rstestEnv.d.ts` file to reference:
4040

41-
```json title=tsconfig.json
42-
{
43-
"compilerOptions": {
44-
"types": ["@rstest/core/globals"]
45-
}
46-
}
41+
```ts title=rstestEnv.d.ts
42+
/// <reference types="@rstest/core/globals" />
4743
```

website/docs/en/config/test/includeSource.mdx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,16 @@ import { defineConfig } from '@rsbuild/core';
4646
export default defineConfig({
4747
source: {
4848
define: {
49-
+ 'import.meta.rstest': undefined,
49+
+ 'import.meta.rstest': false,
5050
},
5151
},
5252
});
5353
```
5454

5555
### TypeScript
5656

57-
To get TypeScript support for `import.meta.rstest`, you should add `@rstest/core/importMeta` to your `tsconfig.json`:
57+
To get TypeScript support for `import.meta.rstest`, you can create a `src/rstestEnv.d.ts` file to reference:
5858

59-
```diff title=tsconfig.json
60-
{
61-
"compilerOptions": {
62-
"types": [
63-
+ "@rstest/core/importMeta"
64-
]
65-
}
66-
}
59+
```ts title=rstestEnv.d.ts
60+
/// <reference types="@rstest/core/importMeta" />
6761
```

0 commit comments

Comments
 (0)