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:
@@ -293,52 +293,33 @@ describe("Env integration", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("with a mock clock", function() {
|
describe("with a mock clock", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
jasmine.getEnv().clock.install();
|
jasmine.getEnv().clock.install();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
jasmine.getEnv().clock.uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not hang on async specs that forget to call done()", function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone" ]);
|
||||||
|
|
||||||
|
reporter.specDone.and.callFake(function() {
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({status: 'failed'}));
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
env.addReporter(reporter);
|
||||||
jasmine.getEnv().clock.uninstall();
|
|
||||||
|
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
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not hang on async specs that forget to call done()", function(done) {
|
env.execute();
|
||||||
var env = new j$.Env(),
|
});
|
||||||
reporter = jasmine.createSpyObj('fakeReporter', [
|
|
||||||
"jasmineStarted",
|
|
||||||
"jasmineDone",
|
|
||||||
"suiteStarted",
|
|
||||||
"suiteDone",
|
|
||||||
"specStarted",
|
|
||||||
"specDone"
|
|
||||||
]);
|
|
||||||
|
|
||||||
env.addReporter(reporter);
|
|
||||||
|
|
||||||
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'}));
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
jasmine.getEnv().clock.tick(60001);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: something is wrong with this spec
|
// TODO: something is wrong with this spec
|
||||||
|
|||||||
Reference in New Issue
Block a user