@@ -3454,6 +3454,45 @@ object, streaming a series of events representing the execution of the tests.
34543454Some of the events are guaranteed to be emitted in the same order as the tests
34553455are defined, while others are emitted in the order that the tests execute.
34563456
3457+ The following tables summarize all events by scope.
3458+
3459+ Test scoped events are emitted once per test or suite. Most of them come in
3460+ pairs: a declaration ordered event, buffered so that events are emitted in the
3461+ same order as the tests are defined, and one or more corresponding execution
3462+ ordered events, emitted immediately as the tests execute.
3463+
3464+ | Declaration ordered (buffered) | Execution ordered (immediate) |
3465+ | ------------------------------ | ----------------------------------------------------- |
3466+ | [ ` 'test:start' ` ] [ ] | [ ` 'test:enqueue' ` ] [ ] followed by [ ` 'test:dequeue' ` ] [ ] |
3467+ | [ ` 'test:pass' ` ] [ ] | [ ` 'test:complete' ` ] [ ] (` details.passed ` is ` true ` ) |
3468+ | [ ` 'test:fail' ` ] [ ] | [ ` 'test:complete' ` ] [ ] (` details.passed ` is ` false ` ) |
3469+ | [ ` 'test:plan' ` ] [ ] | |
3470+ | [ ` 'test:diagnostic' ` ] [ ] | |
3471+
3472+ File scoped and global events are always emitted immediately, in execution
3473+ order.
3474+
3475+ File scoped events are emitted once per test file:
3476+
3477+ | Event | Notes |
3478+ | -------------------- | ---------------------------------------------- |
3479+ | [ ` 'test:stderr' ` ] [ ] | Only emitted if the ` --test ` flag is passed. |
3480+ | [ ` 'test:stdout' ` ] [ ] | Only emitted if the ` --test ` flag is passed. |
3481+ | [ ` 'test:summary' ` ] [ ] | Per file, only when process isolation is used. |
3482+
3483+ Global events are emitted once per test run:
3484+
3485+ | Event | Notes |
3486+ | ---------------------------- | ------------------------------------ |
3487+ | [ ` 'test:summary' ` ] [ ] | The final cumulative summary. |
3488+ | [ ` 'test:coverage' ` ] [ ] | Only when code coverage is enabled. |
3489+ | [ ` 'test:interrupted' ` ] [ ] | Only when the run receives ` SIGINT ` . |
3490+ | [ ` 'test:watch:drained' ` ] [ ] | Watch mode only. |
3491+ | [ ` 'test:watch:restarted' ` ] [ ] | Watch mode only. |
3492+
3493+ The root test also emits [ ` 'test:plan' ` ] [ ] and [ ` 'test:diagnostic' ` ] [ ] events
3494+ at the end of the run to report run level totals.
3495+
34573496### Event: ` 'test:coverage' `
34583497
34593498* ` data ` {Object}
@@ -4702,6 +4741,21 @@ test.describe('my suite', (suite) => {
47024741
47034742[ TAP ] : https://testanything.org/
47044743[ Test tags ] : #test-tags
4744+ [ `'test:complete'` ] : #event-testcomplete
4745+ [ `'test:coverage'` ] : #event-testcoverage
4746+ [ `'test:dequeue'` ] : #event-testdequeue
4747+ [ `'test:diagnostic'` ] : #event-testdiagnostic
4748+ [ `'test:enqueue'` ] : #event-testenqueue
4749+ [ `'test:fail'` ] : #event-testfail
4750+ [ `'test:interrupted'` ] : #event-testinterrupted
4751+ [ `'test:pass'` ] : #event-testpass
4752+ [ `'test:plan'` ] : #event-testplan
4753+ [ `'test:start'` ] : #event-teststart
4754+ [ `'test:stderr'` ] : #event-teststderr
4755+ [ `'test:stdout'` ] : #event-teststdout
4756+ [ `'test:summary'` ] : #event-testsummary
4757+ [ `'test:watch:drained'` ] : #event-testwatchdrained
4758+ [ `'test:watch:restarted'` ] : #event-testwatchrestarted
47054759[ `--experimental-test-coverage` ] : cli.md#--experimental-test-coverage
47064760[ `--experimental-test-module-mocks` ] : cli.md#--experimental-test-module-mocks
47074761[ `--experimental-test-tag-filter` ] : cli.md#--experimental-test-tag-filtertag
0 commit comments