Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ function run(options = kEmptyObject) {
}

if (env != null) {
validateObject(env);
validateObject(env, 'options.env');

if (isolation === 'none') {
throw new ERR_INVALID_ARG_VALUE('options.env', env, 'is not supported with isolation=\'none\'');
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-runner-run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,14 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
}));
});

it('should only allow object in options.env', () => {
[Symbol(), [], () => {}, 0, 1, 0n, 1n, '', '1', true, false]
.forEach((env) => assert.throws(() => run({ files: [], env }), {
code: 'ERR_INVALID_ARG_TYPE',
message: /The "options\.env" property must be of type object\./
}));
});

it('should not allow files and globPatterns used together', () => {
assert.throws(() => run({ files: ['a.js'], globPatterns: ['*.js'] }), {
code: 'ERR_INVALID_ARG_VALUE'
Expand Down
Loading