Skip to content

[node:test] test.only does not work without it being wrapped in describe.only #51882

@mohsen1

Description

@mohsen1

Version

20

Platform

Mac

Subsystem

No response

What steps will reproduce the bug?

// file: example.test.js
const {test, describe} = require('node:test');

describe('something', () => {
  test.only('example', async () => {
    // some async test
   });
});
node --test --test-only

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

I would expect Node test runner to be smart to pick up the test.only without expecting me to mark the wrapper describe block with only also. There are cases that tests are a few describe blocks deep. It is really uncomfortable to update all of the parents with only

What do you see instead?

I get

﹣ something (0.351ms) # 'only' option not set

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    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