test, it & describe in Vitest
From the Vitest cheat sheet · Test Structure · verified Nov 2026
test, it & describe
Define tests, group them in suites, and set per-test options
typescript
import { describe, expect, it, test } from 'vitest'
describe('Cart', () => {
test('starts empty', () => {
expect(new Cart().items).toEqual([])
})
it('adds items', () => { /* it is an alias of test */ })
})🟢 it and test are identical; describe groups related tests
📌 Default timeout is 5s (testTimeout); hooks get 10s (hookTimeout)
⚠️ Options go 2nd; a trailing timeout can't be combined with options
💡 Reporters show nested names like Cart > add() > adds a new item
testdescribeit
Continue with Vitest
Save the full cheat sheet or work through every related task.