Skip to content

Commit b80a15f

Browse files
committed
Update CurrentSpecReporter.js
1 parent f2f9a3a commit b80a15f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

spec/support/CurrentSpecReporter.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@ global.displayTestStats = function() {
4444
};
4545

4646
/**
47-
* Wraps test functions that use both `async` and a `done` callback, which Jasmine 5
48-
* does not support. This converts `async (done) => { ... }` to a promise-based
49-
* function so Jasmine does not throw:
47+
* Transitional compatibility shim for Jasmine 5.
48+
*
49+
* Jasmine 5 throws when a test or hook function uses both `async` and a `done` callback:
5050
* "An asynchronous before/it/after function was defined with the async keyword
5151
* but also took a done callback."
52+
*
53+
* Many existing tests use `async (done) => { ... done(); }`. This wrapper converts
54+
* those to promise-based functions by intercepting the `done` callback and resolving
55+
* a promise instead, so Jasmine sees a plain async function.
56+
*
57+
* To remove this shim, convert each file below so that tests and hooks use plain
58+
* `async () => {}` without a `done` parameter, then remove the file from this list.
59+
* Once the list is empty, delete this function and its call in `helper.js`.
5260
*/
5361
global.normalizeAsyncTests = function() {
5462
function wrapDoneCallback(fn) {

0 commit comments

Comments
 (0)