Skip to content

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

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:

Activity

  1. ljharb commented on Feb 15, 2026

    @ljharb
    SponsorMember

    Based on my comment on #47537 (review), this seems like a bug - the empty string should be identical to false.

  2. JakobJingleheimer commented on Feb 15, 2026

    @JakobJingleheimer
    Member

    I can't think of a reason for them to not be truthy/falsy, like skip: 'skip' in opts && !!opts.skip

  3. vassudanagunta commented on Feb 15, 2026

    @vassudanagunta
    ContributorAuthor

    the effective change will be that '', null, NaN and the various flavors of 0 will no longer result in a todo/skip/expectFailure.

    My guess is only the first and maybe the second will likely break any existing clients and even that will be rare.

  4. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  5. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 20, 2026
  6. vassudanagunta commented on Jul 20, 2026

    @vassudanagunta
    ContributorAuthor

    still an issue

  7. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 21, 2026
  8. added
    never-staleIssues and PRs exempt from automated stale handling.
    on Jul 24, 2026
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

    never-staleIssues and PRs exempt from automated stale handling.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions