Revert "Added the ability to associate trace information with failing specs"
Pushing this back to 4.0 in hopes of increasing the chance that third
party reporters will notice it and add support.
This reverts commit 7a289f1de7.
This commit is contained in:
@@ -228,8 +228,7 @@ describe('Spec', function() {
|
||||
deprecationWarnings: [],
|
||||
pendingReason: '',
|
||||
duration: jasmine.any(Number),
|
||||
properties: null,
|
||||
trace: null
|
||||
properties: null
|
||||
},
|
||||
'things'
|
||||
);
|
||||
@@ -517,110 +516,4 @@ describe('Spec', function() {
|
||||
args.cleanupFns[0].fn();
|
||||
expect(resultCallback.calls.first().args[0].failedExpectations).toEqual([]);
|
||||
});
|
||||
|
||||
describe('#trace', function() {
|
||||
it('adds the messages to the result', function() {
|
||||
var timer = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: {
|
||||
fn: function() {}
|
||||
},
|
||||
queueRunnerFactory: function() {},
|
||||
timer: timer
|
||||
}),
|
||||
t1 = 123,
|
||||
t2 = 456;
|
||||
|
||||
spec.execute();
|
||||
expect(spec.result.trace).toBeNull();
|
||||
timer.elapsed.and.returnValue(t1);
|
||||
spec.trace('msg 1');
|
||||
expect(spec.result.trace).toEqual([{ message: 'msg 1', timestamp: t1 }]);
|
||||
timer.elapsed.and.returnValue(t2);
|
||||
spec.trace('msg 2');
|
||||
expect(spec.result.trace).toEqual([
|
||||
{ message: 'msg 1', timestamp: t1 },
|
||||
{ message: 'msg 2', timestamp: t2 }
|
||||
]);
|
||||
});
|
||||
|
||||
describe('When the spec passes', function() {
|
||||
it('omits the messages from the reported result', function() {
|
||||
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: {
|
||||
fn: function() {}
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
config.cleanupFns.forEach(function(fn) {
|
||||
fn.fn();
|
||||
});
|
||||
config.onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({ trace: null }),
|
||||
undefined
|
||||
);
|
||||
});
|
||||
|
||||
it('removes the messages to save memory', function() {
|
||||
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: {
|
||||
fn: function() {}
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
config.cleanupFns.forEach(function(fn) {
|
||||
fn.fn();
|
||||
});
|
||||
config.onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalled();
|
||||
expect(spec.result.trace).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the spec fails', function() {
|
||||
it('includes the messages in the reported result', function() {
|
||||
var resultCallback = jasmine.createSpy('resultCallback'),
|
||||
timer = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: {
|
||||
fn: function() {}
|
||||
},
|
||||
resultCallback: resultCallback,
|
||||
queueRunnerFactory: function(config) {
|
||||
spec.trace('msg');
|
||||
spec.onException(new Error('nope'));
|
||||
config.cleanupFns.forEach(function(fn) {
|
||||
fn.fn();
|
||||
});
|
||||
config.onComplete(true);
|
||||
},
|
||||
timer: timer
|
||||
}),
|
||||
timestamp = 12345;
|
||||
|
||||
timer.elapsed.and.returnValue(timestamp);
|
||||
|
||||
spec.execute(function() {});
|
||||
expect(resultCallback).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
trace: [{ message: 'msg', timestamp: timestamp }]
|
||||
}),
|
||||
undefined
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user