| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2ee9a96 commit e3d7955
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -281,6 +281,32 @@ assert.throws( | |||
| 281 | 281 | ); | |
| 282 | 282 | ``` | |
| 283 | 283 | ||
| 284 | + ### Console output | ||
| 285 | + | ||
| 286 | + Output written by tests to stdout or stderr, such as with `console.log()` or | ||
| 287 | + `console.error()`, can be useful when writing tests, as well as for debugging | ||
| 288 | + them during later maintenance. The output will be supressed by the test runner | ||
| 289 | + (`./tools/test.py`) unless the test fails, but will always be displayed when | ||
| 290 | + running tests directly with `node`. For failing tests, the test runner will | ||
| 291 | + include the output along with the failed test assertion in the test report. | ||
| 292 | + | ||
| 293 | + Some output can help debugging by giving context to test failures. For example, | ||
| 294 | + when troubleshooting tests that timeout in CI. With no log statements, we have | ||
| 295 | + no idea where the test got hung up. There have been cases where tests fail | ||
| 296 | + without `console.log()`, and then pass when its added, so be cautious about its | ||
| 297 | + use, particularly in tests of the I/O and streaming APIs. | ||
| 298 | + | ||
| 299 | + Excessive use of console output is discouraged as it can overwhelm the display, | ||
| 300 | + including the Jenkins console and test report displays. Be particularly | ||
| 301 | + cautious of output in loops, or other contexts where output may be repeated many | ||
| 302 | + times in the case of failure. | ||
| 303 | + | ||
| 304 | + In some tests, it can be unclear whether a `console.log()` statement is required | ||
| 305 | + as part of the test (message tests, tests that check output from child | ||
| 306 | + processes, etc.), or is there as a debug aide. If there is any chance of | ||
| 307 | + confusion, use comments to make the purpose clear. | ||
| 308 | + | ||
| 309 | + | ||
| 284 | 310 | ### ES.Next features | |
| 285 | 311 | ||
| 286 | 312 | For performance considerations, we only use a selected subset of ES.Next | |
| Back | FazBrowse Home | New Git URL |
0 commit comments