You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the API to register a cleanup routine for a test is tangled with the use of callback-style tests (done()). That's because onCleanup is passed as the second argument to each test, and this check forbids the test to both return a promise and receive any arguments.
It would be very useful to be able to register a cleanup routine and use the promise API, especially with hapi now embracing async/await.
I do not know the ideal API for this, but here's something to get started with.
Another option is to loosen the restriction, and only complain if done() is actually called in a test that returns a promise. Then it could be ignored as the first argument, and onCleanup could still be utilized.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
breaking changesChange that can breaking existing codefeatureNew functionality or improvement
Currently the API to register a cleanup routine for a test is tangled with the use of callback-style tests (
done()
). That's becauseonCleanup
is passed as the second argument to each test, and this check forbids the test to both return a promise and receive any arguments.It would be very useful to be able to register a cleanup routine and use the promise API, especially with hapi now embracing async/await.
I do not know the ideal API for this, but here's something to get started with.
Another option is to loosen the restriction, and only complain if
done()
is actually called in a test that returns a promise. Then it could be ignored as the first argument, andonCleanup
could still be utilized.The text was updated successfully, but these errors were encountered: