Skip to content

Maintenance: Replace aws-sdk-client-mock-vitest with an internal matcher #5692

Description

@svozza

Summary

Replace aws-sdk-client-mock-vitest with a locally maintained toReceiveCommandWith matcher in our existing testing utilities. This is the only matcher we register from the dependency, used by 40 assertions across seven test files.

Keep aws-sdk-client-mock for SDK mocking and preserve existing assertion syntax.

Why is this needed?

The dependency blocks the Vitest 5 upgrade in #5655. Its dependency on @vitest/expect@^4.1.0 produces incompatible matcher types with Vitest 5’s bundled expect types, as described in this comment.

Owning this small matcher would remove that compatibility dependency and fit our existing custom matcher infrastructure.

Which area does this relate to?

Tests

Solution

  • Implement toReceiveCommandWith using client.commandCalls() and Vitest’s expect.objectContaining.
  • Preserve partial matching, asymmetric matchers, .not, useful failure diagnostics, and command-aware TypeScript types.
  • Add tests for matching and mismatching inputs, no calls, multiple calls, different command types, negation, and asymmetric matchers.
  • Replace the imported CustomMatcher declarations and remove the dependency.
  • Remove the unused documentation snippet import and update the related recommendation.
  • Coordinate the separate Assertion augmentation fix with the Vitest 5 upgrade.
  • Verify matcher coverage, existing Parameters and Idempotency tests, and source/test/snippet type checks.

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

pending-releaseThis item has been merged and will be released soon

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions