Skip to content

Commit 51bf151

Browse files
authored
Merge pull request #877 from vitest-dev/sync-7e382ef5-1
docs(en): merge docs-cn/sync-docs into docs-cn/dev @ 7e382ef
2 parents 1109755 + 017e598 commit 51bf151

File tree

6 files changed

+46
-6
lines changed

6 files changed

+46
-6
lines changed

api/expect-typeof.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,24 @@ expectTypeOf(obj).toHaveProperty('a').toBeNumber()
552552
expectTypeOf(obj).toHaveProperty('b').toBeString()
553553
expectTypeOf(obj).toHaveProperty('a').not.toBeString()
554554
```
555+
556+
<!-- TODO: translation -->
557+
## branded
558+
559+
- **Type:** `ExpectTypeOf<BrandedType>`
560+
561+
You can use `.branded` to allow type assertions to succeed for types that are semantically equivalent but differ in representation.
562+
563+
```ts
564+
import { expectTypeOf } from 'vitest'
565+
566+
// Without .branded, this fails even though the types are effectively the same
567+
expectTypeOf<{ a: { b: 1 } & { c: 1 } }>().toEqualTypeOf<{ a: { b: 1; c: 1 } }>()
568+
569+
// With .branded, the assertion succeeds
570+
expectTypeOf<{ a: { b: 1 } & { c: 1 } }>().branded.toEqualTypeOf<{ a: { b: 1; c: 1 } }>()
571+
```
572+
573+
::: warning
574+
This helper comes at a performance cost and can cause the TypeScript compiler to 'give up' if used with excessively deep types. Use it sparingly and only when necessary.
575+
:::

config/experimental.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
title: experimental | Config
33
outline: deep
44
---
5+
<!-- TODO: translation -->
56

67
# experimental
78

89
## experimental.fsModuleCache <Version type="experimental">4.0.11</Version> {#experimental-fsmodulecache}
910

11+
::: tip 功能反馈
12+
请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9221)
13+
:::
14+
1015
- **Type:** `boolean`
1116
- **Default:** `false`
1217

@@ -103,6 +108,10 @@ At the moment, Vitest ignores the [test.cache.dir](/config/cache) or [cacheDir](
103108

104109
## experimental.openTelemetry <Version type="experimental">4.0.11</Version> {#experimental-opentelemetry}
105110

111+
::: tip 功能反馈
112+
请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9222)
113+
:::
114+
106115
- **Type:**
107116

108117
```ts
@@ -168,6 +177,10 @@ It's important that Node can process `sdkPath` content because it is not transfo
168177

169178
## experimental.printImportBreakdown <Version type="experimental">4.0.15</Version> {#experimental-printimportbreakdown}
170179

180+
::: tip 功能反馈
181+
请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9224)
182+
:::
183+
171184
- **Type:** `boolean`
172185
- **Default:** `false`
173186

config/onstacktrace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: onStackTrace | Config
33
outline: deep
44
---
5-
5+
<!-- TODO: translation -->
66
# onStackTrace <CRoot />
77

88
- **Type**: `(error: Error, frame: ParsedStack) => boolean | void`
99

10-
Apply a filtering function to each frame of each stack trace when handling errors. This does not apply to stack traces printed by [`printConsoleTrace`](#printConsoleTrace). The first argument, `error`, is a `TestError`.
10+
Apply a filtering function to each frame of each stack trace when handling errors. This does not apply to stack traces printed by [`printConsoleTrace`](/config/printconsoletrace#printconsoletrace). The first argument, `error`, is a `TestError`.
1111

1212
Can be useful for filtering out stack trace frames from third-party libraries.
1313

guide/open-telemetry.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Open Telemetry Support <Experimental /> {#open-telemetry-support}
2+
<!-- TODO: translation -->
3+
::: tip 功能反馈
4+
请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9222)
5+
:::
26

3-
::: tip Example Project
4-
7+
::: tip 示例项目
58
[GitHub](https://github.com/vitest-dev/vitest/tree/main/examples/opentelemetry)
6-
79
:::
810

911
[OpenTelemetry](https://opentelemetry.io/) traces can be a useful tool to debug the performance and behavior of your application inside tests.

guide/ui.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ npx vite preview --outDir ./html
129129

130130
### 导入耗时分析 {#import-breakdown}
131131

132+
::: tip 功能反馈
133+
请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9224)
134+
:::
135+
132136
模块图选项卡还会提供导入耗时分析功能,默认显示加载时间最长的10个模块(点击"显示更多"可追加10个),按总耗时排序。
133137

134138
<img alt="Import breakdown with a list of top 10 modules that take the longest time to load" img-light src="/ui/light-import-breakdown.png">

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ publish = ".vitepress/dist"
33
command = "npx pnpm i --ignore-scripts && pnpm run build"
44

55
[build.environment]
6-
NODE_VERSION = "20"
6+
NODE_VERSION = "24"
77

88
[[redirects]]
99
from = "https://cn-vitest.netlify.app/*"

0 commit comments

Comments
 (0)