Skip to content

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

@Semigradsky

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/[email protected]/lib/internal/test_runner/harness.js#L29-L31
nodejs/[email protected]/lib/internal/test_runner/test.js#L165-L192
nodejs/[email protected]/lib/internal/test_runner/tests_stream.js#L10

const stream = 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