Remove Env's calculation of executionTime

[#45659879]
This commit is contained in:
Sheel Choksi
2013-07-03 14:12:19 -07:00
parent 179e54b9fb
commit 34b8bf5fb0
3 changed files with 6 additions and 21 deletions

View File

@@ -308,8 +308,7 @@ getJasmineRequireObj().Env = function(j$) {
function Env(options) { function Env(options) {
options = options || {}; options = options || {};
var self = this; var self = this;
var global = options.global || j$.getGlobal(), var global = options.global || j$.getGlobal();
now = options.now || function() { return new Date().getTime(); };
var catchExceptions = true; var catchExceptions = true;
@@ -500,13 +499,10 @@ getJasmineRequireObj().Env = function(j$) {
}; };
this.execute = function() { this.execute = function() {
var startTime = now();
this.reporter.jasmineStarted({ this.reporter.jasmineStarted({
totalSpecsDefined: totalSpecsDefined totalSpecsDefined: totalSpecsDefined
}); });
this.topSuite.execute(function() { this.topSuite.execute(self.reporter.jasmineDone);
self.reporter.jasmineDone({executionTime: now() - startTime});
});
}; };
} }

View File

@@ -191,9 +191,7 @@ describe("Env integration", function() {
// TODO: something is wrong with this spec // TODO: something is wrong with this spec
it("should report as expected", function(done) { it("should report as expected", function(done) {
var fakeNow = jasmine.createSpy('fake Date.now'), var reporter = jasmine.createSpyObj('fakeReporter', [
env = new j$.Env({now: fakeNow}),
reporter = jasmine.createSpyObj('fakeReporter', [
"jasmineStarted", "jasmineStarted",
"jasmineDone", "jasmineDone",
"suiteStarted", "suiteStarted",
@@ -208,16 +206,11 @@ describe("Env integration", function() {
}); });
var suiteResult = reporter.suiteStarted.calls[0].args[0]; var suiteResult = reporter.suiteStarted.calls[0].args[0];
expect(suiteResult.description).toEqual("A Suite"); expect(suiteResult.description).toEqual("A Suite");
expect(reporter.jasmineDone).toHaveBeenCalledWith({ expect(reporter.jasmineDone).toHaveBeenCalled();
executionTime: 1000
});
done(); done();
}); });
fakeNow.andReturn(500);
reporter.suiteDone.andCallFake(function() { fakeNow.andReturn(1500); });
env.addReporter(reporter); env.addReporter(reporter);
env.describe("A Suite", function() { env.describe("A Suite", function() {

View File

@@ -2,8 +2,7 @@ getJasmineRequireObj().Env = function(j$) {
function Env(options) { function Env(options) {
options = options || {}; options = options || {};
var self = this; var self = this;
var global = options.global || j$.getGlobal(), var global = options.global || j$.getGlobal();
now = options.now || function() { return new Date().getTime(); };
var catchExceptions = true; var catchExceptions = true;
@@ -194,13 +193,10 @@ getJasmineRequireObj().Env = function(j$) {
}; };
this.execute = function() { this.execute = function() {
var startTime = now();
this.reporter.jasmineStarted({ this.reporter.jasmineStarted({
totalSpecsDefined: totalSpecsDefined totalSpecsDefined: totalSpecsDefined
}); });
this.topSuite.execute(function() { this.topSuite.execute(self.reporter.jasmineDone);
self.reporter.jasmineDone({executionTime: now() - startTime});
});
}; };
} }