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: docs/guide/testing-types.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,13 @@ Vitest allows you to write tests for your types, using `expectTypeOf` or `assert
14
14
15
15
Under the hood Vitest calls `tsc` or `vue-tsc`, depending on your config, and parses results. Vitest will also print out type errors in your source code, if it finds any. You can disable it with [`typecheck.ignoreSourceErrors`](/config/#typecheck-ignoresourceerrors) config option.
16
16
17
-
Keep in mind that Vitest doesn't run or compile these files, they are only statically analyzed by the compiler, and because of that you cannot use any dynamic statements. Meaning, you cannot use dynamic test names, and `test.each`, `test.runIf`, `test.skipIf`, `test.concurrent` APIs. But you can use other APIs, like `test`, `describe`, `.only`, `.skip` and `.todo`.
17
+
Keep in mind that Vitest doesn't run these files, they are only statically analyzed by the compiler. Meaning, that if you use a dynamic name or `test.each` or `test.for`, the test name will not be evaluated - it will be displayed as is.
18
+
19
+
::: warning
20
+
Before Vitest 2.1, your `typecheck.include` overrode the `include` pattern, so your runtime tests did not actually run; they were only type-checked.
21
+
22
+
Since Vitest 2.1, if your `include` and `typecheck.include` overlap, Vitest will report type tests and runtime tests as separate entries.
23
+
:::
18
24
19
25
Using CLI flags, like `--allowOnly` and `-t` are also supported for type checking.
<divv-if="isTypecheck"v-tooltip.bottom="'This is a typecheck test. It won\'t report results of the runtime tests'"class="i-logos:typescript-icon"flex-shrink-0 />
<divv-if="type === 'file' && typecheck"v-tooltip.bottom="'This is a typecheck test. It won\'t report results of the runtime tests'"class="i-logos:typescript-icon"flex-shrink-0 />
0 commit comments