Revert "test_runner: remove promises returned by t.test()" · nodejs/node@dce1995 · GitHub
Skip to content

Commit dce1995

Browse files
romainmenkeRafaelGSS
authored andcommitted
Revert "test_runner: remove promises returned by t.test()"
This reverts commit 1a2eb15. PR-URL: #58282 Fixes: #58227 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 8b0c5ed commit dce1995

11 files changed

Lines changed: 67 additions & 36 deletions

File tree

doc/api/test.md

Lines changed: 36 additions & 26 deletions

lib/internal/test_runner/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class TestContext {
370370
Test, name, options, fn, overrides,
371371
);
372372

373-
subtest.start();
373+
return subtest.start();
374374
}
375375

376376
before(fn, options) {

test/fixtures/test-runner/output/dot_reporter.snapshot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ Failed tests:
158158
*
159159
*
160160
*
161+
*
162+
*
161163
✖ subtest sync throw fails (*ms)
162164
'2 subtests failed'
163165
✖ timed out async test (*ms)

test/fixtures/test-runner/output/hooks.snapshot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ not ok 16 - t.after throws - no subtests
576576
*
577577
*
578578
*
579+
*
579580
...
580581
1..2
581582
not ok 17 - t.beforeEach throws
@@ -606,6 +607,8 @@ not ok 17 - t.beforeEach throws
606607
*
607608
*
608609
*
610+
*
611+
*
609612
...
610613
# Subtest: 2
611614
not ok 2 - 2
@@ -626,6 +629,7 @@ not ok 17 - t.beforeEach throws
626629
*
627630
*
628631
*
632+
*
629633
...
630634
1..2
631635
not ok 18 - t.afterEach throws
@@ -753,6 +757,7 @@ not ok 21 - afterEach context when test fails
753757
*
754758
*
755759
*
760+
*
756761
...
757762
1..2
758763
not ok 22 - afterEach throws and test fails

test/fixtures/test-runner/output/hooks_spec_reporter.snapshot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
*
364364
*
365365
*
366+
*
366367

367368
*
368369
1 (*ms)
@@ -375,6 +376,8 @@
375376
*
376377
*
377378
*
379+
*
380+
*
378381

379382
*
380383
2 (*ms)
@@ -388,6 +391,7 @@
388391
*
389392
*
390393
*
394+
*
391395

392396
*
393397
1 (*ms)
@@ -435,6 +439,7 @@
435439
*
436440
*
437441
*
442+
*
438443

439444
*
440445
t.after() is called if test body throws (*ms)

test/fixtures/test-runner/output/junit_reporter.snapshot

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at first
355355
</testcase>
356356
<testcase name="sync throw fails at second" time="*" classname="test" failure="thrown from subtest sync throw fails at second">
357357
<failure type="testCodeFailure" message="thrown from subtest sync throw fails at second">
358-
[Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at second] {
358+
Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at second
359+
* {
359360
code: 'ERR_TEST_FAILURE',
360361
failureType: 'testCodeFailure',
361362
cause: Error: thrown from subtest sync throw fails at second
@@ -365,6 +366,8 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at first
365366
*
366367
*
367368
*
369+
*
370+
*
368371
}
369372
</failure>
370373
</testcase>

test/fixtures/test-runner/output/output.snapshot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ not ok 51 - custom inspect symbol that throws fail
606606
*
607607
*
608608
*
609+
*
610+
*
609611
...
610612
1..2
611613
not ok 52 - subtest sync throw fails

test/fixtures/test-runner/output/output_cli.snapshot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ not ok 51 - custom inspect symbol that throws fail
614614
*
615615
*
616616
*
617+
*
618+
*
617619
...
618620
1..2
619621
not ok 52 - subtest sync throw fails

test/fixtures/test-runner/output/spec_reporter.snapshot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@
289289
*
290290
*
291291
*
292+
*
293+
*
292294

293295
*
294296
timed out async test (*ms)

test/fixtures/test-runner/output/spec_reporter_cli.snapshot

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)