@@ -2438,6 +2438,9 @@ A successful call to [`run()`][] method will return a new {TestsStream}
24382438object, streaming a series of events representing the execution of the tests.
24392439` TestsStream ` will emit events, in the order of the tests definition
24402440
2441+ Some of the events are guaranteed to be emitted in the same order as the tests
2442+ are defined, while others are emitted in the order that the tests execute.
2443+
24412444### Event: ` 'test:coverage' `
24422445
24432446* ` data ` {Object}
@@ -2484,6 +2487,34 @@ object, streaming a series of events representing the execution of the tests.
24842487
24852488Emitted when code coverage is enabled and all tests have completed.
24862489
2490+ ### Event: ` 'test:complete' `
2491+
2492+ * ` data ` {Object}
2493+ * ` column ` {number|undefined} The column number where the test is defined, or
2494+ ` undefined ` if the test was run through the REPL.
2495+ * ` details ` {Object} Additional execution metadata.
2496+ * ` passed ` {boolean} Whether the test passed or not.
2497+ * ` duration_ms ` {number} The duration of the test in milliseconds.
2498+ * ` error ` {Error|undefined} An error wrapping the error thrown by the test
2499+ if it did not pass.
2500+ * ` cause ` {Error} The actual error thrown by the test.
2501+ * ` type ` {string|undefined} The type of the test, used to denote whether
2502+ this is a suite.
2503+ * ` file ` {string|undefined} The path of the test file,
2504+ ` undefined ` if test was run through the REPL.
2505+ * ` line ` {number|undefined} The line number where the test is defined, or
2506+ ` undefined ` if the test was run through the REPL.
2507+ * ` name ` {string} The test name.
2508+ * ` nesting ` {number} The nesting level of the test.
2509+ * ` testNumber ` {number} The ordinal number of the test.
2510+ * ` todo ` {string|boolean|undefined} Present if [ ` context.todo ` ] [ ] is called
2511+ * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2512+
2513+ Emitted when a test completes its execution.
2514+ This event is not emitted in the same order as the tests are
2515+ defined.
2516+ The corresponding declaration ordered events are ` 'test:pass' ` and ` 'test:fail' ` .
2517+
24872518### Event: ` 'test:dequeue' `
24882519
24892520* ` data ` {Object}
@@ -2497,6 +2528,8 @@ Emitted when code coverage is enabled and all tests have completed.
24972528 * ` nesting ` {number} The nesting level of the test.
24982529
24992530Emitted when a test is dequeued, right before it is executed.
2531+ This event is not guaranteed to be emitted in the same order as the tests are
2532+ defined. The corresponding declaration ordered event is ` 'test:start' ` .
25002533
25012534### Event: ` 'test:diagnostic' `
25022535
@@ -2511,6 +2544,8 @@ Emitted when a test is dequeued, right before it is executed.
25112544 * ` nesting ` {number} The nesting level of the test.
25122545
25132546Emitted when [ ` context.diagnostic ` ] [ ] is called.
2547+ This event is guaranteed to be emitted in the same order as the tests are
2548+ defined.
25142549
25152550### Event: ` 'test:enqueue' `
25162551
@@ -2548,6 +2583,9 @@ Emitted when a test is enqueued for execution.
25482583 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
25492584
25502585Emitted when a test fails.
2586+ This event is guaranteed to be emitted in the same order as the tests are
2587+ defined.
2588+ The corresponding execution ordered event is ` 'test:complete' ` .
25512589
25522590### Event: ` 'test:pass' `
25532591
@@ -2569,6 +2607,9 @@ Emitted when a test fails.
25692607 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
25702608
25712609Emitted when a test passes.
2610+ This event is guaranteed to be emitted in the same order as the tests are
2611+ defined.
2612+ The corresponding execution ordered event is ` 'test:complete' ` .
25722613
25732614### Event: ` 'test:plan' `
25742615
@@ -2583,6 +2624,8 @@ Emitted when a test passes.
25832624 * ` count ` {number} The number of subtests that have ran.
25842625
25852626Emitted when all subtests have completed for a given test.
2627+ This event is guaranteed to be emitted in the same order as the tests are
2628+ defined.
25862629
25872630### Event: ` 'test:start' `
25882631
@@ -2599,6 +2642,7 @@ Emitted when all subtests have completed for a given test.
25992642Emitted when a test starts reporting its own and its subtests status.
26002643This event is guaranteed to be emitted in the same order as the tests are
26012644defined.
2645+ The corresponding execution ordered event is ` 'test:dequeue' ` .
26022646
26032647### Event: ` 'test:stderr' `
26042648
@@ -2612,6 +2656,8 @@ defined.
26122656
26132657Emitted when a running test writes to ` stderr ` .
26142658This event is only emitted if ` --test ` flag is passed.
2659+ This event is not guaranteed to be emitted in the same order as the tests are
2660+ defined.
26152661
26162662### Event: ` 'test:stdout' `
26172663
@@ -2625,6 +2671,8 @@ This event is only emitted if `--test` flag is passed.
26252671
26262672Emitted when a running test writes to ` stdout ` .
26272673This event is only emitted if ` --test ` flag is passed.
2674+ This event is not guaranteed to be emitted in the same order as the tests are
2675+ defined.
26282676
26292677### Event: ` 'test:watch:drained' `
26302678
0 commit comments