Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,12 @@ function watchFiles(testFiles, opts) {
}

function run(options) {
if (options === null || typeof options !== 'object') {
options = kEmptyObject;
if (options != null) {
validateObject(options, 'options');
}

options = options ?? kEmptyObject;
Comment thread
rluvaton marked this conversation as resolved.
Outdated

let { testNamePatterns, shard } = options;
const { concurrency, timeout, signal, files, inspectPort, watch, setup, only } = options;

Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-runner-run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import assert from 'node:assert';
const testFixtures = fixtures.path('test-runner');

describe('require(\'node:test\').run', { concurrency: true }, () => {
it('should fail when passing array as options', () => {
assert.throws(() => run([]), {
Comment thread
rluvaton marked this conversation as resolved.
Outdated
code: 'ERR_INVALID_ARG_TYPE'
});
});

it('should run with no tests', async () => {
const stream = run({ files: [] });
Expand Down