Skip to content

Commit

Permalink
Stop rewriting NODE_PATH values to be absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jan 5, 2020
1 parent f217252 commit 1f10a7c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 32 deletions.
12 changes: 1 addition & 11 deletions lib/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ if (fs.realpathSync(__filename) !== __filename) {
// the presence of this variable allows it to require this one instead
const AVA_PATH = path.resolve(__dirname, '..');

// Ensure NODE_PATH paths are absolute
let NODE_PATH;

if (process.env.NODE_PATH) {
NODE_PATH = process.env.NODE_PATH
.split(path.delimiter)
.map(x => path.resolve(x))
.join(path.delimiter);
}

const describeTTY = tty => ({
colorDepth: tty.getColorDepth ? tty.getColorDepth() : undefined,
hasColors: typeof tty.hasColors === 'function',
Expand Down Expand Up @@ -56,7 +46,7 @@ module.exports = (file, opts, execArgv) => {
const subprocess = childProcess.fork(workerPath, args, {
cwd: opts.projectDir,
silent: true,
env: {NODE_ENV: 'test', ...process.env, ...opts.environmentVariables, AVA_PATH, NODE_PATH},
env: {NODE_ENV: 'test', ...process.env, ...opts.environmentVariables, AVA_PATH},
execArgv: execArgv || process.execArgv
});

Expand Down
8 changes: 0 additions & 8 deletions test/fixture/node-paths.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/fixture/node-paths/deep/nested/the-path/bar.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/fixture/node-paths/modules/nested/foo.js

This file was deleted.

9 changes: 0 additions & 9 deletions test/integration/assorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ for (const tapFlag of ['--tap', '-t']) {
});
}

test('handles NODE_PATH', t => {
const nodePaths = `node-paths/modules${path.delimiter}node-paths/deep/nested`;

execCli('node-paths.js', {env: {NODE_PATH: nodePaths}}, err => {
t.ifError(err);
t.end();
});
});

test('works when no files are found', t => {
execCli([], {dirname: 'fixture/globs/no-files'}, (err, stdout) => {
t.is(err.code, 1);
Expand Down

0 comments on commit 1f10a7c

Please sign in to comment.