@@ -3462,6 +3462,45 @@ object, streaming a series of events representing the execution of the tests.
34623462Some of the events are guaranteed to be emitted in the same order as the tests
34633463are defined, while others are emitted in the order that the tests execute.
34643464
3465+ The following tables summarize all events by scope.
3466+
3467+ Test scoped events are emitted once per test or suite. Most of them come in
3468+ pairs: a declaration ordered event, buffered so that events are emitted in the
3469+ same order as the tests are defined, and one or more corresponding execution
3470+ ordered events, emitted immediately as the tests execute.
3471+
3472+ | Declaration ordered (buffered) | Execution ordered (immediate) |
3473+ | ------------------------------ | ----------------------------------------------------- |
3474+ | [ ` 'test:start' ` ] [ ] | [ ` 'test:enqueue' ` ] [ ] followed by [ ` 'test:dequeue' ` ] [ ] |
3475+ | [ ` 'test:pass' ` ] [ ] | [ ` 'test:complete' ` ] [ ] (` details.passed ` is ` true ` ) |
3476+ | [ ` 'test:fail' ` ] [ ] | [ ` 'test:complete' ` ] [ ] (` details.passed ` is ` false ` ) |
3477+ | [ ` 'test:plan' ` ] [ ] | |
3478+ | [ ` 'test:diagnostic' ` ] [ ] | |
3479+
3480+ File scoped and global events are always emitted immediately, in execution
3481+ order.
3482+
3483+ File scoped events are emitted once per test file:
3484+
3485+ | Event | Notes |
3486+ | -------------------- | ---------------------------------------------- |
3487+ | [ ` 'test:stderr' ` ] [ ] | Only emitted if the ` --test ` flag is passed. |
3488+ | [ ` 'test:stdout' ` ] [ ] | Only emitted if the ` --test ` flag is passed. |
3489+ | [ ` 'test:summary' ` ] [ ] | Per file, only when process isolation is used. |
3490+
3491+ Global events are emitted once per test run:
3492+
3493+ | Event | Notes |
3494+ | ---------------------------- | ------------------------------------ |
3495+ | [ ` 'test:summary' ` ] [ ] | The final cumulative summary. |
3496+ | [ ` 'test:coverage' ` ] [ ] | Only when code coverage is enabled. |
3497+ | [ ` 'test:interrupted' ` ] [ ] | Only when the run receives ` SIGINT ` . |
3498+ | [ ` 'test:watch:drained' ` ] [ ] | Watch mode only. |
3499+ | [ ` 'test:watch:restarted' ` ] [ ] | Watch mode only. |
3500+
3501+ The root test also emits [ ` 'test:plan' ` ] [ ] and [ ` 'test:diagnostic' ` ] [ ] events
3502+ at the end of the run to report run level totals.
3503+
34653504### Event: ` 'test:coverage' `
34663505
34673506* ` data ` {Object}
@@ -4710,6 +4749,21 @@ test.describe('my suite', (suite) => {
47104749
47114750[ TAP ] : https://testanything.org/
47124751[ Test tags ] : #test-tags
4752+ [ `'test:complete'` ] : #event-testcomplete
4753+ [ `'test:coverage'` ] : #event-testcoverage
4754+ [ `'test:dequeue'` ] : #event-testdequeue
4755+ [ `'test:diagnostic'` ] : #event-testdiagnostic
4756+ [ `'test:enqueue'` ] : #event-testenqueue
4757+ [ `'test:fail'` ] : #event-testfail
4758+ [ `'test:interrupted'` ] : #event-testinterrupted
4759+ [ `'test:pass'` ] : #event-testpass
4760+ [ `'test:plan'` ] : #event-testplan
4761+ [ `'test:start'` ] : #event-teststart
4762+ [ `'test:stderr'` ] : #event-teststderr
4763+ [ `'test:stdout'` ] : #event-teststdout
4764+ [ `'test:summary'` ] : #event-testsummary
4765+ [ `'test:watch:drained'` ] : #event-testwatchdrained
4766+ [ `'test:watch:restarted'` ] : #event-testwatchrestarted
47134767[ `--experimental-test-coverage` ] : cli.md#--experimental-test-coverage
47144768[ `--experimental-test-module-mocks` ] : cli.md#--experimental-test-module-mocks
47154769[ `--experimental-test-tag-filter` ] : cli.md#--experimental-test-tag-filterexpr
0 commit comments