🌟

Node.js 18 の node:test の型

2022/04/25に公開約400字

@types/node にまだなさそうだから

declare module "node:test" {
  type TestContext = {
    diagnostic(message: string): void;
    runOnly(shouldRunOnlyTests: boolean): void;
    skip(...message: string[]): void;
    todo(...message: string[]): void;
    test: Test;
  };
  type TestCb =
    | ((testContext: TestContext) => void)
    | ((testContext: TestContext) => Promise<void>);
  type Test = (name: string, cb: TestCb) => void;
  const test: Test;
  export default test;
}

Discussion

ログインするとコメントできます