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) {
99
99
}
100
100
101
101
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 ( ) ) ;
103
104
}
104
105
105
106
handlers = {
106
107
"_progress" : function progressHandler ( uri , body , request , response ) {
107
- query = parseBody ( body ) ;
108
-
109
108
var uuid = request . headers [ 'x-worker-uuid' ] ;
110
109
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
+
112
118
if ( query . tracebacks ) {
113
119
query . tracebacks . forEach ( function ( traceback ) {
114
120
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');
3
3
var url = require ( 'url' ) ;
4
4
var querystring = require ( 'querystring' ) ;
5
5
6
+ String . prototype . escapeSpecialChars = function ( ) {
7
+ return this . replace ( / \n / g, "\\n" )
8
+ . replace ( / \\ s / g, "\s" )
9
+ . replace ( / \\ \' / , "\'" ) ;
10
+ } ;
11
+
6
12
var titleCase = function toTitleCase ( str ) {
7
13
return str . replace ( / \w \S * / g, function ( txt ) {
8
14
return txt . charAt ( 0 ) . toUpperCase ( ) + txt . substr ( 1 ) . toLowerCase ( ) ;
You can’t perform that action at this time.
0 commit comments