File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,21 @@ exports.Server = function Server(bsClient, workers) {
100
100
101
101
function parseBody ( body ) {
102
102
// TODO: Have better implementation
103
- return JSON . parse ( qs . parse ( body ) . data . replace ( / \n / g , "\\n" ) . replace ( / \\ s / g , "\s" ) ) ;
103
+ return JSON . parse ( qs . parse ( body ) . data . escapeSpecialChars ( ) ) ;
104
104
}
105
105
106
106
handlers = {
107
107
"_progress" : function progressHandler ( uri , body , request , response ) {
108
- query = parseBody ( body ) ;
109
-
110
108
var uuid = request . headers [ 'x-worker-uuid' ] ;
111
109
var worker = workers [ uuid ] ;
112
- //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
+
113
118
if ( query . tracebacks ) {
114
119
query . tracebacks . forEach ( function ( traceback ) {
115
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