Skip to content

Commit 30a4248

Browse files
anonrigtargos
authored andcommitted
test: add env variable test for --run
PR-URL: #52811 Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ad9c4bd commit 30a4248

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

test/fixtures/run-script/node_modules/.bin/path-env

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/run-script/node_modules/.bin/path-env.bat

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/run-script/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"positional-args": "positional-args",
77
"positional-args-windows": "positional-args.bat",
88
"custom-env": "custom-env",
9-
"custom-env-windows": "custom-env.bat"
9+
"custom-env-windows": "custom-env.bat",
10+
"path-env": "path-env",
11+
"path-env-windows": "path-env.bat"
1012
}
1113
}

test/message/node_run_non_existent.out

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Available scripts are:
88
positional-args-windows: positional-args.bat
99
custom-env: custom-env
1010
custom-env-windows: custom-env.bat
11+
path-env: path-env
12+
path-env-windows: path-env.bat

test/parallel/test-node-run.js

+11
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,15 @@ describe('node run [command]', () => {
6464
assert.strictEqual(child.stderr, '');
6565
assert.strictEqual(child.code, 0);
6666
});
67+
68+
it('should set PATH environment variable to node_modules/.bin', async () => {
69+
const child = await common.spawnPromisified(
70+
process.execPath,
71+
[ '--no-warnings', '--run', `path-env${envSuffix}`],
72+
{ cwd: fixtures.path('run-script') },
73+
);
74+
assert.ok(child.stdout.includes(fixtures.path('run-script/node_modules/.bin')));
75+
assert.strictEqual(child.stderr, '');
76+
assert.strictEqual(child.code, 0);
77+
});
6778
});

0 commit comments

Comments
 (0)