Skip to content

Commit 1fdc1a3

Browse files
committed
Docs: Mention "flaky" and "incomplete" in test.skip() and test.todo()
Improve discovery by adding likely search terms to the description of these methods. Ref #637. Ref #1080. Ref #1815.
1 parent 84948ce commit 1fdc1a3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/api/QUnit/test.skip.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ version_added: "1.16.0"
1616
`QUnit.skip( name )`<br/>
1717
`QUnit.skip( name, callback )`
1818

19-
Define a test that will be skipped during the run.
19+
Define a test that will be skipped. Use this to disable a known broken or "flaky" test case.
2020

2121
| parameter | description |
2222
|-----------|-------------|
2323
| `name` (string) | Title of unit |
2424
| `callback` (function) | Optional, function that would perform the test |
2525

26-
Use this method to disable a [`QUnit.test()`](./test.md), as alternative to commenting out the test.
26+
The callback and any module hooks do not run for a skipped test. The name of your test will be included in results as a "skipped" test. This serves as a reminder to contributors. This is often preferred over the alternative of commenting out a test, because the code in the test will remain discoverable through static analysis and code search, and encourages inclusion during refactors and IDE automation.
2727

28-
This test will be listed in the results as a "skipped" test. The callback and the respective module's hooks will not run.
29-
30-
As a codebase becomes bigger, you may sometimes want to temporarily disable an entire group of tests at once. You can use [`QUnit.module.skip()`](./module.md) to recursively skip all tests in the same module.
28+
In larger codebases, you may need to temporarily disable a group of tests at once. You can use [`QUnit.module.skip()`](./module.md) to recursively skip all tests in a module.
3129

3230
## See also
3331

docs/api/QUnit/test.todo.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ version_added: "2.2.0"
1414
`QUnit.test.todo( name, callback )`<br>
1515
`QUnit.todo( name, callback )`
1616

17-
Define a test that is not yet expected to pass, because the test has one or more failing assertions or throws an exception.
17+
Define a test that is not yet expected to pass. Use this for tests of unfinished code.
1818

1919
| parameter | description |
2020
|-----------|-------------|
@@ -27,11 +27,13 @@ Define a test that is not yet expected to pass, because the test has one or more
2727
|-----------|-------------|
2828
| `assert` (object) | A new instance object with the [assertion methods](../assert/index.md) |
2929

30-
Use this method to test a unit of code that is still under development (in a "todo" state). The "todo" test will pass as long as there is at least one assertion still failing, or if an exception is thrown.
30+
In [test-driven development](https://en.wikipedia.org/wiki/Test-driven_development), you can specify how code should work with tests, and then work towards making these tests pass. When collaborating in a larger project, you can share tests for unfinished features as "todo" tests so that CI passes while your feature is under development. You can also use this method to disable a known broken test, where the code may be working but the test is incomplete.
3131

32-
When all assertions are passing, the "todo" test will fail, thus signaling that `QUnit.test.todo()` should be changed to [`QUnit.test()`](./test.md).
32+
"Todo" tests will pass as long as there is at least one assertion still failing, or if an exception is thrown.
3333

34-
You can also use [`QUnit.module.todo()`](./module.md) to manage the "todo" state for all tests within a module at once.
34+
Once all assertions are passing, the "todo" test will fail, thus reminding you that `QUnit.test.todo()` should be changed to [`QUnit.test()`](./test.md). If a test should be skipped unconditionally, use [`QUnit.test.skip()`](./test.skip.md) instead.
35+
36+
You can use [`QUnit.module.todo()`](./module.md) to manage the "todo" state for all tests within a module at once.
3537

3638
## Changelog
3739

0 commit comments

Comments
 (0)