Skip to content
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

Merged
merged 1 commit into from
May 17, 2019

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented May 16, 2019

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:

  • setting QUnit.config.testTimeout to 10
  • add await this.pauseTest() to can render a simple template test
  • confirm that can render a simple template fails without modifications
  • add these changes
  • confirm test waits indefinitely

Works around issue reported in #496.

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);
Copy link
Contributor

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.

Copy link
Member Author

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....

Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@rwjblue rwjblue merged commit 744927e into emberjs:master May 17, 2019
@rwjblue rwjblue deleted the patch-for-pauseTest branch May 17, 2019 13:09
rwjblue added a commit to rwjblue/ember-qunit that referenced this pull request Jun 17, 2019
\#### 🚀 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))
@rwjblue rwjblue added the bug label Jul 30, 2019
Krinkle added a commit to Krinkle/ember-qunit that referenced this pull request Mar 3, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants