Skip to content

Commit 1b34a1c

Browse files
committed
harness/asyncHelpers.js: Add doc comments
1 parent 8ca5bdd commit 1b34a1c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

harness/asyncHelpers.js

+20
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ description: |
66
defines: [asyncTest]
77
---*/
88

9+
/**
10+
* Defines the **sole** asynchronous test of a file.
11+
* @see {@link ../docs/rfcs/async-helpers.md} for background.
12+
*
13+
* @param {Function} testFunc a callback whose returned promise indicates test results
14+
* (fulfillment for success, rejection for failure)
15+
* @returns {void}
16+
*/
917
function asyncTest(testFunc) {
1018
if (!Object.hasOwn(globalThis, "$DONE")) {
1119
throw new Test262Error("asyncTest called without async flag");
@@ -28,6 +36,18 @@ function asyncTest(testFunc) {
2836
}
2937
}
3038

39+
/**
40+
* Asserts that a callback asynchronously throws an instance of a particular
41+
* error (i.e., returns a promise whose rejection value is an object referencing
42+
* the constructor).
43+
*
44+
* @param {Function} expectedErrorConstructor the expected constructor of the
45+
* rejection value
46+
* @param {Function} func the callback
47+
* @param {string} [message] the prefix to use for failure messages
48+
* @returns {Promise<void>} fulfills if the expected error is thrown,
49+
* otherwise rejects
50+
*/
3151
assert.throwsAsync = function (expectedErrorConstructor, func, message) {
3252
return new Promise(function (resolve) {
3353
var innerThenable;

0 commit comments

Comments
 (0)