Skip to content

Commit

Permalink
Merge pull request #381 from step2yeung/master
Browse files Browse the repository at this point in the history
Check QUnit.config.current.assert in asyncStart()
  • Loading branch information
rwjblue authored Nov 6, 2018
2 parents bf8b9ce + 6eac1f1 commit abd2d7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addon-test-support/ember-qunit/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ function unhandledRejectionAssertion(current, error) {
let Adapter = Ember.Test.Adapter.extend({
init() {
this.doneCallbacks = [];
this.qunit = this.qunit || QUnit;
},

asyncStart() {
this.doneCallbacks.push(QUnit.config.current ? QUnit.config.current.assert.async() : null);
this.doneCallbacks.push(
this.qunit.config.current && this.qunit.config.current.assert
? this.qunit.config.current.assert.async()
: null
);
},

asyncEnd() {
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ test('asyncStart waits for equal numbers of asyncEnd to finish a test', function
adapter.asyncEnd();
}, 50);
});

test('asyncStart should handle skipped tests that has no assert', function(assert) {
let FakeQUnitWithoutAssert = {
config: {
current: {},
},
};

const adapter = QUnitAdapter.create({ qunit: FakeQUnitWithoutAssert });

adapter.asyncStart();
assert.equal(adapter.doneCallbacks.length, 1);
assert.deepEqual(adapter.doneCallbacks, [null]);
});

0 comments on commit abd2d7d

Please sign in to comment.