@@ -1407,6 +1407,11 @@ run({ files: [path.resolve('./tests/test.js')] })
1407
1407
added:
1408
1408
- v22.0.0
1409
1409
- v20.13.0
1410
+ changes:
1411
+ - version:
1412
+ - REPLACEME
1413
+ pr-url: https://github.com/nodejs/node/pull/56664
1414
+ description: This function no longer returns a `Promise`.
1410
1415
-->
1411
1416
1412
1417
* ` name ` {string} The name of the suite, which is displayed when reporting test
@@ -1417,7 +1422,6 @@ added:
1417
1422
* ` fn ` {Function|AsyncFunction} The suite function declaring nested tests and
1418
1423
suites. The first argument to this function is a [ ` SuiteContext ` ] [ ] object.
1419
1424
** Default:** A no-op function.
1420
- * Returns: {Promise} Immediately fulfilled with ` undefined ` .
1421
1425
1422
1426
The ` suite() ` function is imported from the ` node:test ` module.
1423
1427
@@ -1461,6 +1465,10 @@ added:
1461
1465
- v18.0.0
1462
1466
- v16.17.0
1463
1467
changes:
1468
+ - version:
1469
+ - REPLACEME
1470
+ pr-url: https://github.com/nodejs/node/pull/56664
1471
+ description: This function no longer returns a `Promise`.
1464
1472
- version:
1465
1473
- v20.2.0
1466
1474
- v18.17.0
@@ -1510,8 +1518,6 @@ changes:
1510
1518
to this function is a [ ` TestContext ` ] [ ] object. If the test uses callbacks,
1511
1519
the callback function is passed as the second argument. ** Default:** A no-op
1512
1520
function.
1513
- * Returns: {Promise} Fulfilled with ` undefined ` once
1514
- the test completes, or immediately if the test runs within a suite.
1515
1521
1516
1522
The ` test() ` function is the value imported from the ` test ` module. Each
1517
1523
invocation of this function results in reporting the test to the {TestsStream}.
@@ -1520,26 +1526,6 @@ The `TestContext` object passed to the `fn` argument can be used to perform
1520
1526
actions related to the current test. Examples include skipping the test, adding
1521
1527
additional diagnostic information, or creating subtests.
1522
1528
1523
- ` test() ` returns a ` Promise ` that fulfills once the test completes.
1524
- if ` test() ` is called within a suite, it fulfills immediately.
1525
- The return value can usually be discarded for top level tests.
1526
- However, the return value from subtests should be used to prevent the parent
1527
- test from finishing first and cancelling the subtest
1528
- as shown in the following example.
1529
-
1530
- ``` js
1531
- test (' top level test' , async (t ) => {
1532
- // The setTimeout() in the following subtest would cause it to outlive its
1533
- // parent test if 'await' is removed on the next line. Once the parent test
1534
- // completes, it will cancel any outstanding subtests.
1535
- await t .test (' longer running subtest' , async (t ) => {
1536
- return new Promise ((resolve , reject ) => {
1537
- setTimeout (resolve, 1000 );
1538
- });
1539
- });
1540
- });
1541
- ```
1542
-
1543
1529
The ` timeout ` option can be used to fail the test if it takes longer than
1544
1530
` timeout ` milliseconds to complete. However, it is not a reliable mechanism for
1545
1531
canceling tests because a running test might block the application thread and
0 commit comments