Skip to content

Commit 0564db2

Browse files
authored
Merge pull request #170 from TehShrike/fixing-npm3-install
Use resolve to resolve module references instead of path.join
2 parents f5689b8 + d2b05b1 commit 0564db2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/server.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1718
exports.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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"circular-json": "0.3.1",
1414
"js-reporters": "1.1.0",
1515
"mime": "1.3.4",
16+
"resolve": "1.1.7",
1617
"send": "0.13.0",
1718
"tunnel": "0.0.3"
1819
},

0 commit comments

Comments
 (0)