Skip to content

Commit

Permalink
cleanup #531
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 16, 2016
1 parent 0675d34 commit 69dbcf2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
5 changes: 2 additions & 3 deletions lib/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var send = require('./send');

var env = process.env;

// ensure NODE_PATH paths are absolute
if (process.env.NODE_PATH) {
var nodePath = process.env.NODE_PATH
.split(path.delimiter)
Expand All @@ -17,9 +18,7 @@ if (process.env.NODE_PATH) {
})
.join(path.delimiter);

env = objectAssign({
NODE_PATH: nodePath
}, env);
env = objectAssign({NODE_PATH: nodePath}, env);
}

module.exports = function (file, opts) {
Expand Down
3 changes: 2 additions & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ test('watcher works', function (t) {

test('handles NODE_PATH', function (t) {
var nodePaths = 'node-paths/modules' + path.delimiter + 'node-paths/deep/nested';

execCli('fixture/node-paths.js', {env: {NODE_PATH: nodePaths}}, function (err) {
t.notOk(err);
t.ifError(err);
t.end();
});
});
5 changes: 2 additions & 3 deletions test/fixture/node-paths.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import test from '../../';

import foo from 'nested/foo';
import bar from 'path/bar';

test('relative require', t => {
t.is(foo(), 'bar');
t.is(bar(), 'baz');
t.is(foo, 'bar');
t.is(bar, 'baz');
});
5 changes: 1 addition & 4 deletions test/fixture/node-paths/deep/nested/path/bar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
module.exports = function () {
return 'baz';
};

module.exports = 'baz';
5 changes: 1 addition & 4 deletions test/fixture/node-paths/modules/nested/foo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
module.exports = function () {
return 'bar';
};

module.exports = 'bar';

0 comments on commit 69dbcf2

Please sign in to comment.