@@ -2438,6 +2438,9 @@ A successful call to [`run()`][] method will return a new {TestsStream}
2438
2438
object, streaming a series of events representing the execution of the tests.
2439
2439
` TestsStream ` will emit events, in the order of the tests definition
2440
2440
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
+
2441
2444
### Event: ` 'test:coverage' `
2442
2445
2443
2446
* ` data ` {Object}
@@ -2484,6 +2487,34 @@ object, streaming a series of events representing the execution of the tests.
2484
2487
2485
2488
Emitted when code coverage is enabled and all tests have completed.
2486
2489
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
+
2487
2518
### Event: ` 'test:dequeue' `
2488
2519
2489
2520
* ` data ` {Object}
@@ -2497,6 +2528,8 @@ Emitted when code coverage is enabled and all tests have completed.
2497
2528
* ` nesting ` {number} The nesting level of the test.
2498
2529
2499
2530
Emitted 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' ` .
2500
2533
2501
2534
### Event: ` 'test:diagnostic' `
2502
2535
@@ -2511,6 +2544,8 @@ Emitted when a test is dequeued, right before it is executed.
2511
2544
* ` nesting ` {number} The nesting level of the test.
2512
2545
2513
2546
Emitted when [ ` context.diagnostic ` ] [ ] is called.
2547
+ This event is guaranteed to be emitted in the same order as the tests are
2548
+ defined.
2514
2549
2515
2550
### Event: ` 'test:enqueue' `
2516
2551
@@ -2548,6 +2583,9 @@ Emitted when a test is enqueued for execution.
2548
2583
* ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2549
2584
2550
2585
Emitted 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' ` .
2551
2589
2552
2590
### Event: ` 'test:pass' `
2553
2591
@@ -2569,6 +2607,9 @@ Emitted when a test fails.
2569
2607
* ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
2570
2608
2571
2609
Emitted 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' ` .
2572
2613
2573
2614
### Event: ` 'test:plan' `
2574
2615
@@ -2583,6 +2624,8 @@ Emitted when a test passes.
2583
2624
* ` count ` {number} The number of subtests that have ran.
2584
2625
2585
2626
Emitted 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.
2586
2629
2587
2630
### Event: ` 'test:start' `
2588
2631
@@ -2599,6 +2642,7 @@ Emitted when all subtests have completed for a given test.
2599
2642
Emitted when a test starts reporting its own and its subtests status.
2600
2643
This event is guaranteed to be emitted in the same order as the tests are
2601
2644
defined.
2645
+ The corresponding execution ordered event is ` 'test:dequeue' ` .
2602
2646
2603
2647
### Event: ` 'test:stderr' `
2604
2648
@@ -2612,6 +2656,8 @@ defined.
2612
2656
2613
2657
Emitted when a running test writes to ` stderr ` .
2614
2658
This 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.
2615
2661
2616
2662
### Event: ` 'test:stdout' `
2617
2663
@@ -2625,6 +2671,8 @@ This event is only emitted if `--test` flag is passed.
2625
2671
2626
2672
Emitted when a running test writes to ` stdout ` .
2627
2673
This 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.
2628
2676
2629
2677
### Event: ` 'test:watch:drained' `
2630
2678
0 commit comments