Skip to content

Commit 2e87e2a

Browse files
authored
Core: Fix hanging assert.async() after assert.timeout()
Follows-up 163c9bc (#1642), which changed an internalRecover() to internalStart(), whereas internalStart will (correctly) not resume if there are other pauses still remaining. Change this back to internalRecover(). Fixes #1705. Closes #1739.
1 parent 0b776c1 commit 2e87e2a

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

src/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ Test.prototype = {
752752
`Test took longer than ${timeout}ms; test timed out.`,
753753
sourceFromStacktrace(2)
754754
);
755-
internalStart(test);
755+
internalRecover(test);
756756
};
757757
};
758758
clearTimeout(config.timeout);

test/cli/cli-main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const fixtureCases = {
2525

2626
'test with failing assertion': ['qunit', 'fail/failure.js'],
2727
'test that hangs': ['qunit', 'hanging-test'],
28+
'test with pending async after timeout': ['qunit', 'pending-async-after-timeout.js'],
2829
'two tests with one timeout': ['qunit', 'timeout'],
2930
'test with zero assertions': ['qunit', 'zero-assertions.js'],
3031

test/cli/fixtures/expected/tap-outputs.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,25 @@ Extra reporters found among package dependencies: npm-reporter
191191
Error: Process exited before tests finished running
192192
Last test to run (hanging) has an async hold. Ensure all assert.async() callbacks are invoked and Promises resolve. You should also set a standard timeout via QUnit.config.testTimeout.
193193
194+
# exit code: 1`,
195+
196+
'qunit pending-async-after-timeout.js':
197+
`TAP version 13
198+
not ok 1 example
199+
---
200+
message: Test took longer than 10ms; test timed out.
201+
severity: failed
202+
actual : null
203+
expected: undefined
204+
stack: |
205+
at internal
206+
...
207+
1..1
208+
# pass 0
209+
# skip 0
210+
# todo 0
211+
# fail 1
212+
194213
# exit code: 1`,
195214

196215
'qunit unhandled-rejection.js':
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Regression test for https://github.com/qunitjs/qunit/issues/1705
2+
QUnit.test('example', async assert => {
3+
assert.timeout(10);
4+
// eslint-disable-next-line no-unused-vars
5+
const done = assert.async();
6+
assert.true(true);
7+
});

0 commit comments

Comments
 (0)