///
interface ChaiAsPromised extends Chai.ChaiPlugin {
transferPromiseness(assertion: Chai.PromisedAssertion, promise: PromiseLike): void;
transformAsserterArgs(values: any[]): any;
}
declare const chaiAsPromised: ChaiAsPromised;
export default chaiAsPromised;
declare global {
export namespace Chai {
// For BDD API
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
eventually: PromisedAssertion;
become(expected: any): PromisedAssertion;
fulfilled: PromisedAssertion;
rejected: PromisedAssertion;
rejectedWith: PromisedThrow;
notify(fn: Function): PromisedAssertion;
}
// Eventually does not have .then(), but PromisedAssertion have.
interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison {
// From chai-as-promised
become(expected: any): PromisedAssertion;
fulfilled: PromisedAssertion;
rejected: PromisedAssertion;
rejectedWith: PromisedThrow;
notify(fn: Function): PromisedAssertion;
// From chai
not: PromisedAssertion;
deep: PromisedDeep;
ordered: PromisedOrdered;
nested: PromisedNested;
any: PromisedKeyFilter;
all: PromisedKeyFilter;
a: PromisedTypeComparison;
an: PromisedTypeComparison;
include: PromisedInclude;
contain: PromisedInclude;
ok: PromisedAssertion;
true: PromisedAssertion;
false: PromisedAssertion;
null: PromisedAssertion;
undefined: PromisedAssertion;
NaN: PromisedAssertion;
exist: PromisedAssertion;
empty: PromisedAssertion;
arguments: PromisedAssertion;
Arguments: PromisedAssertion;
equal: PromisedEqual;
equals: PromisedEqual;
eq: PromisedEqual;
eql: PromisedEqual;
eqls: PromisedEqual;
property: PromisedProperty;
ownProperty: PromisedOwnProperty;
haveOwnProperty: PromisedOwnProperty;
ownPropertyDescriptor: PromisedOwnPropertyDescriptor;
haveOwnPropertyDescriptor: PromisedOwnPropertyDescriptor;
length: PromisedLength;
lengthOf: PromisedLength;
match: PromisedMatch;
matches: PromisedMatch;
string(string: string, message?: string): PromisedAssertion;
keys: PromisedKeys;
key(string: string): PromisedAssertion;
throw: PromisedThrow;
throws: PromisedThrow;
Throw: PromisedThrow;
respondTo: PromisedRespondTo;
respondsTo: PromisedRespondTo;
itself: PromisedAssertion;
satisfy: PromisedSatisfy;
satisfies: PromisedSatisfy;
closeTo: PromisedCloseTo;
approximately: PromisedCloseTo;
members: PromisedMembers;
increase: PromisedPropertyChange;
increases: PromisedPropertyChange;
decrease: PromisedPropertyChange;
decreases: PromisedPropertyChange;
change: PromisedPropertyChange;
changes: PromisedPropertyChange;
extensible: PromisedAssertion;
sealed: PromisedAssertion;
frozen: PromisedAssertion;
oneOf(list: any[], message?: string): PromisedAssertion;
}
interface PromisedAssertion extends Eventually, PromiseLike {
}
interface PromisedLanguageChains {
eventually: Eventually;
// From chai
to: PromisedAssertion;
be: PromisedAssertion;
been: PromisedAssertion;
is: PromisedAssertion;
that: PromisedAssertion;
which: PromisedAssertion;
and: PromisedAssertion;
has: PromisedAssertion;
have: PromisedAssertion;
with: PromisedAssertion;
at: PromisedAssertion;
of: PromisedAssertion;
same: PromisedAssertion;
but: PromisedAssertion;
does: PromisedAssertion;
}
interface PromisedNumericComparison {
above: PromisedNumberComparer;
gt: PromisedNumberComparer;
greaterThan: PromisedNumberComparer;
least: PromisedNumberComparer;
gte: PromisedNumberComparer;
below: PromisedNumberComparer;
lt: PromisedNumberComparer;
lessThan: PromisedNumberComparer;
most: PromisedNumberComparer;
lte: PromisedNumberComparer;
within(start: number, finish: number, message?: string): PromisedAssertion;
}
interface PromisedNumberComparer {
(value: number, message?: string): PromisedAssertion;
}
interface PromisedTypeComparison {
(type: string, message?: string): PromisedAssertion;
instanceof: PromisedInstanceOf;
instanceOf: PromisedInstanceOf;
}
interface PromisedInstanceOf {
(constructor: Object, message?: string): PromisedAssertion;
}
interface PromisedCloseTo {
(expected: number, delta: number, message?: string): PromisedAssertion;
}
interface PromisedNested {
include: PromisedInclude;
property: PromisedProperty;
members: PromisedMembers;
}
interface PromisedDeep {
equal: PromisedEqual;
equals: PromisedEqual;
eq: PromisedEqual;
include: PromisedInclude;
property: PromisedProperty;
members: PromisedMembers;
ordered: PromisedOrdered;
}
interface PromisedOrdered {
members: PromisedMembers;
}
interface PromisedKeyFilter {
keys: PromisedKeys;
}
interface PromisedEqual {
(value: any, message?: string): PromisedAssertion;
}
interface PromisedProperty {
(name: string | symbol, value?: any, message?: string): PromisedAssertion;
}
interface PromisedOwnProperty {
(name: string | symbol, message?: string): PromisedAssertion;
}
interface PromisedOwnPropertyDescriptor {
(name: string | symbol, descriptor: PropertyDescriptor, message?: string): PromisedAssertion;
(name: string | symbol, message?: string): PromisedAssertion;
}
interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison {
(length: number, message?: string): PromisedAssertion;
}
interface PromisedInclude {
(value: Object, message?: string): PromisedAssertion;
(value: string, message?: string): PromisedAssertion;
(value: number, message?: string): PromisedAssertion;
keys: PromisedKeys;
deep: PromisedDeep;
ordered: PromisedOrdered;
members: PromisedMembers;
any: PromisedKeyFilter;
all: PromisedKeyFilter;
}
interface PromisedMatch {
(regexp: RegExp | string, message?: string): PromisedAssertion;
}
interface PromisedKeys {
(...keys: string[]): PromisedAssertion;
(keys: any[]): PromisedAssertion;
(keys: Object): PromisedAssertion;
}
interface PromisedThrow {
(): PromisedAssertion;
(expected: string | RegExp, message?: string): PromisedAssertion;
(constructor: Error | Function, expected?: string | RegExp, message?: string): PromisedAssertion;
}
interface PromisedRespondTo {
(method: string, message?: string): PromisedAssertion;
}
interface PromisedSatisfy {
(matcher: Function, message?: string): PromisedAssertion;
}
interface PromisedMembers {
(set: any[], message?: string): PromisedAssertion;
}
interface PromisedPropertyChange {
(object: Object, property: string, message?: string): PromisedAssertion;
}
// For Assert API
interface Assert {
eventually: PromisedAssert;
isFulfilled(promise: PromiseLike, message?: string): PromiseLike;
becomes(promise: PromiseLike, expected: any, message?: string): PromiseLike;
doesNotBecome(promise: PromiseLike, expected: any, message?: string): PromiseLike;
isRejected(promise: PromiseLike, message?: string): PromiseLike;
isRejected(promise: PromiseLike, expected: any, message?: string): PromiseLike;
isRejected(promise: PromiseLike, match: RegExp, message?: string): PromiseLike;
notify(fn: Function): PromiseLike;
}
export interface PromisedAssert {
fail(actual?: PromiseLike, expected?: any, msg?: string, operator?: string): PromiseLike;
isOk(val: PromiseLike, msg?: string): PromiseLike;
ok(val: PromiseLike, msg?: string): PromiseLike;
isNotOk(val: PromiseLike, msg?: string): PromiseLike;
notOk(val: PromiseLike, msg?: string): PromiseLike;
equal(act: PromiseLike, exp: any, msg?: string): PromiseLike;
notEqual(act: PromiseLike, exp: any, msg?: string): PromiseLike;
strictEqual(act: PromiseLike, exp: any, msg?: string): PromiseLike;
notStrictEqual(act: PromiseLike, exp: any, msg?: string): PromiseLike;
deepEqual(act: PromiseLike, exp: any, msg?: string): PromiseLike;
notDeepEqual(act: PromiseLike, exp: any, msg?: string): PromiseLike;
isAbove(val: PromiseLike, above: number, msg?: string): PromiseLike;
isAtLeast(val: PromiseLike, atLeast: number, msg?: string): PromiseLike;
isAtBelow(val: PromiseLike, below: number, msg?: string): PromiseLike;
isAtMost(val: PromiseLike, atMost: number, msg?: string): PromiseLike;
isTrue(val: PromiseLike, msg?: string): PromiseLike;
isFalse(val: PromiseLike, msg?: string): PromiseLike;
isNotTrue(val: PromiseLike, msg?: string): PromiseLike;
isNotFalse(val: PromiseLike, msg?: string): PromiseLike;
isNull(val: PromiseLike, msg?: string): PromiseLike;
isNotNull(val: PromiseLike, msg?: string): PromiseLike;
isNaN(val: PromiseLike, msg?: string): PromiseLike;
isNotNaN(val: PromiseLike, msg?: string): PromiseLike;
exists(val: PromiseLike, msg?: string): PromiseLike;
notExists(val: PromiseLike, msg?: string): PromiseLike;
isUndefined(val: PromiseLike, msg?: string): PromiseLike;
isDefined(val: PromiseLike, msg?: string): PromiseLike;
isFunction(val: PromiseLike, msg?: string): PromiseLike;
isNotFunction(val: PromiseLike, msg?: string): PromiseLike;
isObject(val: PromiseLike, msg?: string): PromiseLike;
isNotObject(val: PromiseLike, msg?: string): PromiseLike;
isArray(val: PromiseLike, msg?: string): PromiseLike;
isNotArray(val: PromiseLike, msg?: string): PromiseLike;
isString(val: PromiseLike, msg?: string): PromiseLike;
isNotString(val: PromiseLike, msg?: string): PromiseLike;
isNumber(val: PromiseLike, msg?: string): PromiseLike;
isNotNumber(val: PromiseLike, msg?: string): PromiseLike;
isFinite(val: PromiseLike, msg?: string): PromiseLike;
isBoolean(val: PromiseLike, msg?: string): PromiseLike;
isNotBoolean(val: PromiseLike, msg?: string): PromiseLike;
typeOf(val: PromiseLike, type: string, msg?: string): PromiseLike;
notTypeOf(val: PromiseLike, type: string, msg?: string): PromiseLike;
instanceOf(val: PromiseLike, type: Function, msg?: string): PromiseLike;
notInstanceOf(val: PromiseLike, type: Function, msg?: string): PromiseLike;
include(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
include(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
notInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
notInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
deepInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
deepInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
notDeepInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
notDeepInclude(exp: PromiseLike, inc: any, msg?: string): PromiseLike;
nestedInclude(exp: PromiseLike