UNPKG

2.53 kBTypeScriptView Raw
1// copy from assert external module in node.d.ts
2
3import { Options as EmpowerOptions } from "empower";
4import { Options as PowerAssertFormatterOptions } from "power-assert-formatter";
5
6export = assert;
7export as namespace assert;
8
9declare function assert(value: unknown, message?: string): void;
10declare namespace assert {
11 class AssertionError implements Error {
12 name: string;
13 message: string;
14 actual: unknown;
15 expected: unknown;
16 operator: string;
17 generatedMessage: boolean;
18
19 constructor(options?: {
20 message?: string | undefined;
21 actual?: unknown;
22 expected?: unknown;
23 operator?: string | undefined;
24 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
25 stackStartFunction?: () => void | undefined;
26 });
27 }
28
29 function fail(actual?: unknown, expected?: unknown, message?: string, operator?: string): never;
30 function ok(value: unknown, message?: string): void;
31 function equal(actual: unknown, expected: unknown, message?: string): void;
32 function notEqual(actual: unknown, expected: unknown, message?: string): void;
33 function deepEqual(actual: unknown, expected: unknown, message?: string): void;
34 function notDeepEqual(actual: unknown, expected: unknown, message?: string): void;
35 function strictEqual(actual: unknown, expected: unknown, message?: string): void;
36 function notStrictEqual(actual: unknown, expected: unknown, message?: string): void;
37 function deepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
38 function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
39 const throws: {
40 (block: () => unknown, message?: string): void;
41 (
42 block: () => unknown,
43 error: (new() => object) | RegExp | ((err: unknown) => boolean),
44 message?: string,
45 ): void;
46 };
47 const doesNotThrow: {
48 (block: () => unknown, message?: string): void;
49 (block: () => unknown, error: (new() => object) | RegExp | ((err: any) => boolean), message?: string): void;
50 };
51 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
52 function ifError(value: unknown): void | undefined;
53
54 const strict: typeof assert;
55
56 interface Options {
57 assertion?: EmpowerOptions | undefined;
58 output?: PowerAssertFormatterOptions | undefined;
59 }
60
61 function customize(options: Options): typeof assert;
62}
63
\No newline at end of file