@supersigil/vitest
v0.14.0
Published
Vitest helper for annotating tests with Supersigil criterion refs
Maintainers
Readme
@supersigil/vitest
Vitest helper for annotating tests with Supersigil criterion refs.
Installation
npm install -D @supersigil/vitestUsage
Use the verifies() function to link test cases to specification criteria:
import { verifies } from '@supersigil/vitest'
it('rejects invalid email', verifies('auth/req#req-1-1'), () => {
expect(validateEmail('bad')).toBe(false)
})Multiple criteria can be referenced:
it('sends welcome email', verifies('auth/req#req-2-1', 'notifications/req#req-1-1'), () => {
// ...
})The returned object can be spread into other test options:
it('completes within timeout', { ...verifies('perf/req#req-1-1'), timeout: 5000 }, () => {
// ...
})How it works
verifies() returns a Vitest-compatible metadata object ({ meta: { verifies: [...] } }) that Supersigil reads during verification to trace test coverage back to specification criteria.
License
MIT OR Apache-2.0
