report when an async afterAll doesn't call in time
This commit is contained in:
@@ -345,7 +345,6 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
env.afterAll(function() {
|
env.afterAll(function() {
|
||||||
env.expect(1).toEqual(2);
|
env.expect(1).toEqual(2);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -637,6 +636,29 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should wait the specified interval before reporting an afterAll that fails to call done", function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone','afterAllError']);
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
|
expect(reporter.afterAllError).toHaveBeenCalledWith(jasmine.any(Error));
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.describe('my suite', function() {
|
||||||
|
env.it('my spec', function() {
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterAll(function(innerDone) {
|
||||||
|
jasmine.clock().tick(4312);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: something is wrong with this spec
|
// TODO: something is wrong with this spec
|
||||||
|
|||||||
@@ -69,7 +69,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
if (queueableFn.timeout) {
|
if (queueableFn.timeout) {
|
||||||
timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
|
timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
|
||||||
self.onException(new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'));
|
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
||||||
|
if (queueableFn.isAfterAll) {
|
||||||
|
runner.reporter.afterAllError(error);
|
||||||
|
}
|
||||||
|
self.onException(error);
|
||||||
next();
|
next();
|
||||||
}, queueableFn.timeout()]]);
|
}, queueableFn.timeout()]]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user