kibana/packages/kbn-expect/expect.d.ts

222 lines
4.1 KiB
TypeScript
Raw Normal View History

Migrate from tslint (#33826) * chore(NA): remove tslint dependencies, configs and enable eslint typescript parser. * fix(NA): apply recommend eslint typescript rule.s * chore(NA): upgrade eslint package versions. * chore(NA): split javascript eslint config in an override section. * chore(NA): split all eslint configs with overrides. * chore(NA): remove missing console.log. * chore(NA): change eslint splits and overrides order. * chore(NA): replace tslint disable comments with eslint ones. * chore(NA): solve eslint typescript errors for elastic/kibana-custom/no-default-export * chore(NA): fixed multiple eslint typescript rule failures. * chore(NA): add tarfet folder to the eslint ignore. * chore(NA): apply prettier rule to ts type file. * chore(NA): remove last mentions to tslint * chore(NA): add old defined rules * chore(NA): missing port rules website * chore(na): ordered rules * chore(NA): solved eslint typescript problems. * chore(NA): fix spaced comment problems. * chore(NA): fix some more eslint typescript rules: import/order no-empty-interface * chore(NA): fix last rules and comment out what are the ones still failing. * chore(NA): comment out camelcase rule. * chore(NA): regenerate kbn pm dist. * chore(NA): updated snapshots. * chore(NA): updated snapshots. * chore(NA): disabled sort-keys rule. * chore(NA): remove rule prefer-arrow/prefer-arrow-functions. * chore(NA): fix for @typescript-eslint/no-var-requires rule. * chore(NA): fixes for @typescript-eslint/camelcase rule. * chore(NA): fix typo on eslint config kibana typescript. Co-Authored-By: mistic <tiagoffcc@hotmail.com> * chore(NA): remove legacy note after the intellij upgrade to 2019.1 * fix(NA): import order plugin. * chore(NA): fix ts ignore positions after auto fix. * fix(NA): performance issue with typescript eslint. * refact(NA): eslint configs organization. * chore(NA): apply resticted paths to ts files too. * chore(NA): split comment from eslint ignore.
2019-04-05 18:45:23 +02:00
/* eslint-disable */
// Type definitions for expect.js 0.3.1
// Project: https://github.com/Automattic/expect.js
// Definitions by: Teppei Sato <https://github.com/teppeis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// License: MIT
export default function expect(target?: any): Root;
interface Assertion {
/**
* Assert typeof / instanceof.
*/
an: An;
/**
* Check if the value is truthy
*/
ok(): void;
/**
* Creates an anonymous function which calls fn with arguments.
*/
withArgs(...args: any[]): Root;
/**
* Assert that the function throws.
*
* @param fn callback to match error string against
*/
throwError(fn?: (exception: any) => void): void;
/**
* Assert that the function throws.
*
* @param fn callback to match error string against
*/
throwException(fn?: (exception: any) => void): void;
/**
* Assert that the function throws.
*
* @param regexp regexp to match error string against
*/
throwError(regexp: RegExp): void;
/**
* Assert that the function throws.
*
* @param fn callback to match error string against
*/
throwException(regexp: RegExp): void;
/**
* Checks if the array is empty.
*/
empty(): Assertion;
/**
* Checks if the obj exactly equals another.
*/
equal(obj: any, msg?: string): Assertion;
/**
* Checks if the obj sortof equals another.
*/
eql(obj: any, msg?: string): Assertion;
/**
* Assert within start to finish (inclusive).
*
* @param start
* @param finish
*/
within(start: number, finish: number, msg?: string): Assertion;
/**
* Assert typeof.
*/
a(type: string): Assertion;
/**
* Assert instanceof.
*/
a(type: Function): Assertion;
/**
* Assert numeric value above n.
*/
greaterThan(n: number, msg?: string): Assertion;
/**
* Assert numeric value above n.
*/
above(n: number, msg?: string): Assertion;
/**
* Assert numeric value below n.
*/
lessThan(n: number, msg?: string): Assertion;
/**
* Assert numeric value below n.
*/
below(n: number, msg?: string): Assertion;
/**
* Assert string value matches regexp.
*
* @param regexp
*/
match(regexp: RegExp, msg?: string): Assertion;
/**
* Assert property "length" exists and has value of n.
*
* @param n
*/
length(n: number, msg?: string): Assertion;
/**
* Assert property name exists, with optional val.
*
* @param name
* @param val
*/
property(name: string, val?: any): Assertion;
/**
* Assert that string contains str.
*/
contain(str: string, msg?: string): Assertion;
string(str: string, msg?: string): Assertion;
/**
* Assert that the array contains obj.
*/
contain(obj: any, msg?: string): Assertion;
string(obj: any, msg?: string): Assertion;
/**
* Assert exact keys or inclusion of keys by using the `.own` modifier.
*/
key(keys: string[]): Assertion;
/**
* Assert exact keys or inclusion of keys by using the `.own` modifier.
*/
key(...keys: string[]): Assertion;
/**
* Assert exact keys or inclusion of keys by using the `.own` modifier.
*/
keys(keys: string[]): Assertion;
/**
* Assert exact keys or inclusion of keys by using the `.own` modifier.
*/
keys(...keys: string[]): Assertion;
/**
* Assert a failure.
*/
fail(message?: string): Assertion;
}
interface Root extends Assertion {
not: Not;
to: To;
only: Only;
have: Have;
be: Be;
}
interface Be extends Assertion {
/**
* Checks if the obj exactly equals another.
*/
(obj: any): Assertion;
an: An;
}
interface An extends Assertion {
/**
* Assert typeof.
*/
(type: string): Assertion;
/**
* Assert instanceof.
*/
(type: Function): Assertion;
}
interface Not extends NotBase {
to: ToBase;
}
interface NotBase extends Assertion {
be: Be;
have: Have;
include: Assertion;
only: Only;
}
interface To extends ToBase {
not: NotBase;
}
interface ToBase extends Assertion {
be: Be;
have: Have;
include: Assertion;
only: Only;
}
interface Only extends Assertion {
have: Have;
}
interface Have extends Assertion {
own: Assertion;
}