BUPKIS
    Preparing search index...

    Variable SnapshotAssertionsConst

    SnapshotAssertions: {
        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>,
            ],
        >;
        snapshotAssertionWithOptions: AssertionFunctionSync<
            readonly [
                ZodUnknown,
                readonly [
                    "to match snapshot",
                    "to match the snapshot",
                    "to equal snapshot",
                    "to equal the snapshot",
                ],
                ZodNonOptional<ZodUnknown>,
                "with options",
                ZodObject<
                    { hint: ZodOptional<ZodString>; serializer: ZodOptional<ZodAny> },
                    $strip,
                >,
            ],
            (
                actual: unknown,
                context: unknown,
                options: { hint?: string; serializer?: any },
            ) => void | AssertionFailure,
            readonly [
                ZodUnknown,
                PhraseLiteralChoiceSlot<
                    readonly [
                        "to match snapshot",
                        "to match the snapshot",
                        "to equal snapshot",
                        "to equal the snapshot",
                    ],
                >,
                ZodNonOptional<ZodUnknown>,
                PhraseLiteralSlot<"with options">,
                ZodObject<
                    { hint: ZodOptional<ZodString>; serializer: ZodOptional<ZodAny> },
                    $strip,
                >,
            ],
        >;
    } = ...

    Collection of all snapshot assertions.

    Currently contains only the main snapshot assertion, but structured as a collection for consistency with other assertion modules and to allow for future expansion (e.g., inline snapshots, property matchers).

    Type Declaration

    • 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

    • snapshotAssertionWithOptions: AssertionFunctionSync<
          readonly [
              ZodUnknown,
              readonly [
                  "to match snapshot",
                  "to match the snapshot",
                  "to equal snapshot",
                  "to equal the snapshot",
              ],
              ZodNonOptional<ZodUnknown>,
              "with options",
              ZodObject<
                  { hint: ZodOptional<ZodString>; serializer: ZodOptional<ZodAny> },
                  $strip,
              >,
          ],
          (
              actual: unknown,
              context: unknown,
              options: { hint?: string; serializer?: any },
          ) => void | AssertionFailure,
          readonly [
              ZodUnknown,
              PhraseLiteralChoiceSlot<
                  readonly [
                      "to match snapshot",
                      "to match the snapshot",
                      "to equal snapshot",
                      "to equal the snapshot",
                  ],
              >,
              ZodNonOptional<ZodUnknown>,
              PhraseLiteralSlot<"with options">,
              ZodObject<
                  { hint: ZodOptional<ZodString>; serializer: ZodOptional<ZodAny> },
                  $strip,
              >,
          ],
      >

      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 options syntax.

      import 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',
      });
      });

      The value to snapshot (any type)

      Test context object or explicit snapshot name

      Serialization and naming options

      unknown-to-match-snapshot-with-options

      snapshot

    import { SnapshotAssertions } from 'bupkis/assertions';

    // All snapshot assertions are available
    const { snapshotAssertion } = SnapshotAssertions;