| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7dfa475 commit fa13ed6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -162,6 +162,37 @@ test('skip() method with message', (t) => { | |||
| 162 | 162 | }); | |
| 163 | 163 | ``` | |
| 164 | 164 | ||
| 165 | + ## TODO tests | ||
| 166 | + | ||
| 167 | + Individual tests can be marked as flaky or incomplete by passing the `todo` | ||
| 168 | + option to the test, or by calling the test context's `todo()` method, as shown | ||
| 169 | + in the following example. These tests represent a pending implementation or bug | ||
| 170 | + that needs to be fixed. TODO tests are executed, but are not treated as test | ||
| 171 | + failures, and therefore do not affect the process exit code. If a test is marked | ||
| 172 | + as both TODO and skipped, the TODO option is ignored. | ||
| 173 | + | ||
| 174 | + ```js | ||
| 175 | + // The todo option is used, but no message is provided. | ||
| 176 | + test('todo option', { todo: true }, (t) => { | ||
| 177 | + // This code is executed, but not treated as a failure. | ||
| 178 | + throw new Error('this does not fail the test'); | ||
| 179 | + }); | ||
| 180 | + | ||
| 181 | + // The todo option is used, and a message is provided. | ||
| 182 | + test('todo option with message', { todo: 'this is a todo test' }, (t) => { | ||
| 183 | + // This code is executed. | ||
| 184 | + }); | ||
| 185 | + | ||
| 186 | + test('todo() method', (t) => { | ||
| 187 | + t.todo(); | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + test('todo() method with message', (t) => { | ||
| 191 | + t.todo('this is a todo test and is not treated as a failure'); | ||
| 192 | + throw new Error('this does not fail the test'); | ||
| 193 | + }); | ||
| 194 | + ``` | ||
| 195 | + | ||
| 165 | 196 | ## `describe()` and `it()` aliases | |
| 166 | 197 | ||
| 167 | 198 | Suites and tests can also be written using the `describe()` and `it()` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments