File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -99,16 +99,22 @@ exports.Server = function Server(bsClient, workers) {
9999 }
100100
101101 function parseBody ( body ) {
102- return JSON . parse ( qs . parse ( body ) . data . replace ( / \n / g, "\\n" ) ) ;
102+ // TODO: Have better implementation
103+ return JSON . parse ( qs . parse ( body ) . data . escapeSpecialChars ( ) ) ;
103104 }
104105
105106 handlers = {
106107 "_progress" : function progressHandler ( uri , body , request , response ) {
107- query = parseBody ( body ) ;
108-
109108 var uuid = request . headers [ 'x-worker-uuid' ] ;
110109 var worker = workers [ uuid ] ;
111- //console.log("Tests run:", query.tests_run);
110+ query = "" ;
111+ try {
112+ query = parseBody ( body ) ;
113+ } catch ( e ) {
114+ console . log ( "[%s] Exception in parsing QUnit log" , worker . string )
115+ console . log ( "[%s] Log: " + qs . parse ( body ) . data , worker . string )
116+ }
117+
112118 if ( query . tracebacks ) {
113119 query . tracebacks . forEach ( function ( traceback ) {
114120 console . log ( "[%s] Error:" , worker . string , traceback ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ var http = require('http');
33var url = require ( 'url' ) ;
44var querystring = require ( 'querystring' ) ;
55
6+ String . prototype . escapeSpecialChars = function ( ) {
7+ return this . replace ( / \n / g, "\\n" )
8+ . replace ( / \\ s / g, "\s" )
9+ . replace ( / \\ \' / , "\'" ) ;
10+ } ;
11+
612var titleCase = function toTitleCase ( str ) {
713 return str . replace ( / \w \S * / g, function ( txt ) {
814 return txt . charAt ( 0 ) . toUpperCase ( ) + txt . substr ( 1 ) . toLowerCase ( ) ;
You can’t perform that action at this time.
0 commit comments