Skip to content

Commit

Permalink
fix: remove extraneous callbackWaitsForEmptyEventLoop line (#90)
Browse files Browse the repository at this point in the history
`callbackWaitsForEmptyEventLoop` is only needed for non-async functions (i.e. functions that use callbacks) and therefore can be safely removed from this package.

See #78 (comment) for more details
  • Loading branch information
ajschmidt8 committed Mar 9, 2022
1 parent c8472ff commit 34e7abc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
3 changes: 0 additions & 3 deletions lambda-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ const lowercaseKeys = require("lowercase-keys");

async function lambdaFunction(probot, event, context) {
try {
// Ends function immediately after callback
context.callbackWaitsForEmptyEventLoop = false;

// lowercase all headers to respect headers insensitivity (RFC 7230 $3.2 'Header Fields', see issue #62)
const headersLowerCase = lowercaseKeys(event.headers);

Expand Down
16 changes: 0 additions & 16 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ describe("@probot/adapter-aws-lambda-serverless", () => {

await fn(event, context);

expect(context).toStrictEqual({
callbackWaitsForEmptyEventLoop: false,
});

expect(mock.activeMocks()).toStrictEqual([]);
});

Expand Down Expand Up @@ -88,10 +84,6 @@ describe("@probot/adapter-aws-lambda-serverless", () => {

await fn(event, context);

expect(context).toStrictEqual({
callbackWaitsForEmptyEventLoop: false,
});

expect(mock.activeMocks()).toStrictEqual([]);
});

Expand Down Expand Up @@ -125,10 +117,6 @@ describe("@probot/adapter-aws-lambda-serverless", () => {

await fn(event, context);

expect(context).toStrictEqual({
callbackWaitsForEmptyEventLoop: false,
});

expect(mock.activeMocks()).toStrictEqual([]);
});

Expand Down Expand Up @@ -162,10 +150,6 @@ describe("@probot/adapter-aws-lambda-serverless", () => {

await fn(event, context);

expect(context).toStrictEqual({
callbackWaitsForEmptyEventLoop: false,
});

expect(mock.activeMocks()).toStrictEqual([]);
});
});

0 comments on commit 34e7abc

Please sign in to comment.