Skip to content

Support for callbackWaitsForEmptyEventLoop = false #72

@lingolex

Description

@lingolex

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions