diff --git a/api/expect-typeof.md b/api/expect-typeof.md index 5c0ddb93..9fcbb5d6 100644 --- a/api/expect-typeof.md +++ b/api/expect-typeof.md @@ -552,3 +552,24 @@ expectTypeOf(obj).toHaveProperty('a').toBeNumber() expectTypeOf(obj).toHaveProperty('b').toBeString() expectTypeOf(obj).toHaveProperty('a').not.toBeString() ``` + + +## branded + +- **Type:** `ExpectTypeOf` + +You can use `.branded` to allow type assertions to succeed for types that are semantically equivalent but differ in representation. + +```ts +import { expectTypeOf } from 'vitest' + +// Without .branded, this fails even though the types are effectively the same +expectTypeOf<{ a: { b: 1 } & { c: 1 } }>().toEqualTypeOf<{ a: { b: 1; c: 1 } }>() + +// With .branded, the assertion succeeds +expectTypeOf<{ a: { b: 1 } & { c: 1 } }>().branded.toEqualTypeOf<{ a: { b: 1; c: 1 } }>() +``` + +::: warning +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. +::: diff --git a/config/experimental.md b/config/experimental.md index 984763a8..00c1205d 100644 --- a/config/experimental.md +++ b/config/experimental.md @@ -2,11 +2,16 @@ title: experimental | Config outline: deep --- + # experimental ## experimental.fsModuleCache 4.0.11 {#experimental-fsmodulecache} +::: tip 功能反馈 +请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9221)。 +::: + - **Type:** `boolean` - **Default:** `false` @@ -103,6 +108,10 @@ At the moment, Vitest ignores the [test.cache.dir](/config/cache) or [cacheDir]( ## experimental.openTelemetry 4.0.11 {#experimental-opentelemetry} +::: tip 功能反馈 +请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9222)。 +::: + - **Type:** ```ts @@ -168,6 +177,10 @@ It's important that Node can process `sdkPath` content because it is not transfo ## experimental.printImportBreakdown 4.0.15 {#experimental-printimportbreakdown} +::: tip 功能反馈 +请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9224)。 +::: + - **Type:** `boolean` - **Default:** `false` diff --git a/config/onstacktrace.md b/config/onstacktrace.md index 920284a0..4de50c67 100644 --- a/config/onstacktrace.md +++ b/config/onstacktrace.md @@ -2,12 +2,12 @@ title: onStackTrace | Config outline: deep --- - + # onStackTrace - **Type**: `(error: Error, frame: ParsedStack) => boolean | void` -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`. +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`. Can be useful for filtering out stack trace frames from third-party libraries. diff --git a/guide/open-telemetry.md b/guide/open-telemetry.md index 46397042..4bfc983b 100644 --- a/guide/open-telemetry.md +++ b/guide/open-telemetry.md @@ -1,9 +1,11 @@ # Open Telemetry Support {#open-telemetry-support} + +::: tip 功能反馈 +请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9222)。 +::: -::: tip Example Project - +::: tip 示例项目 [GitHub](https://github.com/vitest-dev/vitest/tree/main/examples/opentelemetry) - ::: [OpenTelemetry](https://opentelemetry.io/) traces can be a useful tool to debug the performance and behavior of your application inside tests. diff --git a/guide/ui.md b/guide/ui.md index a597e790..0df9ad75 100644 --- a/guide/ui.md +++ b/guide/ui.md @@ -129,6 +129,10 @@ npx vite preview --outDir ./html ### 导入耗时分析 {#import-breakdown} +::: tip 功能反馈 +请将关于此功能反馈提交至 [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions/9224)。 +::: + 模块图选项卡还会提供导入耗时分析功能,默认显示加载时间最长的10个模块(点击"显示更多"可追加10个),按总耗时排序。 Import breakdown with a list of top 10 modules that take the longest time to load diff --git a/netlify.toml b/netlify.toml index 301583b9..014a9e7b 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ publish = ".vitepress/dist" command = "npx pnpm i --ignore-scripts && pnpm run build" [build.environment] -NODE_VERSION = "20" +NODE_VERSION = "24" [[redirects]] from = "https://cn-vitest.netlify.app/*"