vitest 5.x
Use Vitest ^5.0.0 standalone assertions and mock functions correctly, while avoiding APIs that require the Vitest runner and accounting for v5 migration changes.
- For
vitest@5.0.0- Verified
- 2026-09-07, 5 examples executed
- Package
@modootoday/pmcp-vitest@5.0.0
What it covers
- Requirements
- What can run in a plain script
- Assertions
- Mock functions
- Spying on an object method
- Conditional mock behavior with `vi.when`
- Mock lifecycle APIs
- APIs that require the Vitest runner
- v5 benchmarks
- Module mocking
- v5 migration traps
- Not covered
One example from this skill
This is the skill's own text, not a summary of it. It runs: that is what verifying means here.
import { expect } from 'vitest'
expect(Math.sqrt(4)).toBe(2)
expect(Math.sqrt(144)).toBe(12)
expect(Math.sqrt(0)).toBe(0)
expect(0.1 + 0.2).toBeCloseTo(0.3)
expect('vitest').toContain('test')
What it did in the sandbox
Verifying this skill meant installing the package and running code against it with no route out. Nothing was observed. The full ledger lists every package examined, including the ones that never became a skill.
Nothing observed is not a finding of safety. It means one run, under one policy, produced nothing to report.
Getting it
With a subscription:
npx -y @modootoday/pmcp login
npx -y @modootoday/pmcp install @modootoday/pmcp-vitest
It installs as a dev dependency of your project, and the MCP server finds it there like any other skill.