@@ -2445,6 +2445,9 @@ A successful call to [`run()`][] method will return a new {TestsStream}
2445
2445
object, streaming a series of events representing the execution of the tests.
2446
2446
` TestsStream ` will emit events, in the order of the tests definition
2447
2447
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
+
2448
2451
### Event: ` 'test:coverage' `
2449
2452
2450
2453
* ` data ` {Object}
@@ -2491,6 +2494,34 @@ object, streaming a series of events representing the execution of the tests.
2491
2494
2492
2495
Emitted when code coverage is enabled and all tests have completed.
2493
2496
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
+
2494
2525
### Event: ` 'test:dequeue' `
2495
2526
2496
2527
* ` data ` {Object}
@@ -2504,6 +2535,8 @@ Emitted when code coverage is enabled and all tests have completed.
2504
2535
* ` nesting ` {number} The nesting level of the test.
2505
2536
2506
2537
Emitted 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' ` .
2507
2540
2508
2541
### Event: ` 'test:diagnostic' `
2509
2542
@@ -2518,6 +2551,8 @@ Emitted when a test is dequeued, right before it is executed.
2518
2551
* ` nesting ` {number} The nesting level of the test.
2519
2552
2520
2553
Emitted when [ ` context.diagnostic ` ] [ ] is called.
2554
+ This event is guaranteed to be emitted in the same order as the tests are
2555
+ defined.
2521
2556
2522
2557
### Event: ` 'test:enqueue' `
2523
2558
@@ -2555,6 +2590,9 @@ Emitted when a test is enqueued for execution.
2555
2590
* ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2556
2591
2557
2592
Emitted 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' ` .
2558
2596
2559
2597
### Event: ` 'test:pass' `
2560
2598
@@ -2576,6 +2614,9 @@ Emitted when a test fails.
2576
2614
* ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2577
2615
2578
2616
Emitted 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' ` .
2579
2620
2580
2621
### Event: ` 'test:plan' `
2581
2622
@@ -2590,6 +2631,8 @@ Emitted when a test passes.
2590
2631
* ` count ` {number} The number of subtests that have ran.
2591
2632
2592
2633
Emitted 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.
2593
2636
2594
2637
### Event: ` 'test:start' `
2595
2638
@@ -2606,6 +2649,7 @@ Emitted when all subtests have completed for a given test.
2606
2649
Emitted when a test starts reporting its own and its subtests status.
2607
2650
This event is guaranteed to be emitted in the same order as the tests are
2608
2651
defined.
2652
+ The corresponding execution ordered event is ` 'test:dequeue' ` .
2609
2653
2610
2654
### Event: ` 'test:stderr' `
2611
2655
@@ -2619,6 +2663,8 @@ defined.
2619
2663
2620
2664
Emitted when a running test writes to ` stderr ` .
2621
2665
This 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.
2622
2668
2623
2669
### Event: ` 'test:stdout' `
2624
2670
@@ -2632,6 +2678,8 @@ This event is only emitted if `--test` flag is passed.
2632
2678
2633
2679
Emitted when a running test writes to ` stdout ` .
2634
2680
This 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.
2635
2683
2636
2684
### Event: ` 'test:watch:drained' `
2637
2685
0 commit comments