Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure unhandled rejections cause test failure
Prior to this change, an unhandled exception in a native promise that was not returned from the `test` callback would not cause test failure. For example, prior to this change both of the following (using default out of the box settings) results in test failures: ```js test('native promises cause an unhandled rejection', function(assert) { // imagine this was "deep" inside various method calls setTimeout(function() { throw new Error('whoops!'); }); // other things that we are trying to test assert.deepEqual(someMethod(), ['one', 'two']); }); test('RSVP promises cause an unhandled rejection', function(assert) { // imagine this was "deep" inside various method calls Ember.RSVP.Promise.resolve().then(function() { throw new Error('whoops!'); }); // other things that we are trying to test assert.deepEqual(someMethod(), ['one', 'two']); }); ``` But this test (prior to this PR) would result in a passing test suite: ```js test('native promises cause an unhandled rejection', function(assert) { // imagine this was "deep" inside various method calls Promise.resolve().then(function() { throw new Error('whoops!'); }); // other things that we are trying to test assert.deepEqual(someMethod(), ['one', 'two']); }); ``` This is a polyfill of the general behavior being worked on upstream in QUnit itself, and can be removed once the feature is landed.
- Loading branch information