@semantic-matchers/vitest
v0.1.1
Published
Customize expect with class-scoped matchers for Vitest. Type-specific dispatch on the prototype chain — chainable with .not, .resolves, and .rejects, with native diffs.
Maintainers
Keywords
Readme
@semantic-matchers/vitest
Customize expect with class-scoped matchers for Vitest. Same type-specific, class-based dispatch as the Jest adapter — chainable modifiers plus native expected/received diffs.
Problem this solves
- Vitest custom matchers per class / type-specific matchers
- Expect customization for domain objects and page objects
- Chainable assertions on instances —
.not,.resolves,.rejects - Polymorphic matchers without manual type switching in
expect.extend - Richer failure output when matchers return
actual/expected(Vitest diff rendering)
Install
npm install -D @semantic-matchers/vitest vitest
# or
yarn add -D @semantic-matchers/vitest vitestSetup
import '@semantic-matchers/vitest/register-types';
import {installVitestSemanticExpect} from '@semantic-matchers/vitest';
installVitestSemanticExpect();Usage
expect(user).toHaveEmail('[email protected]');
await expect(Promise.resolve(user)).resolves.toHaveEmail('[email protected]');Docs
Full documentation and examples: github.com/dvegap95/semantic-matchers
