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.
Summary
Replace
aws-sdk-client-mock-vitestwith a locally maintainedtoReceiveCommandWithmatcher 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-mockfor 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.0produces 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
toReceiveCommandWithusingclient.commandCalls()and Vitest’sexpect.objectContaining..not, useful failure diagnostics, and command-aware TypeScript types.CustomMatcherdeclarations and remove the dependency.Assertionaugmentation fix with the Vitest 5 upgrade.Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.