yarn vitest 0.25.0
v0.25.0

latest releases: 2.1.4, 2.1.3, 2.1.2...
2 years ago

   ✅ 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).toBeFunction()
  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

Don't miss a new vitest release

NewReleases is sending notifications on new releases.