Fix spec in EnvSpec.js for specs that hang

This spec would hang when maximumSpecCallbackDepth was set to 1
[Fixes #54168730]
This commit is contained in:
Sheel Choksi
2013-09-02 20:07:17 -07:00
parent a442acb8aa
commit edb46a6f7c

View File

@@ -303,41 +303,22 @@ describe("Env integration", function() {
it("should not hang on async specs that forget to call done()", function(done) { it("should not hang on async specs that forget to call done()", function(done) {
var env = new j$.Env(), var env = new j$.Env(),
reporter = jasmine.createSpyObj('fakeReporter', [ reporter = jasmine.createSpyObj('fakeReporter', [ "specDone" ]);
"jasmineStarted",
"jasmineDone",
"suiteStarted",
"suiteDone",
"specStarted",
"specDone"
]);
env.addReporter(reporter); reporter.specDone.and.callFake(function() {
env.describe("tests", function() {
env.it("async spec that will hang", function(underTestCallback) {
env.expect(true).toBeTruthy();
});
env.it("after async spec", function() {
env.expect(true).toBeTruthy();
});
});
env.execute();
reporter.jasmineDone.and.callFake(function() {
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
totalSpecsDefined: 2
});
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({status: 'passed'}));
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({status: 'failed'})); expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({status: 'failed'}));
done(); done();
}); });
jasmine.getEnv().clock.tick(60001); env.addReporter(reporter);
env.it("async spec that will hang", function(underTestCallback) {
env.expect(true).toBeTruthy();
jasmine.getEnv().clock.tick(10000);
jasmine.getEnv().clock.tick(1); // trigger specDone callback
});
env.execute();
}); });
}); });