Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export TestContext in node:test #67127 #69496

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions types/node/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ declare module "node:test" {
skip,
test,
test as default,
TestContext,
todo,
};
}
Expand Down
24 changes: 22 additions & 2 deletions types/node/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import { Transform, TransformCallback, TransformOptions } from "node:stream";
import { after, afterEach, before, beforeEach, describe, it, Mock, mock, only, run, skip, test, todo } from "node:test";
import {
after,
afterEach,
before,
beforeEach,
describe,
it,
Mock,
mock,
only,
run,
skip,
test,
TestContext,
todo,
} from "node:test";
import { dot, junit, lcov, spec, tap, TestEvent } from "node:test/reporters";

// run without options
Expand Down Expand Up @@ -38,7 +53,12 @@ test("foo", t => {
t;
});

test("foo", (t) => {
test("foo", (t: TestContext) => {
// $ExpectType TestContext
t;
});

test("foo", t => {
// $ExpectType Promise<void>
t.test();
});
Expand Down