vandium-io / lambda-tester

Helper for unit testing AWS Lambda functions
BSD 3-Clause "New" or "Revised" License
272 stars 51 forks source link

Support verification of responses and errors from Node 8 async handlers using return/throw #44

Closed HajoAhoMantila closed 6 years ago

HajoAhoMantila commented 6 years ago

When implementing a lambda in JavaScript with Node 8, the handler can be implemented as an async function. One can then simply return a response (which is passed back to the client when doing RequestResponse-type invocation) or use throw to return an error (see https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html).

lambda-tester currently supports verification of responses and errors when they were returned by calling callback(error, response), but not when a return or throw was used. It would be nice to have support for this, too.

HajoAhoMantila commented 6 years ago

I just saw that https://github.com/vandium-io/lambda-tester/pull/41 already addresses this issue - nice! So this can be closed once it's merged.

HajoAhoMantila commented 6 years ago

Closed by #41, we're already using it. Thanks!