(
name: keyof Assertion | (keyof Assertion)[],
fn: (this: Chai.AssertionStatic & Assertion, ...args: any[]) => any,
)
| 40 | const customTesters = getCustomEqualityTesters() |
| 41 | |
| 42 | function def( |
| 43 | name: keyof Assertion | (keyof Assertion)[], |
| 44 | fn: (this: Chai.AssertionStatic & Assertion, ...args: any[]) => any, |
| 45 | ) { |
| 46 | const addMethod = (n: keyof Assertion) => { |
| 47 | const softWrapper = wrapAssertion(utils, n, fn) |
| 48 | utils.addMethod(chai.Assertion.prototype, n, softWrapper) |
| 49 | utils.addMethod( |
| 50 | (globalThis as any)[JEST_MATCHERS_OBJECT].matchers, |
| 51 | n, |
| 52 | softWrapper, |
| 53 | ) |
| 54 | } |
| 55 | |
| 56 | if (Array.isArray(name)) { |
| 57 | name.forEach(n => addMethod(n)) |
| 58 | } |
| 59 | else { |
| 60 | addMethod(name) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | (['throw', 'throws', 'Throw'] as const).forEach((m) => { |
| 65 | utils.overwriteMethod(chai.Assertion.prototype, m, (_super: any) => { |
no test coverage detected