Skip to content

Commit d782381

Browse files
author
Kohei Asai
committed
Merge pull request #3 from axross/bugfix-if-thrown
Bugfix: It don't report correct message if operator is throws
2 parents 331b274 + c6d853b commit d782381

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

distributions/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ var createReporter = function createReporter() {
9191
var compared = (0, _diff.diffJson)(diag.actual, diag.expected).map(writeDiff).join('');
9292

9393
println(compared, 4);
94+
} else if (diag.expected === 'undefined' && diag.actual === 'undefined') {
95+
;
9496
} else if (typeof diag.expected === 'string') {
9597
var compared = (0, _diff.diffWords)(diag.actual, diag.expected).map(writeDiff).join('');
9698

@@ -110,7 +112,7 @@ var createReporter = function createReporter() {
110112
if (result.ok) {
111113
println(_chalk2['default'].green('All of ' + result.count + ' tests passed!'));
112114
} else {
113-
println(_chalk2['default'].red(result.fail + ' of ' + result.count + ' tests failed.'));
115+
println(_chalk2['default'].red((result.fail || 0) + ' of ' + result.count + ' tests failed.'));
114116
stream.isFailed = true;
115117
}
116118

sources/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const createReporter = () => {
6060
.join('');
6161

6262
println(compared, 4);
63+
} else if (diag.expected === 'undefined' && diag.actual === 'undefined') {
64+
;
6365
} else if (typeof diag.expected === 'string') {
6466
const compared = diffWords(diag.actual, diag.expected)
6567
.map(writeDiff)
@@ -89,7 +91,7 @@ const createReporter = () => {
8991
if (result.ok) {
9092
println(chalk.green(`All of ${result.count} tests passed!`));
9193
} else {
92-
println(chalk.red(`${result.fail} of ${result.count} tests failed.`));
94+
println(chalk.red(`${result.fail || 0} of ${result.count} tests failed.`));
9395
stream.isFailed = true;
9496
}
9597

0 commit comments

Comments
 (0)