Skip, Only, Todo & Conditional Tests in Vitest
From the Vitest cheat sheet · Test Structure · verified Nov 2026
Skip, Only, Todo & Conditional Tests
Focus, skip, stub, or conditionally run tests and suites
typescript
test.only('runs alone in this file', () => {})
test.skip('temporarily disabled', () => {})
test.todo('write this later')
test.fails('known bug #123', () => { expect(add(1, 2)).toBe(4) })
test.skipIf(process.platform === 'win32')('posix only', () => {})
test.runIf(process.env.CI)('CI only', () => {})⚠️ .only throws in CI by default so focused tests can't be merged
💡 skip(condition, note) skips from inside the test at runtime
📌 test.fails flips the result: it passes while the code is broken
🟢 todo tests show up in the summary as a reminder
onlyskiptodoskipIf
Continue with Vitest
Save the full cheat sheet or work through every related task.