[assert] Fix passing RegEx to .throws

This commit is contained in:
Linus Unnebäck 2018-12-06 12:01:30 +00:00
parent a7e0763b93
commit 75d166174f
No known key found for this signature in database
GPG Key ID: CE70CEAE9C0FA66F
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@ assert(true, "it's working");
assert.ok(true, "inner functions work as well");
assert.throws(() => {});
assert.throws(() => {}, /Regex test/);
assert.throws(() => {}, () => {}, "works wonderfully");
assert['fail'](true, true, "works like a charm");

View File

@ -1,6 +1,7 @@
// Type definitions for commonjs-assert 1.4
// Project: https://github.com/browserify/commonjs-assert
// Definitions by: Nico Gallinal <https://github.com/nicoabie>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function assert(value: any, message?: string): void;
@ -23,10 +24,10 @@ declare namespace assert {
function notStrictEqual(actual: any, expected: any, message?: string): void;
function throws(block: () => void, message?: string): void;
function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
function throws(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
function doesNotThrow(block: () => void, message?: string): void;
function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
function doesNotThrow(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
function ifError(value: any): void;