Skip to content

Instantly share code, notes, and snippets.

@nakamura-to
Created November 2, 2014 15:28
Show Gist options
  • Save nakamura-to/51ffe880695868d63b4e to your computer and use it in GitHub Desktop.
Save nakamura-to/51ffe880695868d63b4e to your computer and use it in GitHub Desktop.
Karma reporter shows a wrong stacktrace when a promise is resolved in next event loop
'use strict';
describe('Karma reporter', function () {
var $rootScope;
var $q;
beforeEach(inject(function (_$rootScope_, _$q_) {
$rootScope = _$rootScope_;
$q = _$q_;
}));
it('shows a wrong stacktrace when a promise is resolved in next event loop', function (done) {
var deferred = $q.defer();
var promise = deferred.promise;
promise.then(function () {
Object.hello(); // TypeError
done();
});
setTimeout(function () {
deferred.resolve();
$rootScope.$apply();
done();
}, 50);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment