-
Notifications
You must be signed in to change notification settings - Fork 657
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
async/await in tests #810
async/await in tests #810
Conversation
this is a great idea. i think we really should have done this work back in #690 when we dropped support for versions that couldn't run since then, we've moved to the monorepo structure and pulled in the so there's a middle road that i propose: can we move the tests for all the remaining packages to use PS. i recognize that we're living in a world where those packages are not being tested on CI against the node versions going back to v4.2.0. we should probably address that with #851. |
technically we could still use it but have a different target for those packages (ES5 or some such thing), possibly? TS would transpile down to compatible syntax otherwise don't mind reverting those particular packages |
as of now, i'm assuming the tests will continue to be JavaScript, not TypeScript (as discussed in #808 (comment)). in this case, the target isn't relevant because there's no compilation step on the tests. |
true. do both of these packages support async/await? (i.e. is the node version high enough?) webhook and web-api afaik the commit this PR is about contains only those two packages already anyway (just on top of my huge other PR, but could be separated) |
oh yeah! both |
Codecov Report
@@ Coverage Diff @@
## master #810 +/- ##
=======================================
Coverage 95.62% 95.62%
=======================================
Files 12 12
Lines 686 686
Branches 147 147
=======================================
Hits 656 656
Misses 11 11
Partials 19 19
Continue to review full report at Codecov.
|
rebased and dropped the typescript. build doesn't seem to have started but tests did pass locally |
@aoberoi so i've updated to assert for non-assertionerror errors. it still doesn't seem ideal but its simpler than adding complexity or new dependencies to have an async |
This cleans up tests a little on top of #808.
I noticed quite a few, if they failed, threw uncaught promises rather than ever reaching mocha so the errors weren't so useful.
Changing the async tests to use async/await instead of the
done
callback means uncaught promise exceptions will be handled by mocha. Makes it a bit cleaner to read too.if you want to have a look at the diff, view the last commit by its self