@@ -2445,6 +2445,9 @@ A successful call to [`run()`][] method will return a new {TestsStream}
24452445object, streaming a series of events representing the execution of the tests.
24462446` TestsStream ` will emit events, in the order of the tests definition
24472447
2448+ Some of the events are guaranteed to be emitted in the same order as the tests
2449+ are defined, while others are emitted in the order that the tests execute.
2450+
24482451### Event: ` 'test:coverage' `
24492452
24502453* ` data ` {Object}
@@ -2491,6 +2494,34 @@ object, streaming a series of events representing the execution of the tests.
24912494
24922495Emitted when code coverage is enabled and all tests have completed.
24932496
2497+ ### Event: ` 'test:complete' `
2498+
2499+ * ` data ` {Object}
2500+ * ` column ` {number|undefined} The column number where the test is defined, or
2501+ ` undefined ` if the test was run through the REPL.
2502+ * ` details ` {Object} Additional execution metadata.
2503+ * ` passed ` {boolean} Whether the test passed or not.
2504+ * ` duration_ms ` {number} The duration of the test in milliseconds.
2505+ * ` error ` {Error|undefined} An error wrapping the error thrown by the test
2506+ if it did not pass.
2507+ * ` cause ` {Error} The actual error thrown by the test.
2508+ * ` type ` {string|undefined} The type of the test, used to denote whether
2509+ this is a suite.
2510+ * ` file ` {string|undefined} The path of the test file,
2511+ ` undefined ` if test was run through the REPL.
2512+ * ` line ` {number|undefined} The line number where the test is defined, or
2513+ ` undefined ` if the test was run through the REPL.
2514+ * ` name ` {string} The test name.
2515+ * ` nesting ` {number} The nesting level of the test.
2516+ * ` testNumber ` {number} The ordinal number of the test.
2517+ * ` todo ` {string|boolean|undefined} Present if [ ` context.todo ` ] [ ] is called
2518+ * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2519+
2520+ Emitted when a test completes its execution.
2521+ This event is not emitted in the same order as the tests are
2522+ defined.
2523+ The corresponding declaration ordered events are ` 'test:pass' ` and ` 'test:fail' ` .
2524+
24942525### Event: ` 'test:dequeue' `
24952526
24962527* ` data ` {Object}
@@ -2504,6 +2535,8 @@ Emitted when code coverage is enabled and all tests have completed.
25042535 * ` nesting ` {number} The nesting level of the test.
25052536
25062537Emitted when a test is dequeued, right before it is executed.
2538+ This event is not guaranteed to be emitted in the same order as the tests are
2539+ defined. The corresponding declaration ordered event is ` 'test:start' ` .
25072540
25082541### Event: ` 'test:diagnostic' `
25092542
@@ -2518,6 +2551,8 @@ Emitted when a test is dequeued, right before it is executed.
25182551 * ` nesting ` {number} The nesting level of the test.
25192552
25202553Emitted when [ ` context.diagnostic ` ] [ ] is called.
2554+ This event is guaranteed to be emitted in the same order as the tests are
2555+ defined.
25212556
25222557### Event: ` 'test:enqueue' `
25232558
@@ -2555,6 +2590,9 @@ Emitted when a test is enqueued for execution.
25552590 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
25562591
25572592Emitted when a test fails.
2593+ This event is guaranteed to be emitted in the same order as the tests are
2594+ defined.
2595+ The corresponding execution ordered event is ` 'test:complete' ` .
25582596
25592597### Event: ` 'test:pass' `
25602598
@@ -2576,6 +2614,9 @@ Emitted when a test fails.
25762614 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
25772615
25782616Emitted when a test passes.
2617+ This event is guaranteed to be emitted in the same order as the tests are
2618+ defined.
2619+ The corresponding execution ordered event is ` 'test:complete' ` .
25792620
25802621### Event: ` 'test:plan' `
25812622
@@ -2590,6 +2631,8 @@ Emitted when a test passes.
25902631 * ` count ` {number} The number of subtests that have ran.
25912632
25922633Emitted when all subtests have completed for a given test.
2634+ This event is guaranteed to be emitted in the same order as the tests are
2635+ defined.
25932636
25942637### Event: ` 'test:start' `
25952638
@@ -2606,6 +2649,7 @@ Emitted when all subtests have completed for a given test.
26062649Emitted when a test starts reporting its own and its subtests status.
26072650This event is guaranteed to be emitted in the same order as the tests are
26082651defined.
2652+ The corresponding execution ordered event is ` 'test:dequeue' ` .
26092653
26102654### Event: ` 'test:stderr' `
26112655
@@ -2619,6 +2663,8 @@ defined.
26192663
26202664Emitted when a running test writes to ` stderr ` .
26212665This event is only emitted if ` --test ` flag is passed.
2666+ This event is not guaranteed to be emitted in the same order as the tests are
2667+ defined.
26222668
26232669### Event: ` 'test:stdout' `
26242670
@@ -2632,6 +2678,8 @@ This event is only emitted if `--test` flag is passed.
26322678
26332679Emitted when a running test writes to ` stdout ` .
26342680This event is only emitted if ` --test ` flag is passed.
2681+ This event is not guaranteed to be emitted in the same order as the tests are
2682+ defined.
26352683
26362684### Event: ` 'test:watch:drained' `
26372685
0 commit comments