qunit: Prepare testrunner for QUnit 2
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 17 Jul 2017 19:29:11 +0000 (14:29 -0500)
committerKrinkle <krinklemail@gmail.com>
Thu, 20 Jul 2017 20:45:18 +0000 (20:45 +0000)
commit43dc5c1539e887c68a6c0ba09de83277ee71b9d3
tree1411113c64657dc0555aa4a67847494d6136ea16
parentf05716b1f6766140228fe04a8c42db79c2cd9969
qunit: Prepare testrunner for QUnit 2

* Nested modules:
  - Support for Sinon extension was fixed by Ib17bbbef45b2bd.
  - Support for Fixture extension was still broken, masked by the use
    of a local variable that made the handler not fail when setup ran twice
    in a row. Fixed using the same moduleStack.length check.
  - Add regression test.

* beforeEach/afterEach:
  - Added in 1.16, with compat for setup/teardown.
    Our wrapper adds its own setup/teardown, and preserves any original one.
    However, it didn't account for beforeEach/afterEach, so it ends up
    sending both but only one is used.
  - Fix to support both on the incoming localEnv object, and also switch
    our wrapper to use beforeEach/afterEach in prep for QUnit 2.0.
  - Fix our wrappers to preserve return value since QUnit 2 allows beforeEach
    and afterEach hooks to be asynchronous by returning a Promise, similar
    to how one can do from QUnit.test().
  - Add regression test.

* Centralise makeSafeEnv logic
  - We always create our own env object to pass to orgModule().
    Document why this is (to avoid recursion).
  - Add regression test.

* Custom assertion methods:
  - Use this.pushResult instead of the deprecated QUnit.push() method.
    This also improves the in-browser reporting of errors by properly
    supporting 'negative' results for notHtmlEqual reporter.

Bug: T170515
Change-Id: If4141df10eae55cbe8a5ca7a26707be1cd7b9217
tests/qunit/data/testrunner.js