mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add power-assert/power-assert.d.ts
This commit is contained in:
parent
9cb712a40b
commit
5869759742
1
assert/assert.d.ts
vendored
1
assert/assert.d.ts
vendored
@ -57,6 +57,7 @@ declare module assert {
|
||||
// export = assert;
|
||||
// }
|
||||
|
||||
// move to power-assert.d.ts. do not use this definition file.
|
||||
declare module "power-assert" {
|
||||
export = assert;
|
||||
}
|
||||
|
||||
19
power-assert/power-assert-tests.ts
Normal file
19
power-assert/power-assert-tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="./power-assert.d.ts" />
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.throws(() => {
|
||||
throw "a hammer at your face";
|
||||
}, undefined, "DODGED IT");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
if (false) {
|
||||
throw "a hammer at your face";
|
||||
}
|
||||
}, undefined, "What the...*crunch*");
|
||||
56
power-assert/power-assert.d.ts
vendored
Normal file
56
power-assert/power-assert.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
// Type definitions for power-assert
|
||||
// Project: https://github.com/twada/power-assert
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// copy from assert external module in node.d.ts
|
||||
|
||||
declare function assert(value:any, message?:string):void;
|
||||
declare module assert {
|
||||
export class AssertionError implements Error {
|
||||
name:string;
|
||||
message:string;
|
||||
actual:any;
|
||||
expected:any;
|
||||
operator:string;
|
||||
generatedMessage:boolean;
|
||||
|
||||
constructor(options?:{message?: string; actual?: any; expected?: any; operator?: string; stackStartFunction?: Function});
|
||||
}
|
||||
|
||||
export function fail(actual?:any, expected?:any, message?:string, operator?:string):void;
|
||||
|
||||
export function ok(value:any, message?:string):void;
|
||||
|
||||
export function equal(actual:any, expected:any, message?:string):void;
|
||||
|
||||
export function notEqual(actual:any, expected:any, message?:string):void;
|
||||
|
||||
export function deepEqual(actual:any, expected:any, message?:string):void;
|
||||
|
||||
export function notDeepEqual(acutal:any, expected:any, message?:string):void;
|
||||
|
||||
export function strictEqual(actual:any, expected:any, message?:string):void;
|
||||
|
||||
export function notStrictEqual(actual:any, expected:any, message?:string):void;
|
||||
|
||||
export var throws:{
|
||||
(block:Function, message?:string): void;
|
||||
(block:Function, error:Function, message?:string): void;
|
||||
(block:Function, error:RegExp, message?:string): void;
|
||||
(block:Function, error:(err:any) => boolean, message?:string): void;
|
||||
};
|
||||
|
||||
export var doesNotThrow:{
|
||||
(block:Function, message?:string): void;
|
||||
(block:Function, error:Function, message?:string): void;
|
||||
(block:Function, error:RegExp, message?:string): void;
|
||||
(block:Function, error:(err:any) => boolean, message?:string): void;
|
||||
};
|
||||
|
||||
export function ifError(value:any):void;
|
||||
}
|
||||
|
||||
declare module "power-assert" {
|
||||
export = assert;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user