-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work around issue with pauseTest() timing out. #497
Conversation
Tested locally by: * setting `QUnit.config.testTimeout` to `10` * add `await this.pauseTest()` to [can render a simple template](https://github.com/emberjs/ember-qunit/blob/489d4d69b7360e3b4c26beea67d6728afdc47536/tests/integration/setup-rendering-test-test.js#L21) test * confirm that `can render a simple template` fails without modifications * add these changes * confirm test waits indefinitely
// https://github.com/emberjs/ember-qunit/issues/496 this clears the | ||
// timeout that would fail the test when it hits the global testTimeout | ||
// value. | ||
clearTimeout(QUnit.config.timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, as you intentionally want to pause tests indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I also did confirm that calling resumeTest()
does continue as expected. So basically clearing the timeout here just means that QUnit itself will wait for the promise to resolve forever....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
\#### 🚀 Enhancement * [emberjs#498](emberjs/ember-test-helpers#498) Add ability to opt-out of automatic settledness waiting in teardown. ([@rwjblue](https://github.com/rwjblue)) \#### 🐛 Bug Fix * [emberjs#497](emberjs/ember-test-helpers#497) Only customize RSVP's async for Ember older than 1.7. ([@rwjblue](https://github.com/rwjblue)) * [emberjs#481](emberjs/ember-test-helpers#481) Allow ember-cli-htmlbars-inline-precompile 2.x and 1.x ([@mydea](https://github.com/mydea)) \#### 🏠 Internal * [emberjs#491](emberjs/ember-test-helpers#491) TravisCI: Remove deprecated `sudo: false` option ([@Turbo87](https://github.com/Turbo87)) * [emberjs#480](emberjs/ember-test-helpers#480) Extract Prettier configuration to .prettierrc.js file. ([@rwjblue](https://github.com/rwjblue)) * [emberjs#463](emberjs/ember-test-helpers#463) Improve type declarations ([@Turbo87](https://github.com/Turbo87)) \#### Committers: 4 - Francesco Novy ([@mydea](https://github.com/mydea)) - Peter Wagenet ([@wagenet](https://github.com/wagenet)) - Robert Jackson ([@rwjblue](https://github.com/rwjblue)) - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
Follows-up emberjs#497 which introduced this because QUnit 2.8 didn't support changing an existing `assert.timeout()` by calling it again in the same test (it would leave the old one unchanged, and start a second timeout). This was fixed in QUnit 2.9.3, released in Oct 2019. The ember-qunit package declares a peer dependency on `qunit@2.13.0`, which should remove the need for this workaround. Ref emberjs#496.
Rough summary of the issue that this is solving is that when the test is an async function setting
assert.timeout(-1)
essentially has no effect.See detailed explanation in #496 (comment).
Tested locally by:
QUnit.config.testTimeout
to10
await this.pauseTest()
to can render a simple template testcan render a simple template
fails without modificationsWorks around issue reported in #496.