-
Notifications
You must be signed in to change notification settings - Fork 776
Closed
Labels
Description
Tell us about your runtime:
- QUnit version: 2.9.1
- What environment are you running QUnit in? (e.g., browser, Node):* Browser & Node
- How are you running QUnit? (e.g., script, testem, Grunt): *
qunitNode CLI /testem
What are you trying to do?
A test whose done hooks are attempted to be invoked after the test is considered torn down can produce an error when trying to access those hooks.
Code that reproduces the problem:
QUnit.test( "hello test", function( assert ) {
let done = assert.async()
assert.ok( 1 == "1", "Passed!" );
setTimeout(done,10);
return Promise.reject();
});Will result in:
Uncaught Error: assert.async callback called after test finished.
at done (qunit-2.9.1.js:3773)
qunit-2.9.1.js:3107 Uncaught TypeError: Cannot read property 'length' of undefined
at processHooks (qunit-2.9.1.js:3107)
at Test.hooks (qunit-2.9.1.js:3116)
at runTest (qunit-2.9.1.js:3254)
at advanceTestQueue (qunit-2.9.1.js:2646)
at Object.advance (qunit-2.9.1.js:2597)
at Test.queue (qunit-2.9.1.js:3276)
at test (qunit-2.9.1.js:3516)
at Object.onError (qunit-2.9.1.js:4217)
at window$1.onerror (qunit-2.9.1.js:5499)
Codepen: https://codepen.io/rwjblue/pen/KJLQEJ
If you have any relevant configuration information, please include that here:
What did you expect to happen?
Trying to access hooks on an already torn down test should not result in an error.
What actually happened?
An error was thrown when trying to access hooks on a module. At this point, hooks has already been torn down.
Reactions are currently unavailable