Skip to content

Commit

Permalink
Ensure setup / teardown respect promises.
Browse files Browse the repository at this point in the history
The prior code completely ignored any promises being returned, and as
such forced a bunch of "run loop sprinkles" throughout the code.

This brings back the ability to return promises from `beforeEach` /
`setup` and from `teardown`.
  • Loading branch information
rwjblue committed Jan 4, 2018
1 parent 28e828a commit a4154f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/internal-test-helpers/lib/ember-dev/setup-qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ export default function setupQUnit(assertion, _qunitGlobal) {
assertion.reset();
assertion.inject();

originalSetup.apply(this, arguments);
return originalSetup.apply(this, arguments);
};

options.teardown = function() {
originalTeardown.apply(this, arguments);
let result = originalTeardown.apply(this, arguments);

assertion.assert();
assertion.restore();

return result;
};

return originalModule(name, options);
Expand Down
2 changes: 1 addition & 1 deletion packages/internal-test-helpers/lib/module-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function moduleFor(description, TestClass, ...mixins) {
},

teardown() {
context.teardown();
return context.teardown();
}
});

Expand Down

0 comments on commit a4154f5

Please sign in to comment.