-
Notifications
You must be signed in to change notification settings - Fork 167
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
Testing library to remove dependency on mocha #554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- do we need to add some code here to pay attention to bazel timeout rules?
- is any of this output conforming to some bazel format, or no? if so, can you document it?
Co-Authored-By: BenBirt <benjamin.birt@gmail.com>
Co-Authored-By: BenBirt <benjamin.birt@gmail.com>
Co-Authored-By: BenBirt <benjamin.birt@gmail.com>
Co-Authored-By: BenBirt <benjamin.birt@gmail.com>
timeouts - i only took a quick scan, but IMO your runner should be obeying the various parameters in https://docs.bazel.build/versions/master/test-encyclopedia.html, including timeouts. |
As discussed, reading that page I don't think the test code is supposed to do anything with these flags. Bazel will kill processes and tests if they time out itself. |
As discussed, re-allowing calling of top level suite/test methods inside tests, as this was IMO more annoying than it was worth after trying to migrate tests. |
* Core cesting libs * Update testing/hook.ts Co-Authored-By: BenBirt <benjamin.birt@gmail.com> * Update testing/hook.ts Co-Authored-By: BenBirt <benjamin.birt@gmail.com> * Update testing/runner.ts Co-Authored-By: BenBirt <benjamin.birt@gmail.com> * Update testing/test.ts Co-Authored-By: BenBirt <benjamin.birt@gmail.com> * Review comments * Review comment * Allow calling top level suite/test methods Co-authored-by: BenBirt <benjamin.birt@gmail.com>
Mocha causes us a few issues, as it needs to be run through the CLI, we have complex bazel rules to deal with this. It has annoyingly globally scoped types and does a lot more than we need it to.
This PR introduces a simple testing library that can be used without a CLI, where each test is simply considered a binary with a exit set according to whether it passes or not. It also adds rules
ts_test
andts_test_suite
for making writing bazel rules easier.The library itself is otherwise very similar to
mocha
, without the globals, CLI, and slightly more strict usage patterns.Features:
In the future, we should I think be able to use
bazel
for coverage metrics without any additional effort with this set up after this work is finished: bazel-contrib/rules_nodejs#1135