feat(result.duration): report test duration in ms
Wrap spec start/complete in Timer start/elapsed. configuration.timeSpecDuration = false will disable feature. * Add Suite result.duration, elapsed time in ms * Remove timeSpecDuration option. * Respond to review, use noopTimer
This commit is contained in:
@@ -207,7 +207,8 @@ describe("Spec", function() {
|
||||
failedExpectations: [],
|
||||
passedExpectations: [],
|
||||
deprecationWarnings: [],
|
||||
pendingReason: ''
|
||||
pendingReason: '',
|
||||
duration: null,
|
||||
}, 'things');
|
||||
});
|
||||
|
||||
@@ -242,6 +243,22 @@ describe("Spec", function() {
|
||||
expect(done).toHaveBeenCalledWith(jasmine.any(jasmineUnderTest.StopExecutionError));
|
||||
});
|
||||
|
||||
it("should report the duration of the test", function() {
|
||||
var done = jasmine.createSpy('done callback'),
|
||||
timer = jasmine.createSpyObj('timer', {'start': null, elapsed: 77000}),
|
||||
spec = new jasmineUnderTest.Spec({
|
||||
queueableFn: { fn: jasmine.createSpy("spec body")},
|
||||
catchExceptions: function() { return false; },
|
||||
resultCallback: function() {},
|
||||
queueRunnerFactory: function(attrs) {
|
||||
attrs.onComplete();
|
||||
},
|
||||
timer: timer,
|
||||
});
|
||||
spec.execute(done);
|
||||
expect(spec.result.duration).toBe(77000);
|
||||
});
|
||||
|
||||
it("#status returns passing by default", function() {
|
||||
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
||||
expect(spec.status()).toBe('passed');
|
||||
|
||||
Reference in New Issue
Block a user