///
export type PluginBuilder = (...args: Args) => Plugin;
import Nock = require('nock');
export interface Context {
test: (typeof it | typeof it.skip);
plugins: {
[k: string]: PluginBuilder;
};
expectation?: string;
chain: Plugin[];
error?: Error & {
code?: string;
};
retries?: number;
timeout?: number;
}
export interface Plugin {
run?(context: I): any;
init?(context: I): any;
finally?(context: I): any;
catch?(context: I): any;
}
export interface PluginDef {
output: Record | unknown;
args: any[];
}
export interface Plugins {
[k: string]: PluginDef;
}
export interface ITestCallbackContext {
skip(): this;
timeout(ms: number | string): this;
retries(n: number): this;
slow(ms: number): this;
[index: string]: any;
}
export type MochaCallback = (this: ITestCallbackContext, context: I, done: MochaDone) => any;
export interface It {
(expectation: string, cb?: MochaCallback): void;
(cb?: MochaCallback): void;
}
export type Base = {
it: It;
end: It;
add(key: K, cb: ((context: I) => O | Promise) | O | Promise): Base;
do(cb: (context: I & O) => any): Base;
finally(cb: (context: I) => any): Base;
register(key: K, plugin: (...args: A) => Plugin): Base;
} & {
[P in keyof T]: (...args: T[P]['args']) => Base;
};
export interface EnvOptions {
clear?: boolean;
}
export type MochaDone = (err?: any) => void;
export interface NockScope extends Nock.Scope {
}
export interface NockOptions extends Nock.Options {
}
export type NockCallback = (nock: NockScope) => any;