Constimport test from 'node:test';
import { expect } from 'bupkis';
test('redacts sensitive fields', (t) => {
const data = { username: 'alice', password: 'secret123' };
expect(data, 'to match snapshot', t, 'with options', {
serializer: (value: any) =>
JSON.stringify({ ...value, password: '[REDACTED]' }, null, 2),
});
});
test('workflow stages', (t) => {
const stage1 = { phase: 'init' };
expect(stage1, 'to match snapshot', t, 'with options', {
hint: 'stage-1',
});
const stage2 = { phase: 'processing' };
expect(stage2, 'to match snapshot', t, 'with options', {
hint: 'stage-2',
});
});
Asserts that a value matches a stored snapshot with custom options.
This is an extended version of snapshotAssertion that accepts explicit options for serialization and snapshot naming via the
with optionssyntax.