Skip to content

Commit b0ae417

Browse files
committed
add extended types for "node:test"
1 parent e5b83b0 commit b0ae417

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3232
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3333
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
34+
"typeRoots": [
35+
"./types"
36+
] /* Specify multiple folders that act like './node_modules/@types'. */,
3537
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
3638
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
3739
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */

types/node-test.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import "node:test";
2+
3+
declare module "node:test" {
4+
interface TestContext {
5+
readonly assert: {
6+
equal(actual: unknown, expected: unknown, message?: string | Error): void;
7+
strictEqual(
8+
actual: unknown,
9+
expected: unknown,
10+
message?: string | Error,
11+
): void;
12+
deepStrictEqual(
13+
actual: unknown,
14+
expected: unknown,
15+
message?: string | Error,
16+
): void;
17+
snapshot(v: unknown): void;
18+
};
19+
}
20+
}

0 commit comments

Comments
 (0)