@@ -12,7 +12,8 @@ var Log = require('./logger'),
1212 mime = require ( 'mime' ) ,
1313 send = require ( 'send' ) ,
1414 vm = require ( 'vm' ) ,
15- CircularJSON = require ( 'circular-json' ) ;
15+ CircularJSON = require ( 'circular-json' ) ,
16+ resolve = require ( 'resolve' ) ;
1617
1718exports . Server = function Server ( bsClient , workers , config , callback ) {
1819 var testFilePaths = ( Array . isArray ( config . test_path ) ? config . test_path : [ config . test_path ] )
@@ -70,8 +71,8 @@ exports.Server = function Server(bsClient, workers, config, callback) {
7071 patch += '<script type="text/javascript" src="/_patch/' + script + '"></script>\n' ;
7172 } ) ;
7273
73- patch += externalScript ( '../node_modules/ js-reporters/dist/js-reporters.js' ) ;
74- patch += externalScript ( '../node_modules/ circular-json/build/circular-json.js' ) ;
74+ patch += externalScript ( 'js-reporters/dist/js-reporters.js' ) ;
75+ patch += externalScript ( 'circular-json/build/circular-json.js' ) ;
7576
7677 // adding framework scripts
7778 if ( framework === 'jasmine' ) {
@@ -220,7 +221,8 @@ exports.Server = function Server(bsClient, workers, config, callback) {
220221 }
221222
222223 function externalScript ( scriptPath ) {
223- var scriptContents = fs . readFileSync ( path . join ( __dirname , scriptPath ) , { encoding : 'utf8' } ) ;
224+ var resolvedPath = resolve . sync ( scriptPath , { basedir : __dirname } )
225+ var scriptContents = fs . readFileSync ( resolvedPath , { encoding : 'utf8' } ) ;
224226 return '<script type="text/javascript">' + scriptContents + '</script>' ;
225227 }
226228
0 commit comments