-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test execution continues even after lambda callback is called. #31
Comments
You have no |
It will return data implicitly either way to the caller, but as it states it will still continue the Lambda function execution until the event loop is empty, i.e. your |
@clocked0ne is correct and referenced documentation states this in the last line. Closing. |
@clocked0ne @richardhyatt if you check the lambda handler, I have added context.callbackWaitsForEmptyEventLoop = false; This will not wait for event loop to be emptied and will immediately return once callback gets called. This will not continue execution of lambda until event loop gets emptied. I am not saying that it is a lambda-tester library issue, but just want to understand the working of it. |
I think the key part here is "freeze the process soon after the callback is called, even if there are events in the event loop." - it does not guarantee a return from the callback straight away, you still have an arbitrary amount of time before the execution is finalised and the value returned to the caller, probably plenty of time to finish your function. Personally I would not set |
@clocked0ne |
my lambda handler function-
unit test function
When I run it with mocha.
Result-
You can see, it has printed both console.log statements here. If it is going in if block then callback() inside if must have got called. Ideally code execution should return from this point, but it is going further and executing 2nd console.log statement.
The text was updated successfully, but these errors were encountered: