Alternative to AWS Mock

I don’t think you need AWS Mock to test your Lambdas.

If you think you need it, it’s because you’re using global variables, or state, should be using dependency injection via stubs instead.

This image from docs shows it overrides a global module import, then has to restore the global after the test has run. I get some people need/like before/after, but that is state-full, leads to tiring test setup, & accidental non-determinism in tests.

Lambda’s are stateless.

Instead, use pure functions + dependency inject your stubs (e.g. parameter to function). Also note, no need for Sinon or some other test double library. JavaScript is so good nowadays to easily make objects/classes/functions or any combination thereof on the fly that are terse.