Fixed global error handler stack corruption in Jasmine's own tests
This commit is contained in:
@@ -15,6 +15,7 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
.and.returnValue(42);
|
||||
var strategy = jasmine.createSpy('custom strategy')
|
||||
.and.returnValue(plan);
|
||||
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||
|
||||
env.describe('suite defining a custom spy strategy', function() {
|
||||
env.beforeEach(function() {
|
||||
@@ -33,13 +34,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||
});
|
||||
|
||||
function jasmineDone(result) {
|
||||
function expectations() {
|
||||
var result = jasmineDone.calls.argsFor(0)[0];
|
||||
expect(result.overallStatus).toEqual('passed');
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({ jasmineDone: jasmineDone });
|
||||
env.execute();
|
||||
env.execute(null, expectations);
|
||||
});
|
||||
|
||||
it('allows adding more strategies local to a spec', function(done) {
|
||||
@@ -47,6 +49,7 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
.and.returnValue(42);
|
||||
var strategy = jasmine.createSpy('custom strategy')
|
||||
.and.returnValue(plan);
|
||||
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||
|
||||
env.it('spec defining a custom spy strategy', function() {
|
||||
env.addSpyStrategy('frobnicate', strategy);
|
||||
@@ -60,13 +63,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||
});
|
||||
|
||||
function jasmineDone(result) {
|
||||
function expectations() {
|
||||
var result = jasmineDone.calls.argsFor(0)[0];
|
||||
expect(result.overallStatus).toEqual('passed');
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({ jasmineDone: jasmineDone });
|
||||
env.execute();
|
||||
env.execute(null, expectations);
|
||||
});
|
||||
|
||||
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);
|
||||
var strategy = jasmine.createSpy('custom strategy')
|
||||
.and.returnValue(plan);
|
||||
var jasmineDone = jasmine.createSpy('jasmineDone');
|
||||
|
||||
env.it('spec defining a custom spy strategy', function() {
|
||||
env.addSpyStrategy('frobnicate', strategy);
|
||||
@@ -91,13 +96,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||
});
|
||||
|
||||
function jasmineDone(result) {
|
||||
function expectations() {
|
||||
var result = jasmineDone.calls.argsFor(0)[0];
|
||||
expect(result.overallStatus).toEqual('passed');
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({ jasmineDone: jasmineDone });
|
||||
env.execute();
|
||||
env.execute(null, expectations);
|
||||
});
|
||||
|
||||
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),
|
||||
plan2 = jasmine.createSpy('plan 2').and.returnValue(24),
|
||||
strategy2 = jasmine.createSpy('strat 2').and.returnValue(plan2),
|
||||
specDone = jasmine.createSpy('specDone');
|
||||
specDone = jasmine.createSpy('specDone'),
|
||||
jasmineDone = jasmine.createSpy('jasmineDone');
|
||||
|
||||
|
||||
env.beforeEach(function() {
|
||||
env.addSpyStrategy('frobnicate', strategy1);
|
||||
@@ -130,13 +138,14 @@ describe('Custom Spy Strategies (Integration)', function() {
|
||||
expect(plan2).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
function jasmineDone(result) {
|
||||
function expectations() {
|
||||
var result = jasmineDone.calls.argsFor(0)[0];
|
||||
expect(result.overallStatus).toEqual('passed');
|
||||
expect(specDone.calls.count()).toBe(2);
|
||||
done();
|
||||
}
|
||||
|
||||
env.addReporter({ jasmineDone: jasmineDone, specDone: specDone });
|
||||
env.execute();
|
||||
env.execute(null, expectations);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user