Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

QUnit 2.9 compatibility #63

Merged
merged 1 commit into from
Dec 19, 2019
Merged

QUnit 2.9 compatibility #63

merged 1 commit into from
Dec 19, 2019

Conversation

raycohen
Copy link
Collaborator

@raycohen raycohen commented Dec 10, 2019

As of QUnit 2.4:

  • (commit) All hooks get their return value treated as possibly a promise. qunit-bdd had been performing the promise behavior manually, so that was able to be removed.
  • (commit) All hooks are invoked with assert as the first param and testEnvironment as the this context. qunit-bdd had been capturing these manually and calling the hook with them, so that was able to be removed.

In QUnit 2.6

Version bump

As this PR breaks backwards compatibility with QUnit 2.5.1 and lower, we will release the next version of qunit-bdd as version 3.0

Other Breaking Changes from qunit-bdd 2.x

qunit-bdd's after hook ordering has changed to match QUnit's ordering of after and afterEach, which runs hooks at the same level in bottom-to-top order, rather than top-to-bottom order. See qunitjs/qunit#977 and comments in the qunit test code regarding this ordering.

@raycohen raycohen force-pushed the rc-temp-qunit-2.6 branch 2 times, most recently from 3284b00 to 3711326 Compare December 12, 2019 19:59
@raycohen raycohen changed the title WIP qunit 2.6 spike WIP QUnit 2.9 compatibility Dec 12, 2019
lib/qunit-bdd.js Outdated
var queue = [];
if (options.insideFirst) {
this.gatherHooksInsideFirstHelper(hook, queue);
return queue.reverse();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to do: explain this with a comment

console.error(e.stack);
}
QUnit.pushFailure(
'Exception while running qunit-bdd `' + hook + '` hook: ' +
Copy link
Collaborator Author

@raycohen raycohen Dec 16, 2019

Choose a reason for hiding this comment

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

we're duplicating QUnit's notrycatch if/else in order to provide a bdd-tailored exception message. We could return the function without any of this, but then an error from a qunit-bdd before would have a message stating it was coming from a qunit beforeEach which could cause confusion.

@raycohen raycohen force-pushed the rc-temp-qunit-2.6 branch 4 times, most recently from bd2d992 to da20181 Compare December 18, 2019 23:44
@raycohen raycohen changed the title WIP QUnit 2.9 compatibility QUnit 2.9 compatibility Dec 18, 2019
 - Breaks compatibility with QUnit < 2.6
 - Now matches QUnit's inside-first, bottom-to-top `after` hook ordering
@raycohen raycohen merged commit f0337c3 into master Dec 19, 2019
@raycohen raycohen deleted the rc-temp-qunit-2.6 branch December 19, 2019 19:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants