mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #31122 from LinusU/assert-regex
[assert] Fix passing RegEx to .throws
This commit is contained in:
@@ -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");
|
||||
|
||||
Vendored
+3
-2
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user