File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ class HTMLReporter {
167167 failureMsgDiv . ele (
168168 "pre" ,
169169 { class : "failureMsg" } ,
170- stripAnsi ( suite . failureMessage )
170+ this . sanitizeOutput ( suite . failureMessage )
171171 ) ;
172172 }
173173
@@ -400,7 +400,7 @@ class HTMLReporter {
400400 failureMsgDiv . ele (
401401 "pre" ,
402402 { class : "failureMsg" } ,
403- stripAnsi ( failureMsg )
403+ this . sanitizeOutput ( failureMsg )
404404 ) ;
405405 } ) ;
406406 }
@@ -458,12 +458,12 @@ class HTMLReporter {
458458 logElement . ele (
459459 "pre" ,
460460 { class : "suite-consolelog-item-origin" } ,
461- stripAnsi ( log . origin )
461+ this . sanitizeOutput ( log . origin )
462462 ) ;
463463 logElement . ele (
464464 "pre" ,
465465 { class : "suite-consolelog-item-message" } ,
466- stripAnsi ( log . message )
466+ this . sanitizeOutput ( log . message )
467467 ) ;
468468 } ) ;
469469 }
@@ -739,6 +739,18 @@ class HTMLReporter {
739739 }
740740 return { logColor, logMsg } ; // Return for testing purposes
741741 }
742+
743+ /**
744+ * Helper method to santize output from invalid characters
745+ */
746+ private sanitizeOutput ( input : string ) {
747+ return stripAnsi (
748+ input . replace (
749+ / ( [ ^ \x09 \x0A \x0D \x20 - \uD7FF \uE000 - \uFFFC \u{10000} - \u{10FFFF} ] ) / gu,
750+ ""
751+ )
752+ ) ;
753+ }
742754}
743755
744756export default HTMLReporter ;
You can’t perform that action at this time.
0 commit comments