BUPKIS
    Preparing search index...

    Variable snapshotAssertionConst

    snapshotAssertion: AssertionFunctionSync<
        readonly [
            ZodUnknown,
            readonly [
                "to match snapshot",
                "to match the snapshot",
                "to equal snapshot",
                "to equal the snapshot",
            ],
            ZodNonOptional<ZodUnknown>,
        ],
        (actual: unknown, context: unknown) => void | AssertionFailure,
        readonly [
            ZodUnknown,
            PhraseLiteralChoiceSlot<
                readonly [
                    "to match snapshot",
                    "to match the snapshot",
                    "to equal snapshot",
                    "to equal the snapshot",
                ],
            >,
            ZodNonOptional<ZodUnknown>,
        ],
    > = ...

    Asserts that a value matches a stored snapshot.

    This assertion provides unified snapshot testing across multiple test frameworks. It automatically detects the test framework from the context parameter and uses the appropriate snapshot mechanism.

    Supported Frameworks:

    • node:test: Native assert.snapshot() support
    • Jest/Vitest: Coming in Phase 2
    • Mocha: Custom snapshot storage
    • Any framework: Use explicit string names

    Basic Usage:

    import test from 'node:test';
    import { expect } from 'bupkis';

    test('component renders correctly', (t) => {
    const output = renderComponent();
    expect(output, 'to match snapshot', t);
    });

    With Custom Serializer:

    test('redacts sensitive data', (t) => {
    const data = { public: 'visible', secret: 'password123' };
    expect(data, 'to match snapshot', t, {
    serializer: (value: any) =>
    JSON.stringify({ ...value, secret: '[REDACTED]' }, null, 2),
    });
    });

    Multiple Snapshots Per Test:

    test('multi-step process', (t) => {
    const step1 = processStep1();
    expect(step1, 'to match snapshot', t, { hint: 'step-1' });

    const step2 = processStep2();
    expect(step2, 'to match snapshot', t, { hint: 'step-2' });

    const step3 = processStep3();
    expect(step3, 'to match snapshot', t, { hint: 'step-3' });
    });

    Mocha Usage:

    describe('MyComponent', function () {
    it('renders correctly', function () {
    const output = renderComponent();
    expect(output, 'to match snapshot', this);
    });
    });

    Explicit Snapshot Names:

    test('any framework', () => {
    const output = renderComponent();
    expect(output, 'to match snapshot', 'component-default-state');
    });

    Chaining with Other Assertions:

    test('validates and snapshots', (t) => {
    const user = getUserData();
    expect(
    user,
    'to satisfy',
    { name: 'Alice' },
    'and',
    'to have property',
    'email',
    'and',
    'to match snapshot',
    t,
    );
    });

    Updating Snapshots:

    # node:test
    node --test --test-update-snapshots

    # Jest/Vitest (Phase 2)
    vitest -u

    # Other frameworks
    BUPKIS_UPDATE_SNAPSHOTS=1 npm test
    import test from 'node:test';
    import { expect } from 'bupkis';

    test('renders user profile', (t) => {
    const profile = { name: 'Alice', age: 30, role: 'admin' };
    expect(profile, 'to match snapshot', t);
    });
    test('redacts passwords', (t) => {
    const user = {
    username: 'alice',
    password: 'secret123',
    email: 'alice@example.com',
    };

    expect(user, 'to match snapshot', t, {
    serializer: (value: any) => {
    return JSON.stringify(
    {
    ...value,
    password: '[REDACTED]',
    },
    null,
    2,
    );
    },
    });
    });
    test('captures workflow steps', (t) => {
    const initial = { status: 'pending' };
    expect(initial, 'to match snapshot', t, { hint: 'initial-state' });

    const processing = { status: 'processing', progress: 50 };
    expect(processing, 'to match snapshot', t, {
    hint: 'processing-state',
    });

    const complete = { status: 'complete', result: 'success' };
    expect(complete, 'to match snapshot', t, { hint: 'complete-state' });
    });

    The value to snapshot (any type)

    Test context object or explicit snapshot name

    Optional serialization and naming options

    unknown-to-match-snapshot

    snapshot