Skip to content

Commit 6b62884

Browse files
committed
minor style tweaks
1 parent 1b60c7b commit 6b62884

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

lib/logger.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ x.test = function (props) {
4444
return;
4545
}
4646

47-
// if (runner.stats.testCount === 1) {
48-
// return;
49-
// }
50-
5147
// display duration only over a threshold
5248
var threshold = 100;
5349
var dur = props.duration > threshold ? chalk.gray.dim(' (' + prettyMs(props.duration) + ')') : '';
@@ -76,9 +72,11 @@ x.report = function (passed, failed, unhandled, uncaught) {
7672
} else {
7773
log.writelpad(chalk.green(passed, plur('test', passed), 'passed'));
7874
}
75+
7976
if (unhandled > 0) {
8077
log.writelpad(chalk.red(unhandled, 'unhandled', plur('rejection', unhandled)));
8178
}
79+
8280
if (uncaught > 0) {
8381
log.writelpad(chalk.red(uncaught, 'uncaught', plur('exception', uncaught)));
8482
}
@@ -88,23 +86,28 @@ x.unhandledRejections = function (file, rejections) {
8886
if (!(rejections && rejections.length)) {
8987
return;
9088
}
89+
9190
rejections.forEach(function (rejection) {
9291
log.write(chalk.red('Unhandled Rejection: ', file));
92+
9393
if (rejection.stack) {
9494
log.writelpad(chalk.red(beautifyStack(rejection.stack)));
9595
} else {
9696
log.writelpad(chalk.red(JSON.stringify(rejection)));
9797
}
98+
9899
log.write();
99100
});
100101
};
101102

102103
x.uncaughtException = function (file, error) {
103104
log.write(chalk.red('Uncaught Exception: ', file));
105+
104106
if (error.stack) {
105107
log.writelpad(chalk.red(beautifyStack(error.stack)));
106108
} else {
107109
log.writelpad(chalk.red(JSON.stringify(error)));
108110
}
111+
109112
log.write();
110113
};

lib/serialize-value.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
var destroyCircular = require('destroy-circular');
33

44
// Make a value ready for JSON.stringify() / process.send()
5-
65
module.exports = function serializeValue(value) {
76
if (typeof value === 'object') {
87
return destroyCircular(value);
98
}
9+
1010
if (typeof value === 'function') {
1111
// JSON.stringify discards functions, leaving no context information once we serialize and send across.
1212
// We replace thrown functions with a string to provide as much information to the user as possible.
1313
return '[Function: ' + (value.name || 'anonymous') + ']';
1414
}
15+
1516
return value;
1617
};

lib/symbol.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ module.exports = function (key) {
1414
} else if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
1515
return Symbol.for(key);
1616
}
17+
1718
return '@@' + key;
1819
};

lib/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Test.prototype.plan = function (count) {
102102
Test.prototype.run = function () {
103103
this.promise = {};
104104

105-
// TODO: refactor this to avoid storing the promise
105+
// TODO(vdemedes): refactor this to avoid storing the promise
106106
return new Promise(function (resolve, reject) {
107107
this.promise.resolve = resolve;
108108
this.promise.reject = reject;

test/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ test('uncaught exception will be reported to console', function (t) {
12131213
execCli('fixture/uncaught-exception.js', function (err, stdout, stderr) {
12141214
t.ok(err);
12151215
t.ok(/Can't catch me!/.test(stderr));
1216-
// TODO: This should get printed, but we reject the promise (ending all tests) instead of just ending that one test and reporting.
1216+
// TODO(jamestalmage): This should get printed, but we reject the promise (ending all tests) instead of just ending that one test and reporting.
12171217
// t.ok(/1 uncaught exception[^s]/.test(stdout));
12181218
t.end();
12191219
});

0 commit comments

Comments
 (0)