Skip to content


Choose a tag to compare
@github-actions github-actions released this 07 Nov 15:59
· 245 commits to main since this release

    Builtin TypeChecking

In v0.25.0, Vitest allows you to write tests for your types, using expectTypeOf or assertType syntaxes. By default all tests inside *.test-d.ts files are considered type tests. Run vitest typecheck to run type tests.

// my.test-d.ts
import { assertType, expectTypeOf } from 'vitest'
import { mount } from './mount.js'

test('my types work properly', () => {
  expectTypeOf(mount).parameter(0).toMatchTypeOf<{ name: string }>()

  // @ts-expect-error name is a string
  assertType(mount({ name: 42 }))

Learn more at the documentation and this RFC

   🚨 Breaking Changes

  • Return context in startVitest()  -  by @antfu in #2072

   🚀 Features

   🐞 Bug Fixes

    View changes on GitHub