Skip to content

Commit 4814296

Browse files
committed
Removed unnecessary check for passedExpectations truthiness
specDone events from Jasmine core will always have passedExpectations set to an array. The console reporter's own tests were the only caller that ever passed an event without a passedExpectations.
1 parent 204e0a1 commit 4814296

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

lib/reporters/console_reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function ConsoleReporter() {
211211
//
212212
// Same logic is used by jasmine.HtmlReporter, see https://github.com/jasmine/jasmine/blob/master/src/html/HtmlReporter.js
213213
if (result.failedExpectations.length === 0 &&
214-
(!result.passedExpectations || result.passedExpectations.length === 0)) {
214+
result.passedExpectations.length === 0) {
215215
printNewline();
216216
print(indent('Message:', 2));
217217
printNewline();

spec/reporters/console_reporter_spec.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ describe("ConsoleReporter", function() {
206206
actual: true,
207207
stack: fakeStack
208208
}
209-
]
209+
],
210+
passedExpectations: []
210211
});
211212

212213
this.out.clear();
@@ -255,7 +256,8 @@ describe("ConsoleReporter", function() {
255256
actual: true,
256257
stack: fakeStack
257258
}
258-
]
259+
],
260+
passedExpectations: []
259261
});
260262

261263
this.out.clear();
@@ -286,7 +288,8 @@ describe("ConsoleReporter", function() {
286288
actual: true,
287289
stack: fakeStack
288290
}
289-
]
291+
],
292+
passedExpectations: []
290293
});
291294

292295
this.out.clear();
@@ -319,7 +322,8 @@ describe("ConsoleReporter", function() {
319322
actual: true,
320323
stack: undefined
321324
}
322-
]
325+
],
326+
passedExpectations: []
323327
});
324328

325329
this.out.clear();
@@ -354,7 +358,8 @@ describe("ConsoleReporter", function() {
354358
actual: true,
355359
stack: fakeStack
356360
}
357-
]
361+
],
362+
passedExpectations: []
358363
});
359364

360365
this.out.clear();
@@ -421,7 +426,8 @@ describe("ConsoleReporter", function() {
421426
status: "failed",
422427
description: "with a failing spec",
423428
fullName: "A suite with a failing spec that has no expectations",
424-
failedExpectations: []
429+
failedExpectations: [],
430+
passedExpectations: []
425431
});
426432

427433
this.out.clear();
@@ -449,7 +455,8 @@ describe("ConsoleReporter", function() {
449455
expected: false,
450456
actual: true,
451457
stack: undefined
452-
}]
458+
}],
459+
passedExpectations: []
453460
});
454461

455462
this.out.clear();

0 commit comments

Comments
 (0)