Remove 'empty' as an option as a spec result

- Having the 'empty' state for a spec result can be considered a
breaking change to the reporter interface
- Instead, we determine if a spec has no expectations using the added
key of 'passedExpectations' in combination of the 'failedExpectations'
to determine that there a spec is 'empty'

[fixes #73741032]
This commit is contained in:
Sheel Choksi
2014-06-27 23:48:19 -07:00
parent 5f34be446c
commit f7ff47706c
6 changed files with 52 additions and 42 deletions

View File

@@ -64,7 +64,7 @@ describe("New HtmlReporter", function() {
});
describe("when a spec is done", function() {
it("logs errors to the console if it is an empty spec", function() {
it("logs errors to the console and prints a special symbol if it is an empty spec", function() {
if (!window.console) {
window.console = { error: function(){} };
}
@@ -84,10 +84,14 @@ describe("New HtmlReporter", function() {
reporter.initialize();
reporter.specDone({
status: "empty",
fullName: 'Some Name'
status: "passed",
fullName: 'Some Name',
passedExpectations: [],
failedExpectations: []
});
expect(console.error).toHaveBeenCalledWith("Spec \'Some Name\' has no expectations.");
var specEl = container.querySelector('.symbol-summary li');
expect(specEl.getAttribute("class")).toEqual("empty");
});
it("reports the status symbol of a disabled spec", function() {
@@ -102,7 +106,7 @@ describe("New HtmlReporter", function() {
});
reporter.initialize();
reporter.specDone({id: 789, status: "disabled", fullName: "symbols should have titles"});
reporter.specDone({id: 789, status: "disabled", fullName: "symbols should have titles", passedExpectations: [], failedExpectations: []});
var specEl = container.querySelector('.symbol-summary li');
expect(specEl.getAttribute("class")).toEqual("disabled");
@@ -122,7 +126,7 @@ describe("New HtmlReporter", function() {
});
reporter.initialize();
reporter.specDone({id: 789, status: "pending"});
reporter.specDone({id: 789, status: "pending", passedExpectations: [], failedExpectations: []});
var specEl = container.querySelector('.symbol-summary li');
expect(specEl.getAttribute("class")).toEqual("pending");
@@ -141,7 +145,7 @@ describe("New HtmlReporter", function() {
});
reporter.initialize();
reporter.specDone({id: 123, status: "passed"});
reporter.specDone({id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []});
var statuses = container.querySelector(".symbol-summary");
var specEl = statuses.querySelector("li");
@@ -195,15 +199,13 @@ describe("New HtmlReporter", function() {
reporter.initialize();
reporter.jasmineStarted({});
reporter.suiteStarted({id: 1});
reporter.specStarted({
status: "empty",
id: 1,
description: 'Spec Description'
});
reporter.specStarted({id: 1, status: 'passed', passedExpectations: [], failedExpectations: []});
reporter.specDone({
status: "empty",
id: 1,
description: 'Spec Description'
status: 'passed',
description: 'Spec Description',
passedExpectations: [],
failedExpectations: []
});
reporter.suiteDone({id: 1});
reporter.jasmineDone({});
@@ -263,7 +265,9 @@ describe("New HtmlReporter", function() {
id: 123,
description: "with a spec",
fullName: "A Suite with a spec",
status: "passed"
status: "passed",
failedExpectations: [],
passedExpectations: [{passed: true}]
};
reporter.specStarted(specResult);
reporter.specDone(specResult);
@@ -278,7 +282,9 @@ describe("New HtmlReporter", function() {
id: 124,
description: "with another spec",
fullName: "A Suite inner suite with another spec",
status: "passed"
status: "passed",
failedExpectations: [],
passedExpectations: [{passed: true}]
};
reporter.specStarted(specResult);
reporter.specDone(specResult);
@@ -290,7 +296,7 @@ describe("New HtmlReporter", function() {
description: "with a failing spec",
fullName: "A Suite inner with a failing spec",
status: "failed",
failedExpectations: [],
failedExpectations: [{}],
passedExpectations: []
};
reporter.specStarted(specResult);
@@ -447,13 +453,17 @@ describe("New HtmlReporter", function() {
id: 123,
description: "with a spec",
fullName: "A Suite with a spec",
status: "passed"
status: "passed",
passedExpectations: [{passed: true}],
failedExpectations: []
});
reporter.specDone({
id: 124,
description: "with another spec",
fullName: "A Suite inner suite with another spec",
status: "passed"
status: "passed",
passedExpectations: [{passed: true}],
failedExpectations: []
});
reporter.jasmineDone({});
});
@@ -498,7 +508,9 @@ describe("New HtmlReporter", function() {
id: 123,
description: "with a spec",
fullName: "A Suite with a spec",
status: "pending"
status: "pending",
passedExpectations: [],
failedExpectations: []
});
reporter.jasmineDone({});
});
@@ -533,7 +545,7 @@ describe("New HtmlReporter", function() {
reporter.jasmineStarted({ totalSpecsDefined: 1 });
var passingResult = {id: 123, status: "passed"};
var passingResult = {id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []};
reporter.specStarted(passingResult);
reporter.specDone(passingResult);
@@ -542,6 +554,7 @@ describe("New HtmlReporter", function() {
status: "failed",
description: "a failing spec",
fullName: "a suite with a failing spec",
passedExpectations: [],
failedExpectations: [
{
message: "a failure message",