UNPKG

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