Skip to content

test_runner: add timeout for tests #43490

Closed
@MoLow

Description

@MoLow

What is the problem this feature will solve?

currently - tests can easily be stuck or never end, which makes it very hard to understand and locate where your problem might originate

for example, this program will be very hard to debug:

test('top level', { concurrency: 2 }, async (t) => {
  await t.test('endless', () => new Promise(() => {
    setTimeout(() => {}, /* Large number */);
  }));


  // ... many other tests
});

What is the feature you are proposing to solve the problem?

add a timeout to tests running via node:test, I propose adding a default timeout that will be configurable
one of the most important parts of testing is failing fast and knowing what the failure is, and timing out will help determine which test is misfunctioning

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.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