Skip to content

test_runner: todo/skip/expectFailure are truthy per docs, but implementation is otherwise #61815

@vassudanagunta

Description

@vassudanagunta

Version

v25.6.1

Subsystem

node:test

What steps will reproduce the bug?

Add the todo, skip or testFailure option to a test, setting it to an empty string. The result will be the same as if you set it to true or a non-empty string.

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

Unsure whether the bug is in the code or in the API docs.

The code clearly does not treat these options as truthy:

this.expectFailure = expectFailure !== undefined && expectFailure !== false;
this.skipped = skip !== undefined && skip !== false;
this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo;

But the docs specifically state they should be:

node/doc/api/test.md

Lines 1691 to 1696 in 2de3482

* `skip` {boolean|string} If truthy, the test is skipped. If a string is
provided, that string is displayed in the test results as the reason for
skipping the test. **Default:** `false`.
* `todo` {boolean|string} If truthy, the test marked as `TODO`. If a string
is provided, that string is displayed in the test results as the reason why
the test is `TODO`. **Default:** `false`.

Additional information

Previous discussions:

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