Skip to content

Commit 7b6e419

Browse files
committed
log objects and arrays using console.dir
1 parent b3184f4 commit 7b6e419

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

lib/runner.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ function runner(testFile, config, handleResult) {
1010
data = data.toString();
1111
var match = signalMatch.exec(data);
1212
if (!match) {
13-
console.log(data);
13+
try {
14+
console.dir(JSON.parse(data));
15+
}
16+
catch (e) {
17+
console.log(data);
18+
}
1419
return;
1520
}
1621
var resultString = data.substring(match.index + utils_1.signal.length);

src/runner.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ export default function runner(testFile: string, config: CR.Config,
1616
let match = signalMatch.exec(data); // 0
1717

1818
if (!match) {
19-
console.log(data);
19+
try {
20+
console.dir(JSON.parse(data));
21+
} catch (e) {
22+
console.log(data);
23+
}
2024
return;
2125
}
2226

@@ -32,7 +36,7 @@ export default function runner(testFile: string, config: CR.Config,
3236
if (result.pass) {
3337
// pass
3438
final = result.passes[result.passes.length - 1];
35-
} else if (result.pass === false ) {
39+
} else if (result.pass === false) {
3640
// fail: return first failure
3741
final = result.failures[0];
3842
} else {

test/utils/runner.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ var config = {
77
tutorialDir: path.join(__dirname, '..', '/tests'),
88
taskPosition: 0
99
};
10-
function handleLog(log) {
11-
return log;
12-
}
10+
1311
function handleResult(result) {
1412
return result;
1513
}
1614

1715
exports.getRunner = function getRunner(file) {
18-
return runner(file, config, handleResult, handleLog);
16+
return runner(file, config, handleResult,);
1917
}

0 commit comments

Comments
 (0)