@@ -12,7 +12,8 @@ var Log = require('./logger'),
12
12
mime = require ( 'mime' ) ,
13
13
send = require ( 'send' ) ,
14
14
vm = require ( 'vm' ) ,
15
- CircularJSON = require ( 'circular-json' ) ;
15
+ CircularJSON = require ( 'circular-json' ) ,
16
+ resolve = require ( 'resolve' ) ;
16
17
17
18
exports . Server = function Server ( bsClient , workers , config , callback ) {
18
19
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) {
70
71
patch += '<script type="text/javascript" src="/_patch/' + script + '"></script>\n' ;
71
72
} ) ;
72
73
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' ) ;
75
76
76
77
// adding framework scripts
77
78
if ( framework === 'jasmine' ) {
@@ -220,7 +221,8 @@ exports.Server = function Server(bsClient, workers, config, callback) {
220
221
}
221
222
222
223
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' } ) ;
224
226
return '<script type="text/javascript">' + scriptContents + '</script>' ;
225
227
}
226
228
0 commit comments