Skip to content
Discussion options

You must be logged in to vote

The abstraction of @vitest/snapshot is different from jest-snapshot as it's internally implemented as chai method:

for (const key of ['matchSnapshot', 'toMatchSnapshot']) {
utils.addMethod(
chai.Assertion.prototype,
key,
function (
this: Record<string, unknown>,
properties?: object,
message?: string,

It looks like technically you can customize it like this https://stackblitz.com/edit/vitest-dev-vitest-3sb8oxer?file=test%2Frepro.test.ts

import { expect, test, chai } from 'vitest';

test('foo', () => {
  chai.util.addMethod(
    chai.Assertion.prototype,
    

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Smrtnyk
Comment options

You must be logged in to vote
3 replies
@hi-ogawa
Comment options

@Smrtnyk
Comment options

@Smrtnyk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants