Dear devs,

Assuming the landing of patches in 
https://bugzilla.mozilla.org/show_bug.cgi?id=1380470 
<https://bugzilla.mozilla.org/show_bug.cgi?id=1380470> sticks, you all can 
enjoy the following from tomorrow onwards:

Paraphrased from the bug’s description:
You can now use `add_task(async function someTest() {}).skip()` and 
`add_task(async function someTest() {}).only()`, for Mochitest-chrome, 
Mochitest-browser and XPCShell tests, with the following semantics:

* `.skip()` makes sure that the task in question is not run as part of the 
suite. This will be made very clear in the log output as well.
* `.only()` makes sure that only the task in question is run, thus all the 
other tasks in that suite will be skipped. If `.only()` is called multiple 
times, it will run the last one on the stack, IOW: the last task on which 
`.only()` was called.

The motivation behind this feature is to promote Test Driven Development (TDD) 
and intermittent failure research work by allowing more granular control of 
what test gets run during your debugging process.
In large, growing test suites it's more likely that you'll be wishing to skip a 
certain test case because it takes a long time or has nothing to do with the 
failure case or rather to check if it pollutes the behavior of other tests.
In large, growing suites, it's also more likely that you'll be wishing for a 
convenient way to focus on a single test case, instead of the suite as whole. 
Example: extended feature development.

IMPORTANT: this change effectively deprecated XPCShell’s 
`add_test.skip(function test() {})`, `add_test.only(function test() {})`, 
`add_task.skip(async function test() {})` and `add_task.only(async function 
test() {})` in favor of the API mentioned above. This allowed for a 
substantially simpler implementation.

Thanks Standard8 (Mark Banner) for the idea and ahal (Andrew Halberstadt) for 
the reviews!

Enjoy and have fun,

Mike.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to