Skip to content

printer() in custom serializer triggers out of memory error with any value #5751

Answered by hi-ogawa
gterras asked this question in Q&A
Discussion options

You must be logged in to vote

Now what I understand is that there is no way to override the serializer for a single expect within a test? IE:

it('should pass',  ({expect}) => {
expect(table).toMatchSnapshot() // custom serializer
expect(object).toMatchSnapshot() // default serializer 
})

Something like expect(table, custom_serializer).toMatchSnapshot(), or a way to call default implementation from the custom serializer in some cases?

In the end all I need is a simple way to override the outputted value on demand for any given expect.

For this need, introducing a simple wrapper might help, something like this:
https://stackblitz.com/edit/vitest-dev-vitest-w9sfer?file=test%2Frepro.test.ts

import { test, expect } from '…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@gterras
Comment options

@hi-ogawa
Comment options

@gterras
Comment options

@hi-ogawa
Comment options

Answer selected by gterras
@gterras
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