Skip to content

Make sure to call done() in a async test #43

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

Merged
merged 1 commit into from
Nov 20, 2018

Conversation

koddsson
Copy link
Contributor

Since done isn't called in the example test we never reach the callback where we do the expect assertion causing the tests to pass even when they shouldn't since the test suite doesn't know that we need to wait for the callback to called.

By taking the done callback in as argument in the test function we signal to the test suite that this test should fail is done() isn't called.

See https://jestjs.io/docs/en/asynchronous.html for further reading.

Copy link
Contributor

@hiimbex hiimbex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @koddsson!

@hiimbex hiimbex merged commit 36c1895 into probot:master Nov 20, 2018
@koddsson koddsson deleted the call-done-in-async-test branch November 20, 2018 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants