Skip to content

test_runner: test object is incorrectly passed to setup() #48809

Description

@Semigradsky

Affected URL(s)

https://nodejs.org/docs/latest-v20.x/api/test.html#runoptions

Description of the problem

By doc:

options.setup - A function that accepts the TestsStream instance

but in fact that is not TestStream
nodejs/node@v20.4.0/lib/internal/test_runner/harness.js#L29-L31
nodejs/node@v20.4.0/lib/internal/test_runner/test.js#L165-L192
nodejs/node@v20.4.0/lib/internal/test_runner/tests_stream.js#L10

conststream=run({files: files,concurrency: true,setup: function(root){console.log('setup',root)}})
setup <ref *1> Test {
concurrency: 9,
nesting: 0,
only: false,
reporter: TestsStream {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: null,
ended: false,
endEmitted: false,
reading: false,

Found in DefinitelyTyped/DefinitelyTyped#66064

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions