Add execution time elapsed to JsApiReporter
Since this information is desired in ConsoleReporter, HtmlReporter, and now JsApiReporter, the executionTime is passed through in jasmineDone from Env instead of making each reporter compute it. Fixes #30, [Finishes #45659879]
This commit is contained in:
@@ -167,8 +167,9 @@ describe("Env (integration)", function() {
|
||||
|
||||
// TODO: something is wrong with this spec
|
||||
it("should report as expected", function() {
|
||||
var env = new j$.Env(),
|
||||
reporter = jasmine.createSpyObj('fakeReproter', [
|
||||
var fakeNow = jasmine.createSpy('fake Date.now'),
|
||||
env = new j$.Env({now: fakeNow}),
|
||||
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||
"jasmineStarted",
|
||||
"jasmineDone",
|
||||
"suiteStarted",
|
||||
@@ -177,6 +178,9 @@ describe("Env (integration)", function() {
|
||||
"specDone"
|
||||
]);
|
||||
|
||||
fakeNow.andReturn(500);
|
||||
reporter.suiteDone.andCallFake(function() { fakeNow.andReturn(1500); });
|
||||
|
||||
env.addReporter(reporter);
|
||||
|
||||
env.describe("A Suite", function() {
|
||||
@@ -200,7 +204,9 @@ describe("Env (integration)", function() {
|
||||
});
|
||||
var suiteResult = reporter.suiteStarted.calls[0].args[0];
|
||||
expect(suiteResult.description).toEqual("A Suite");
|
||||
expect(reporter.jasmineDone).toHaveBeenCalled();
|
||||
expect(reporter.jasmineDone).toHaveBeenCalledWith({
|
||||
executionTime: 1000
|
||||
});
|
||||
});
|
||||
|
||||
it("should be possible to get full name from a spec", function() {
|
||||
|
||||
@@ -101,7 +101,7 @@ describe("JsApiReporter", function() {
|
||||
expect(reporter.finished).toBe(false);
|
||||
|
||||
reporter.jasmineStarted();
|
||||
reporter.jasmineDone();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
expect(reporter.finished).toBe(true);
|
||||
});
|
||||
@@ -123,7 +123,7 @@ describe("JsApiReporter", function() {
|
||||
it("reports 'done' when Jasmine is done", function() {
|
||||
var reporter = new j$.JsApiReporter();
|
||||
|
||||
reporter.jasmineDone();
|
||||
reporter.jasmineDone({});
|
||||
|
||||
expect(reporter.status()).toEqual('done');
|
||||
});
|
||||
@@ -178,4 +178,22 @@ describe("JsApiReporter", function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#executionTime", function() {
|
||||
var reporter;
|
||||
beforeEach(function() {
|
||||
reporter = new j$.JsApiReporter();
|
||||
});
|
||||
|
||||
it("should return the time it took the specs to run, in ms", function() {
|
||||
reporter.jasmineDone({executionTime: 1000});
|
||||
expect(reporter.executionTime()).toEqual(1000);
|
||||
});
|
||||
|
||||
describe("when the specs haven't finished being run", function() {
|
||||
it("should return undefined", function() {
|
||||
expect(reporter.executionTime()).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user