lambda-tester
lambda-tester copied to clipboard
Support for callbackWaitsForEmptyEventLoop = false
Hello,
We're running into issues with our following lambda:
module.exports.handle = (event, lambdaContext, callback) => {
lambdaContext.callbackWaitsForEmptyEventLoop = false;
/* lambda body */
};
We're trying to test it like so:
it('should return a 500 response if there is an HTTP error', (done) => {
LambdaTester(handle)
.event(defaultEvent)
.expectResult((result) => {
/ * validations */
})
.verify(done);
});
But we're getting the following error:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
I saw in this issue that using callbackWaitsForEmptyEventLoop = false is no supported, but we have use case for it (we have a constant that polls a configuration every 10 seconds so the user invocation does not have to wait for that) and would like to see if there's another way we can run the test. Is there some option for us to use lambda-tester with this code?
Thanks in advance!