HTML reporter: show debug logs with white-space: pre

This commit is contained in:
Steve Gravrock
2024-06-22 11:24:56 -07:00
parent c3960c4a96
commit ba7560f65e
5 changed files with 19 additions and 2 deletions
+5 -1
View File
@@ -463,7 +463,11 @@ jasmineRequire.HtmlReporter = function(j$) {
'tr', 'tr',
{}, {},
createDom('td', {}, entry.timestamp.toString()), createDom('td', {}, entry.timestamp.toString()),
createDom('td', {}, entry.message) createDom(
'td',
{ className: 'jasmine-debug-log-msg' },
entry.message
)
) )
); );
}); });
+3
View File
@@ -296,3 +296,6 @@ body {
.jasmine_html-reporter .jasmine-debug-log table, .jasmine_html-reporter .jasmine-debug-log th, .jasmine_html-reporter .jasmine-debug-log td { .jasmine_html-reporter .jasmine-debug-log table, .jasmine_html-reporter .jasmine-debug-log th, .jasmine_html-reporter .jasmine-debug-log td {
border: 1px solid #ddd; border: 1px solid #ddd;
} }
.jasmine_html-reporter .jasmine-debug-log .jasmine-debug-log-msg {
white-space: pre;
}
+2
View File
@@ -159,6 +159,8 @@ describe('ExceptionFormatter', function() {
jasmineFile: jasmine.util.jasmineFile() jasmineFile: jasmine.util.jasmineFile()
}); });
const result = subject.stack(error); const result = subject.stack(error);
jasmine.debugLog('Original stack trace: ' + error.stack);
jasmine.debugLog('Filtered stack trace: ' + result);
const lines = result.split('\n'); const lines = result.split('\n');
if (lines[0].match(/an error/)) { if (lines[0].match(/an error/)) {
+5 -1
View File
@@ -430,7 +430,11 @@ jasmineRequire.HtmlReporter = function(j$) {
'tr', 'tr',
{}, {},
createDom('td', {}, entry.timestamp.toString()), createDom('td', {}, entry.timestamp.toString()),
createDom('td', {}, entry.message) createDom(
'td',
{ className: 'jasmine-debug-log-msg' },
entry.message
)
) )
); );
}); });
+4
View File
@@ -424,5 +424,9 @@ body {
table, th, td { table, th, td {
border: 1px solid #ddd; border: 1px solid #ddd;
} }
.jasmine-debug-log-msg {
white-space: pre;
}
} }
} }