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

Fix order dependence in tests. #252

Merged
merged 6 commits into from
Dec 5, 2017

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Dec 4, 2017

  • Refactor cleanup assertions to use global failure after test run.
  • Avoid before and after when randomizing test order.
  • Ensure setupRegistry is called before it is needed each time.
  • Simplify precondition assertion in test-module-for-acceptance tests.
  • Make randomized seed testing easier.
  • Ensure unsetContext() is called during teardown.

No clue why this isn't the default in QUnit, but reordering + testing a
specific seed (to track down order dependent test issues) is _really_
hard.

This change ensures that when running with a specific seed tests are
**always** ran in the seed determined order (therefore making back to
back "reloads" consistently fail).
Having this do a `strictEqual` previously meant that the entire test
context was dumped upon failure, which was less than helpful.
Throwing during a `QUnit.testDone` callback causes the entire test suite
to abort (and does not actually fail the test in question anyways). This
changes things around so that we track these failures and throw them
after the test suite is completed, which is caught by QUnits global
`window.onerror` handler as a "global failure".
@rwjblue
Copy link
Member Author

rwjblue commented Dec 5, 2017

I was able to run http://localhost:4200/tests/?seed&hidepassed around 20 times without failing after these changes.

@rwjblue rwjblue merged commit 7390be0 into emberjs:master Dec 5, 2017
@rwjblue rwjblue deleted the ensure-context-is-unset branch December 5, 2017 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant