Fixed global error handler stack corruption in Jasmine's own tests
This commit is contained in:
@@ -1661,7 +1661,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
);
|
);
|
||||||
|
|
||||||
this.execute = function(runnablesToRun) {
|
// Both params are optional.
|
||||||
|
this.execute = function(runnablesToRun, onComplete) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
if (!runnablesToRun) {
|
if (!runnablesToRun) {
|
||||||
@@ -1769,7 +1770,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
failedExpectations: topSuite.result.failedExpectations,
|
failedExpectations: topSuite.result.failedExpectations,
|
||||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||||
},
|
},
|
||||||
function() {}
|
function() {
|
||||||
|
if (onComplete) {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -6917,6 +6922,8 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().QueueRunner = function(j$) {
|
getJasmineRequireObj().QueueRunner = function(j$) {
|
||||||
|
var nextid = 1;
|
||||||
|
|
||||||
function StopExecutionError() {}
|
function StopExecutionError() {}
|
||||||
StopExecutionError.prototype = new Error();
|
StopExecutionError.prototype = new Error();
|
||||||
j$.StopExecutionError = StopExecutionError;
|
j$.StopExecutionError = StopExecutionError;
|
||||||
@@ -6936,6 +6943,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
function emptyFn() {}
|
function emptyFn() {}
|
||||||
|
|
||||||
function QueueRunner(attrs) {
|
function QueueRunner(attrs) {
|
||||||
|
this.id_ = nextid++;
|
||||||
var queueableFns = attrs.queueableFns || [];
|
var queueableFns = attrs.queueableFns || [];
|
||||||
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
|
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
|
||||||
this.firstCleanupIx = queueableFns.length;
|
this.firstCleanupIx = queueableFns.length;
|
||||||
|
|||||||
+18
-26
@@ -334,20 +334,16 @@ describe('Env', function() {
|
|||||||
expectationFactory('actual', specInstance);
|
expectationFactory('actual', specInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({
|
env.execute(null, function() {
|
||||||
jasmineDone: function() {
|
expect(jasmineUnderTest.makePrettyPrinter).toHaveBeenCalledWith([
|
||||||
expect(jasmineUnderTest.makePrettyPrinter).toHaveBeenCalledWith([
|
customObjectFormatter
|
||||||
customObjectFormatter
|
]);
|
||||||
]);
|
expect(jasmineUnderTest.MatchersUtil).toHaveBeenCalledWith({
|
||||||
expect(jasmineUnderTest.MatchersUtil).toHaveBeenCalledWith({
|
customTesters: [customEqualityTester],
|
||||||
customTesters: [customEqualityTester],
|
pp: prettyPrinter
|
||||||
pp: prettyPrinter
|
});
|
||||||
});
|
done();
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates an asyncExpectationFactory that uses the current custom equality testers and object formatters', function(done) {
|
it('creates an asyncExpectationFactory that uses the current custom equality testers and object formatters', function(done) {
|
||||||
@@ -371,19 +367,15 @@ describe('Env', function() {
|
|||||||
asyncExpectationFactory('actual', specInstance);
|
asyncExpectationFactory('actual', specInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({
|
env.execute(null, function() {
|
||||||
jasmineDone: function() {
|
expect(jasmineUnderTest.makePrettyPrinter).toHaveBeenCalledWith([
|
||||||
expect(jasmineUnderTest.makePrettyPrinter).toHaveBeenCalledWith([
|
customObjectFormatter
|
||||||
customObjectFormatter
|
]);
|
||||||
]);
|
expect(jasmineUnderTest.MatchersUtil).toHaveBeenCalledWith({
|
||||||
expect(jasmineUnderTest.MatchersUtil).toHaveBeenCalledWith({
|
customTesters: [customEqualityTester],
|
||||||
customTesters: [customEqualityTester],
|
pp: prettyPrinter
|
||||||
pp: prettyPrinter
|
});
|
||||||
});
|
done();
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ describe('Exceptions:', function() {
|
|||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: expectations });
|
env.execute(null, expectations);
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle exceptions thrown directly in top-level describe blocks and continue', function(done) {
|
it('should handle exceptions thrown directly in top-level describe blocks and continue', function(done) {
|
||||||
@@ -49,7 +48,6 @@ describe('Exceptions:', function() {
|
|||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: expectations });
|
env.execute(null, expectations);
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ describe('Asymmetric equality testers (Integration)', function () {
|
|||||||
.toBeUndefined();
|
.toBeUndefined();
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
env.addReporter({specDone: specExpectations});
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ describe('Asymmetric equality testers (Integration)', function () {
|
|||||||
.not.toEqual('');
|
.not.toEqual('');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
env.addReporter({specDone: specExpectations});
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ describe('Custom Async Matchers (Integration)', function() {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the negative compare function for a negative comparison, if provided', function(done) {
|
it('uses the negative compare function for a negative comparison, if provided', function(done) {
|
||||||
@@ -52,8 +52,8 @@ describe('Custom Async Matchers (Integration)', function() {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('generates messages with the same rules as built in matchers absent a custom message', function(done) {
|
it('generates messages with the same rules as built in matchers absent a custom message', function(done) {
|
||||||
@@ -77,8 +77,8 @@ describe('Custom Async Matchers (Integration)', function() {
|
|||||||
expect(result.failedExpectations[0].message).toEqual("Expected 'a' to be real.");
|
expect(result.failedExpectations[0].message).toEqual("Expected 'a' to be real.");
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: remove this in the next major release.
|
// TODO: remove this in the next major release.
|
||||||
@@ -113,8 +113,8 @@ describe('Custom Async Matchers (Integration)', function() {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides custom equality testers to the matcher factory via matchersUtil", function(done) {
|
it("provides custom equality testers to the matcher factory via matchersUtil", function(done) {
|
||||||
@@ -145,7 +145,7 @@ describe('Custom Async Matchers (Integration)', function() {
|
|||||||
expect(result.failedExpectations).toEqual([]);
|
expect(result.failedExpectations).toEqual([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(firstSpecResult.failedExpectations[0].message).toEqual("matcherForSpec: actual: zzz; expected: yyy");
|
expect(firstSpecResult.failedExpectations[0].message).toEqual("matcherForSpec: actual: zzz; expected: yyy");
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
env.addReporter({ specDone:specDoneSpy, jasmineDone: expectations});
|
env.addReporter({ specDone:specDoneSpy });
|
||||||
|
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes the spec if the custom matcher passes", function(done) {
|
it("passes the spec if the custom matcher passes", function(done) {
|
||||||
@@ -57,8 +57,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes the spec if the custom equality matcher passes for types nested inside asymmetric equality testers", function(done) {
|
it("passes the spec if the custom equality matcher passes for types nested inside asymmetric equality testers", function(done) {
|
||||||
@@ -81,8 +81,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("supports asymmetric equality testers that take a list of custom equality testers", function(done) {
|
it("supports asymmetric equality testers that take a list of custom equality testers", function(done) {
|
||||||
@@ -111,8 +111,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("displays an appropriate failure message if a custom equality matcher fails", function(done) {
|
it("displays an appropriate failure message if a custom equality matcher fails", function(done) {
|
||||||
@@ -135,8 +135,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses the negative compare function for a negative comparison, if provided", function(done) {
|
it("uses the negative compare function for a negative comparison, if provided", function(done) {
|
||||||
@@ -157,8 +157,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.status).toEqual('passed');
|
expect(result.status).toEqual('passed');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("generates messages with the same rules as built in matchers absent a custom message", function(done) {
|
it("generates messages with the same rules as built in matchers absent a custom message", function(done) {
|
||||||
@@ -180,8 +180,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.failedExpectations[0].message).toEqual("Expected 'a' to be real.");
|
expect(result.failedExpectations[0].message).toEqual("Expected 'a' to be real.");
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes the expected and actual arguments to the comparison function", function(done) {
|
it("passes the expected and actual arguments to the comparison function", function(done) {
|
||||||
@@ -205,8 +205,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(argumentSpy).toHaveBeenCalledWith(true, "arg1", "arg2");
|
expect(argumentSpy).toHaveBeenCalledWith(true, "arg1", "arg2");
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: remove this in the next major release.
|
// TODO: remove this in the next major release.
|
||||||
@@ -232,8 +232,8 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides custom equality testers to the matcher factory via matchersUtil", function (done) {
|
it("provides custom equality testers to the matcher factory via matchersUtil", function (done) {
|
||||||
@@ -262,7 +262,7 @@ describe("Custom Matchers (Integration)", function () {
|
|||||||
expect(result.failedExpectations).toEqual([]);
|
expect(result.failedExpectations).toEqual([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
env.addReporter({specDone: specExpectations});
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ describe("Custom object formatters", function() {
|
|||||||
expect(specResults[1].failedExpectations[0].message).toEqual("Expected 42 to be undefined.");
|
expect(specResults[1].failedExpectations[0].message).toEqual("Expected 42 to be undefined.");
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
env.addReporter({ specDone:specDone, jasmineDone: expectations});
|
env.addReporter({ specDone:specDone });
|
||||||
|
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("scopes custom object formatters to a suite", function(done) {
|
it("scopes custom object formatters to a suite", function(done) {
|
||||||
@@ -54,9 +54,9 @@ describe("Custom object formatters", function() {
|
|||||||
expect(specResults[1].failedExpectations[0].message).toEqual("Expected custom(42) to be undefined.");
|
expect(specResults[1].failedExpectations[0].message).toEqual("Expected custom(42) to be undefined.");
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
env.addReporter({ specDone:specDone, jasmineDone: expectations});
|
env.addReporter({ specDone:specDone });
|
||||||
|
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws an exception if you try to add a custom object formatter outside a runable", function() {
|
it("throws an exception if you try to add a custom object formatter outside a runable", function() {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
.and.returnValue(42);
|
.and.returnValue(42);
|
||||||
var strategy = jasmine.createSpy('custom strategy')
|
var strategy = jasmine.createSpy('custom strategy')
|
||||||
.and.returnValue(plan);
|
.and.returnValue(plan);
|
||||||
|
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
|
|
||||||
env.describe('suite defining a custom spy strategy', function() {
|
env.describe('suite defining a custom spy strategy', function() {
|
||||||
env.beforeEach(function() {
|
env.beforeEach(function() {
|
||||||
@@ -33,13 +34,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: jasmineDone });
|
env.addReporter({ jasmineDone: jasmineDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows adding more strategies local to a spec', function(done) {
|
it('allows adding more strategies local to a spec', function(done) {
|
||||||
@@ -47,6 +49,7 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
.and.returnValue(42);
|
.and.returnValue(42);
|
||||||
var strategy = jasmine.createSpy('custom strategy')
|
var strategy = jasmine.createSpy('custom strategy')
|
||||||
.and.returnValue(plan);
|
.and.returnValue(plan);
|
||||||
|
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
|
|
||||||
env.it('spec defining a custom spy strategy', function() {
|
env.it('spec defining a custom spy strategy', function() {
|
||||||
env.addSpyStrategy('frobnicate', strategy);
|
env.addSpyStrategy('frobnicate', strategy);
|
||||||
@@ -60,13 +63,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: jasmineDone });
|
env.addReporter({ jasmineDone: jasmineDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows using custom strategies on a per-argument basis', function(done) {
|
it('allows using custom strategies on a per-argument basis', function(done) {
|
||||||
@@ -74,6 +78,7 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
.and.returnValue(42);
|
.and.returnValue(42);
|
||||||
var strategy = jasmine.createSpy('custom strategy')
|
var strategy = jasmine.createSpy('custom strategy')
|
||||||
.and.returnValue(plan);
|
.and.returnValue(plan);
|
||||||
|
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
|
|
||||||
env.it('spec defining a custom spy strategy', function() {
|
env.it('spec defining a custom spy strategy', function() {
|
||||||
env.addSpyStrategy('frobnicate', strategy);
|
env.addSpyStrategy('frobnicate', strategy);
|
||||||
@@ -91,13 +96,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: jasmineDone });
|
env.addReporter({ jasmineDone: jasmineDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple custom strategies to be used', function(done) {
|
it('allows multiple custom strategies to be used', function(done) {
|
||||||
@@ -105,7 +111,9 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
strategy1 = jasmine.createSpy('strat 1').and.returnValue(plan1),
|
strategy1 = jasmine.createSpy('strat 1').and.returnValue(plan1),
|
||||||
plan2 = jasmine.createSpy('plan 2').and.returnValue(24),
|
plan2 = jasmine.createSpy('plan 2').and.returnValue(24),
|
||||||
strategy2 = jasmine.createSpy('strat 2').and.returnValue(plan2),
|
strategy2 = jasmine.createSpy('strat 2').and.returnValue(plan2),
|
||||||
specDone = jasmine.createSpy('specDone');
|
specDone = jasmine.createSpy('specDone'),
|
||||||
|
jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
|
|
||||||
|
|
||||||
env.beforeEach(function() {
|
env.beforeEach(function() {
|
||||||
env.addSpyStrategy('frobnicate', strategy1);
|
env.addSpyStrategy('frobnicate', strategy1);
|
||||||
@@ -130,13 +138,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
expect(plan2).toHaveBeenCalled();
|
expect(plan2).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
expect(specDone.calls.count()).toBe(2);
|
expect(specDone.calls.count()).toBe(2);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: jasmineDone, specDone: specDone });
|
env.addReporter({ jasmineDone: jasmineDone, specDone: specDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,13 +29,15 @@ describe('Default Spy Strategy (Integration)', function() {
|
|||||||
expect(spy()).toBeUndefined();
|
expect(spy()).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
env.addReporter({ jasmineDone: jasmineDone });
|
env.addReporter({ jasmineDone: jasmineDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the default spy strategy defined when the spy is created', function (done) {
|
it('uses the default spy strategy defined when the spy is created', function (done) {
|
||||||
@@ -61,12 +63,14 @@ describe('Default Spy Strategy (Integration)', function() {
|
|||||||
expect(d.and.isConfigured()).toBe(false);
|
expect(d.and.isConfigured()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
function jasmineDone(result) {
|
function expectations() {
|
||||||
|
var result = jasmineDone.calls.argsFor(0)[0];
|
||||||
expect(result.overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||||
env.addReporter({ jasmineDone: jasmineDone });
|
env.addReporter({ jasmineDone: jasmineDone });
|
||||||
env.execute();
|
env.execute(null, expectations);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+658
-729
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.toBeUndefined();
|
.toBeUndefined();
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.not.toEqual('');
|
.not.toEqual('');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,8 +75,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.toEqual(config.expectedMessage);
|
.toEqual(config.expectedMessage);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +101,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.toBeUndefined();
|
.toBeUndefined();
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,8 +126,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.not.toEqual('');
|
.not.toEqual('');
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,8 +149,8 @@ describe('Matchers (Integration)', function() {
|
|||||||
.toEqual(config.expectedMessage);
|
.toEqual(config.expectedMessage);
|
||||||
};
|
};
|
||||||
|
|
||||||
env.addReporter({specDone: specExpectations, jasmineDone: done});
|
env.addReporter({ specDone: specExpectations });
|
||||||
env.execute();
|
env.execute(null, done);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,17 +66,14 @@ describe("spec running", function () {
|
|||||||
expect(bar).toEqual(0);
|
expect(bar).toEqual(0);
|
||||||
expect(baz).toEqual(0);
|
expect(baz).toEqual(0);
|
||||||
expect(quux).toEqual(0);
|
expect(quux).toEqual(0);
|
||||||
var assertions = function() {
|
|
||||||
|
env.execute(null, function() {
|
||||||
expect(foo).toEqual(1);
|
expect(foo).toEqual(1);
|
||||||
expect(bar).toEqual(1);
|
expect(bar).toEqual(1);
|
||||||
expect(baz).toEqual(1);
|
expect(baz).toEqual(1);
|
||||||
expect(quux).toEqual(1);
|
expect(quux).toEqual(1);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: assertions });
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should permit nested describes", function(done) {
|
it("should permit nested describes", function(done) {
|
||||||
@@ -136,7 +133,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
"topSuite beforeEach",
|
"topSuite beforeEach",
|
||||||
"outer beforeEach",
|
"outer beforeEach",
|
||||||
@@ -168,11 +165,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should run multiple befores and afters ordered so functions declared later are treated as more specific", function(done) {
|
it("should run multiple befores and afters ordered so functions declared later are treated as more specific", function(done) {
|
||||||
@@ -232,7 +225,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
"runner beforeAll1",
|
"runner beforeAll1",
|
||||||
"runner beforeAll2",
|
"runner beforeAll2",
|
||||||
@@ -250,11 +243,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run beforeAlls before beforeEachs and afterAlls after afterEachs', function(done) {
|
it('should run beforeAlls before beforeEachs and afterAlls after afterEachs', function(done) {
|
||||||
@@ -298,7 +287,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
"runner beforeAll",
|
"runner beforeAll",
|
||||||
"inner beforeAll",
|
"inner beforeAll",
|
||||||
@@ -312,10 +301,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run beforeAlls and afterAlls in the order declared when runnablesToRun is provided', function(done) {
|
it('should run beforeAlls and afterAlls in the order declared when runnablesToRun is provided', function(done) {
|
||||||
@@ -365,7 +351,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute([spec2.id, spec.id], function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
"runner beforeAll",
|
"runner beforeAll",
|
||||||
"inner beforeAll",
|
"inner beforeAll",
|
||||||
@@ -385,10 +371,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute([spec2.id, spec.id]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('only runs *Alls once in a focused suite', function(done){
|
it('only runs *Alls once in a focused suite', function(done){
|
||||||
@@ -406,13 +389,10 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['beforeAll', 'spec', 'afterAll']);
|
expect(actions).toEqual(['beforeAll', 'spec', 'afterAll']);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('focused runnables', function() {
|
describe('focused runnables', function() {
|
||||||
@@ -435,7 +415,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
'beforeAll',
|
'beforeAll',
|
||||||
'beforeEach',
|
'beforeEach',
|
||||||
@@ -449,10 +429,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('focused specs in focused suites cause non-focused siblings to not run', function(done){
|
it('focused specs in focused suites cause non-focused siblings to not run', function(done){
|
||||||
@@ -467,14 +444,11 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = ['focused spec'];
|
var expected = ['focused spec'];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('focused suites in focused suites cause non-focused siblings to not run', function(done){
|
it('focused suites in focused suites cause non-focused siblings to not run', function(done){
|
||||||
@@ -491,14 +465,11 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = ['inner spec'];
|
var expected = ['inner spec'];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('focused runnables unfocus ancestor focused suites', function(done) {
|
it('focused runnables unfocus ancestor focused suites', function(done) {
|
||||||
@@ -515,14 +486,11 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = ['focused spec'];
|
var expected = ['focused spec'];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -534,14 +502,10 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(specInADisabledSuite).not.toHaveBeenCalled();
|
expect(specInADisabledSuite).not.toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shouldn't run before/after functions in disabled suites", function(done) {
|
it("shouldn't run before/after functions in disabled suites", function(done) {
|
||||||
@@ -556,14 +520,10 @@ describe("spec running", function () {
|
|||||||
env.it('spec inside a disabled suite', shouldNotRun);
|
env.it('spec inside a disabled suite', shouldNotRun);
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(shouldNotRun).not.toHaveBeenCalled();
|
expect(shouldNotRun).not.toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should allow top level suites to be disabled", function(done) {
|
it("should allow top level suites to be disabled", function(done) {
|
||||||
@@ -577,15 +537,11 @@ describe("spec running", function () {
|
|||||||
env.it('another spec', otherSpec);
|
env.it('another spec', otherSpec);
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(specInADisabledSuite).not.toHaveBeenCalled();
|
expect(specInADisabledSuite).not.toHaveBeenCalled();
|
||||||
expect(otherSpec).toHaveBeenCalled();
|
expect(otherSpec).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should set all pending specs to pending when a suite is run", function(done) {
|
it("should set all pending specs to pending when a suite is run", function(done) {
|
||||||
@@ -594,31 +550,20 @@ describe("spec running", function () {
|
|||||||
pendingSpec = env.it("I am a pending spec");
|
pendingSpec = env.it("I am a pending spec");
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(pendingSpec.status()).toBe("pending");
|
expect(pendingSpec.status()).toBe("pending");
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should recover gracefully when there are errors in describe functions", function(done) {
|
it("should recover gracefully when there are errors in describe functions", function(done) {
|
||||||
var specs = [],
|
var specs = [],
|
||||||
reporter = jasmine.createSpyObj(['specDone', 'suiteDone', 'jasmineDone']);
|
reporter = jasmine.createSpyObj(['specDone', 'suiteDone']);
|
||||||
|
|
||||||
reporter.specDone.and.callFake(function(result) {
|
reporter.specDone.and.callFake(function(result) {
|
||||||
specs.push(result.fullName);
|
specs.push(result.fullName);
|
||||||
});
|
});
|
||||||
|
|
||||||
reporter.jasmineDone.and.callFake(function() {
|
|
||||||
expect(specs).toEqual(['outer1 inner1 should thingy', 'outer1 inner2 should other thingy', 'outer2 should xxx']);
|
|
||||||
expect(reporter.suiteDone).toHaveFailedExpectationsForRunnable('outer1 inner1', [/inner error/]);
|
|
||||||
expect(reporter.suiteDone).toHaveFailedExpectationsForRunnable('outer1', [/outer error/]);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
env.describe("outer1", function() {
|
env.describe("outer1", function() {
|
||||||
env.describe("inner1", function() {
|
env.describe("inner1", function() {
|
||||||
@@ -647,7 +592,12 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter(reporter);
|
env.addReporter(reporter);
|
||||||
env.execute();
|
env.execute(null, function() {
|
||||||
|
expect(specs).toEqual(['outer1 inner1 should thingy', 'outer1 inner2 should other thingy', 'outer2 should xxx']);
|
||||||
|
expect(reporter.suiteDone).toHaveFailedExpectationsForRunnable('outer1 inner1', [/inner error/]);
|
||||||
|
expect(reporter.suiteDone).toHaveFailedExpectationsForRunnable('outer1', [/outer error/]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("re-enters suites that have no *Alls", function(done) {
|
it("re-enters suites that have no *Alls", function(done) {
|
||||||
@@ -668,14 +618,10 @@ describe("spec running", function () {
|
|||||||
actions.push("spec3");
|
actions.push("spec3");
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({
|
env.execute([spec2.id, spec3.id, spec1.id], function() {
|
||||||
jasmineDone: function() {
|
expect(actions).toEqual(["spec2", "spec3", "spec1"]);
|
||||||
expect(actions).toEqual(["spec2", "spec3", "spec1"]);
|
done();
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
env.execute([spec2.id, spec3.id, spec1.id]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("refuses to re-enter suites with a beforeAll", function() {
|
it("refuses to re-enter suites with a beforeAll", function() {
|
||||||
@@ -698,16 +644,10 @@ describe("spec running", function () {
|
|||||||
actions.push("spec3");
|
actions.push("spec3");
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({
|
|
||||||
jasmineDone: function() {
|
|
||||||
expect(actions).toEqual([]);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
env.execute([spec2.id, spec3.id, spec1.id]);
|
env.execute([spec2.id, spec3.id, spec1.id]);
|
||||||
}).toThrowError(/beforeAll/);
|
}).toThrowError(/beforeAll/);
|
||||||
|
expect(actions).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("refuses to re-enter suites with a afterAll", function() {
|
it("refuses to re-enter suites with a afterAll", function() {
|
||||||
@@ -730,16 +670,10 @@ describe("spec running", function () {
|
|||||||
actions.push("spec3");
|
actions.push("spec3");
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({
|
|
||||||
jasmineDone: function() {
|
|
||||||
expect(actions).toEqual([]);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
env.execute([spec2.id, spec3.id, spec1.id]);
|
env.execute([spec2.id, spec3.id, spec1.id]);
|
||||||
}).toThrowError(/afterAll/);
|
}).toThrowError(/afterAll/);
|
||||||
|
expect(actions).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should run the tests in a consistent order when a seed is supplied", function(done) {
|
it("should run the tests in a consistent order when a seed is supplied", function(done) {
|
||||||
@@ -800,7 +734,7 @@ describe("spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
'topSuite beforeEach',
|
'topSuite beforeEach',
|
||||||
'outer beforeEach',
|
'outer beforeEach',
|
||||||
@@ -832,11 +766,7 @@ describe("spec running", function () {
|
|||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("When throwOnExpectationFailure is set", function() {
|
describe("When throwOnExpectationFailure is set", function() {
|
||||||
@@ -870,18 +800,14 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.configure({oneFailurePerSpec: true});
|
env.configure({oneFailurePerSpec: true});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'outer beforeEach',
|
'outer beforeEach',
|
||||||
'inner afterEach',
|
'inner afterEach',
|
||||||
'outer afterEach'
|
'outer afterEach'
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips to cleanup functions after done.fail is called", function(done) {
|
it("skips to cleanup functions after done.fail is called", function(done) {
|
||||||
@@ -905,17 +831,13 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.configure({oneFailurePerSpec: true});
|
env.configure({oneFailurePerSpec: true});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'beforeEach',
|
'beforeEach',
|
||||||
'afterEach'
|
'afterEach'
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips to cleanup functions when an async function times out", function(done) {
|
it("skips to cleanup functions when an async function times out", function(done) {
|
||||||
@@ -937,17 +859,13 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.configure({oneFailurePerSpec: true});
|
env.configure({oneFailurePerSpec: true});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'beforeEach',
|
'beforeEach',
|
||||||
'afterEach'
|
'afterEach'
|
||||||
]);
|
]);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips to cleanup functions after an error with deprecations", function(done) {
|
it("skips to cleanup functions after an error with deprecations", function(done) {
|
||||||
@@ -982,7 +900,7 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.throwOnExpectationFailure(true);
|
env.throwOnExpectationFailure(true);
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'outer beforeEach',
|
'outer beforeEach',
|
||||||
'inner afterEach',
|
'inner afterEach',
|
||||||
@@ -990,11 +908,7 @@ describe("spec running", function () {
|
|||||||
]);
|
]);
|
||||||
expect(env.deprecated).toHaveBeenCalled();
|
expect(env.deprecated).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips to cleanup functions after done.fail is called with deprecations", function(done) {
|
it("skips to cleanup functions after done.fail is called with deprecations", function(done) {
|
||||||
@@ -1020,18 +934,14 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.throwOnExpectationFailure(true);
|
env.throwOnExpectationFailure(true);
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'beforeEach',
|
'beforeEach',
|
||||||
'afterEach'
|
'afterEach'
|
||||||
]);
|
]);
|
||||||
expect(env.deprecated).toHaveBeenCalled();
|
expect(env.deprecated).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips to cleanup functions when an async function times out with deprecations", function(done) {
|
it("skips to cleanup functions when an async function times out with deprecations", function(done) {
|
||||||
@@ -1055,18 +965,14 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.throwOnExpectationFailure(true);
|
env.throwOnExpectationFailure(true);
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
'beforeEach',
|
'beforeEach',
|
||||||
'afterEach'
|
'afterEach'
|
||||||
]);
|
]);
|
||||||
expect(env.deprecated).toHaveBeenCalled();
|
expect(env.deprecated).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({jasmineDone: assertions});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1089,13 +995,10 @@ describe("spec running", function () {
|
|||||||
|
|
||||||
env.configure({random: false, failFast: true});
|
env.configure({random: false, failFast: true});
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['fails']);
|
expect(actions).toEqual(['fails']);
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: assertions });
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not run further specs when one fails when configured with deprecated option", function(done) {
|
it("does not run further specs when one fails when configured with deprecated option", function(done) {
|
||||||
@@ -1119,14 +1022,11 @@ describe("spec running", function () {
|
|||||||
env.configure({random: false});
|
env.configure({random: false});
|
||||||
env.stopOnSpecFailure(true);
|
env.stopOnSpecFailure(true);
|
||||||
|
|
||||||
var assertions = function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['fails']);
|
expect(actions).toEqual(['fails']);
|
||||||
expect(env.deprecated).toHaveBeenCalled();
|
expect(env.deprecated).toHaveBeenCalled();
|
||||||
done();
|
done();
|
||||||
};
|
});
|
||||||
|
|
||||||
env.addReporter({ jasmineDone: assertions });
|
|
||||||
env.execute();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+7
-2
@@ -705,7 +705,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
queueRunnerFactory
|
queueRunnerFactory
|
||||||
);
|
);
|
||||||
|
|
||||||
this.execute = function(runnablesToRun) {
|
// Both params are optional.
|
||||||
|
this.execute = function(runnablesToRun, onComplete) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
if (!runnablesToRun) {
|
if (!runnablesToRun) {
|
||||||
@@ -813,7 +814,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
failedExpectations: topSuite.result.failedExpectations,
|
failedExpectations: topSuite.result.failedExpectations,
|
||||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||||
},
|
},
|
||||||
function() {}
|
function() {
|
||||||
|
if (onComplete) {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
getJasmineRequireObj().QueueRunner = function(j$) {
|
getJasmineRequireObj().QueueRunner = function(j$) {
|
||||||
|
var nextid = 1;
|
||||||
|
|
||||||
function StopExecutionError() {}
|
function StopExecutionError() {}
|
||||||
StopExecutionError.prototype = new Error();
|
StopExecutionError.prototype = new Error();
|
||||||
j$.StopExecutionError = StopExecutionError;
|
j$.StopExecutionError = StopExecutionError;
|
||||||
@@ -18,6 +20,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
function emptyFn() {}
|
function emptyFn() {}
|
||||||
|
|
||||||
function QueueRunner(attrs) {
|
function QueueRunner(attrs) {
|
||||||
|
this.id_ = nextid++;
|
||||||
var queueableFns = attrs.queueableFns || [];
|
var queueableFns = attrs.queueableFns || [];
|
||||||
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
|
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
|
||||||
this.firstCleanupIx = queueableFns.length;
|
this.firstCleanupIx = queueableFns.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user