summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2022-06-08 18:48:34 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2022-06-13 21:00:55 +0200
commit2526f6f18f54e20b41fa4ed028b3ce90cd1f110d (patch)
treefa07af6f32958dc2adb329f441a850c4628581c1
parentab168be8fd1e8438ae5d5e03b7323bbf9f3cf78c (diff)
downloadgjs-2526f6f18f54e20b41fa4ed028b3ce90cd1f110d.tar.gz
minijasmine: Comment error message lines instead of replacing newlines
Error message lines were removed from test logs, but this makes them harder to read. So just use the same strategy we use for the stack trace, by just commenting out the lines for having a proper TAP report.
-rw-r--r--installed-tests/js/minijasmine.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/installed-tests/js/minijasmine.js b/installed-tests/js/minijasmine.js
index 5b7885dd..09a099ae 100644
--- a/installed-tests/js/minijasmine.js
+++ b/installed-tests/js/minijasmine.js
@@ -4,11 +4,6 @@
const GLib = imports.gi.GLib;
-function _removeNewlines(str) {
- let allNewlines = /\n/g;
- return str.replace(allNewlines, '\\n');
-}
-
function _filterStack(stack) {
if (!stack)
return 'No stack';
@@ -89,7 +84,9 @@ class TapReporter {
if (result.status === 'failed' && result.failedExpectations) {
result.failedExpectations.forEach(failedExpectation => {
const output = [];
- output.push(`Message: ${_removeNewlines(failedExpectation.message)}`);
+ const messageLines = failedExpectation.message.split('\n');
+ output.push(`Message: ${messageLines.shift()}`);
+ output.push(...messageLines.map(str => ` ${str}`));
output.push('Stack:');
let stackTrace = _filterStack(failedExpectation.stack).trim();
output.push(...stackTrace.split('\n').map(str => ` ${str}`));