Skip to content

test_runner: only not working properly in subtests #49015

Description

@mcollina

It seems there is some odd behavior with only and subtests, because I expected the following to pass:

const test = require('node:test')

test('this should be run', { only: true }, (t) => {
  t.test('this should be run', { only: true }, (t) => {
  })

  t.test('this should not be run', (t) => {
  })
})

But it's failing with an odd error

▶ this should be run
  ✔ this should be run (0.320833ms)
  ✖ this should not be run (0.216167ms)
    'test did not finish before its parent and was cancelled'

▶ this should be run (1.850417ms)

ℹ tests 3
ℹ suites 0
ℹ pass 1
ℹ fail 1
ℹ cancelled 1
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 0.11275

✖ failing tests:

✖ this should not be run (0.216167ms)
  'test did not finish before its parent and was cancelled'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions