How to Mock AWS SDK v3 in Vitest Without Extra Dependencies

You're writing your tests, your AI agent is crushing it, all use cases and edge ones are being covered, but you've installed an AWS SDK and now you'll need to mock it (oh boy). After a few hours in, and a few years of life out the window, you notice that nothing you do can actually mock the cretin and you begin to lose hope, but after doing some research you soon notice that you'll need another dependency just for that: aws-sdk-client-mock. It surely gives you a convenient way to mock the clients, but it also makes them require special treatment, since it enforces a specific way of mocking. The good thing is, it does not need to be like this. The traditional way The usual approach with this
…