Next generation testing framework powered by Vite.
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Next generation testing framework powered by Vite.
Get involved!
• Vite's config, transformers, resolvers, and plugins. Use the same setup from your app!
• Jest Snapshot
• Chai built-in for assertions, with Jest expect compatible APIs
• Smart & instant watch mode, like HMR for tests!
• Native code coverage via v8 or istanbul.
• Jest-compatible mocking, stubbing, and spies.檢視完整 README ↗v8 or istanbul.Vitest requires Vite >=v6.4.0 and Node >=v22.12.0
import { assert, describe, expect, it } from 'vitest'
describe('suite name', () => {
it('foo', () => {
expect(1 + 1).toEqual(2)
expect(true).to.be.true
})
it('bar', () => {
assert.equal(Math.sqrt(4), 2)
})
it('snapshot', () => {
expect({ foo: 'bar' }).toMatchSnapshot()
})
})
$ npx vitest
Thanks to:
See Contributing Guide.
MIT License © 2021-Present VoidZero Inc. and Vitest contributors