@@ -61,15 +61,6 @@ exports.Server = function Server(bsClient, workers, config, callback) {
6161 var filePath = path . relative ( process . cwd ( ) , filename ) ;
6262 var pathMatches = ( testFilePaths . indexOf ( filePath ) !== - 1 ) ;
6363
64- var jsReportersPath = path . join ( __dirname , '../node_modules/js-reporters/dist/js-reporters.js' ) ;
65- var jsReportersScript = fs . readFileSync ( jsReportersPath , {
66- encoding : 'utf8'
67- } ) ;
68- var circularJSONPath = path . join ( __dirname , '../node_modules/circular-json/build/circular-json.js' ) ;
69- var circularJSONScript = fs . readFileSync ( circularJSONPath , {
70- encoding : 'utf8'
71- } ) ;
72-
7364 if ( pathMatches ) {
7465 var framework = config [ 'test_framework' ] ;
7566 var tag_name = ( framework === 'mocha' ) ? 'head' : 'body' ;
@@ -79,8 +70,8 @@ exports.Server = function Server(bsClient, workers, config, callback) {
7970 patch += '<script type="text/javascript" src="/_patch/' + script + '"></script>\n' ;
8071 } ) ;
8172
82- patch += '<script type="text/javascript">' + jsReportersScript + '</script>' ;
83- patch += '<script type="text/javascript">' + circularJSONScript + '</script>' ;
73+ patch += externalScript ( '../node_modules/js-reporters/dist/js-reporters.js' ) ;
74+ patch += externalScript ( '../node_modules/circular-json/build/circular-json.js' ) ;
8475
8576 // adding framework scripts
8677 if ( framework === 'jasmine' ) {
@@ -203,7 +194,6 @@ exports.Server = function Server(bsClient, workers, config, callback) {
203194 return config . test_path [ ++ worker . path_index ] ;
204195 }
205196
206-
207197 function getWorkerUuid ( request ) {
208198 var uuid = request . headers [ 'x-worker-uuid' ] ;
209199
@@ -229,6 +219,10 @@ exports.Server = function Server(bsClient, workers, config, callback) {
229219 response . end ( ) ;
230220 }
231221
222+ function externalScript ( scriptPath ) {
223+ var scriptContents = fs . readFileSync ( path . join ( __dirname , scriptPath ) , { encoding : 'utf8' } ) ;
224+ return '<script type="text/javascript">' + scriptContents + '</script>' ;
225+ }
232226
233227 var handlers = {
234228 '_progress' : function progressHandler ( uri , body , request , response ) {
0 commit comments