mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Added assert.d.ts
This commit is contained in:
@@ -37,6 +37,7 @@ List of Definitions
|
||||
* [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted))
|
||||
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
|
||||
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
|
||||
* [assert](https://github.com/Jxck/assert) (by [vvakame](https://github.com/vvakame))
|
||||
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone Relational](http://backbonerelational.org/) (by [Eirik Hoem](https://github.com/eirikhm))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="./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*");
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// Type definitions for assert and power-assert
|
||||
// Project: https://github.com/Jxck/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
|
||||
|
||||
function assert(value:any, message?:string):void;
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user