Skip to content

Bug: [no-floating-promises] allowForKnownSafeCalls no longer works for describe function with newer node:test typings #11372

Open
@kayahr

Description

@kayahr

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.8.2&fileType=.tsx&code=JYWwDg9gTgLgBAbzgEwKYGcDGVgCNUA0cw8AvnAGZQQhwBEAdhGgFwwYx0BQXaWO%2BABR0KECHSKCAlHAC8APkRc4xGMNwBDKBLjS5ihMrikpAbi4nzXIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oDN4OBDfMwDmtYtA4BbSshTowAbXDYcAd37QmkADSZlKnP3h9VAMQ7QA0p1VMAyv26IAwkfioMSgwazeDkbglJeUhifjIAa35hRB19PxwmfklYzyhKfB0oABNyKgAjWN1IfBRM4uRYDNiwAF1teITQ8KiYkM5ctFLkTMaDAF8%2BiFq%2BwZURiEH%2BoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

import { describe, it } from "node:test"

describe("foo", () => {
  it("bar", () => {
  });
});

ESLint Config

{
  "rules": {
    "@typescript-eslint/no-floating-promises": [
      "warn", {
        "allowForKnownSafeCalls": [
          {
            "from": "package",
            "name": [ "it", "describe", "test", "suite" ],
            "package": "node:test"
          }
        ]
      }
    ]
  }
}

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

The floating-promise warning should be ignored for describe and it calls from node:test.

Actual Result

Since @types/node version 24.0.9 it only works for it but no longer for describe. With version 24.0.8 it works for both calls.

Additional Info

In @types/node version 24.0.8 the it and describe functions were exported directly. Since 24.0.9 the functions are exported as an alias:

namespace test {
    export { test };
    export { suite as describe, test as it };
}
// ...
export = test;

The it function only works when I also add the test function in the allowForKnownSafeCalls config. But adding suite doesn't fix the problem with describe.

The export definitions in @types/node are syntactically correct, no compiler and runtime errors. So I guess this is a bug in typescript-eslint that these definitions are not parsed correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions