123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- interface MochaSetupOptions {
-
- slow?: number;
-
- timeout?: number;
-
- ui?: string;
-
- globals?: any[];
-
- reporter?: any;
-
- bail?: boolean;
-
- ignoreLeaks?: boolean;
-
- grep?: any;
- }
- interface MochaDone {
- (error?: Error): void;
- }
- declare var mocha: Mocha;
- declare var describe: Mocha.IContextDefinition;
- declare var xdescribe: Mocha.IContextDefinition;
- declare var context: Mocha.IContextDefinition;
- declare var suite: Mocha.IContextDefinition;
- declare var it: Mocha.ITestDefinition;
- declare var xit: Mocha.ITestDefinition;
- declare var test: Mocha.ITestDefinition;
- declare function before(action: () => void): void;
- declare function before(action: (done: MochaDone) => void): void;
- declare function setup(action: () => void): void;
- declare function setup(action: (done: MochaDone) => void): void;
- declare function after(action: () => void): void;
- declare function after(action: (done: MochaDone) => void): void;
- declare function teardown(action: () => void): void;
- declare function teardown(action: (done: MochaDone) => void): void;
- declare function beforeEach(action: () => void): void;
- declare function beforeEach(action: (done: MochaDone) => void): void;
- declare function suiteSetup(action: () => void): void;
- declare function suiteSetup(action: (done: MochaDone) => void): void;
- declare function afterEach(action: () => void): void;
- declare function afterEach(action: (done: MochaDone) => void): void;
- declare function suiteTeardown(action: () => void): void;
- declare function suiteTeardown(action: (done: MochaDone) => void): void;
- declare class Mocha {
- constructor(options?: {
- grep?: RegExp;
- ui?: string;
- reporter?: string;
- timeout?: number;
- bail?: boolean;
- });
-
- setup(options: MochaSetupOptions): Mocha;
- bail(value?: boolean): Mocha;
- addFile(file: string): Mocha;
-
- reporter(name: string): Mocha;
-
- reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
- ui(value: string): Mocha;
- grep(value: string): Mocha;
- grep(value: RegExp): Mocha;
- invert(): Mocha;
- ignoreLeaks(value: boolean): Mocha;
- checkLeaks(): Mocha;
-
- throwError(error: Error): void;
-
- growl(): Mocha;
- globals(value: string): Mocha;
- globals(values: string[]): Mocha;
- useColors(value: boolean): Mocha;
- useInlineDiffs(value: boolean): Mocha;
- timeout(value: number): Mocha;
- slow(value: number): Mocha;
- enableTimeouts(value: boolean): Mocha;
- asyncOnly(value: boolean): Mocha;
- noHighlighting(value: boolean): Mocha;
-
- run(onComplete?: (failures: number) => void): Mocha.IRunner;
- }
- declare module Mocha {
-
- interface IRunnable {
- title: string;
- fn: Function;
- async: boolean;
- sync: boolean;
- timedOut: boolean;
- }
-
- interface ISuite {
- parent: ISuite;
- title: string;
- fullTitle(): string;
- }
-
- interface ITest extends IRunnable {
- parent: ISuite;
- pending: boolean;
- fullTitle(): string;
- }
-
- interface IRunner {}
- interface IContextDefinition {
- (description: string, spec: () => void): ISuite;
- only(description: string, spec: () => void): ISuite;
- skip(description: string, spec: () => void): void;
- timeout(ms: number): void;
- }
- interface ITestDefinition {
- (expectation: string, assertion?: () => void): ITest;
- (expectation: string, assertion?: (done: MochaDone) => void): ITest;
- only(expectation: string, assertion?: () => void): ITest;
- only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
- skip(expectation: string, assertion?: () => void): void;
- skip(expectation: string, assertion?: (done: MochaDone) => void): void;
- timeout(ms: number): void;
- }
- export module reporters {
- export class Base {
- stats: {
- suites: number;
- tests: number;
- passes: number;
- pending: number;
- failures: number;
- };
- constructor(runner: IRunner);
- }
- export class Doc extends Base {}
- export class Dot extends Base {}
- export class HTML extends Base {}
- export class HTMLCov extends Base {}
- export class JSON extends Base {}
- export class JSONCov extends Base {}
- export class JSONStream extends Base {}
- export class Landing extends Base {}
- export class List extends Base {}
- export class Markdown extends Base {}
- export class Min extends Base {}
- export class Nyan extends Base {}
- export class Progress extends Base {
- /**
- * @param options.open String used to indicate the start of the progress bar.
- * @param options.complete String used to indicate a complete test on the progress bar.
- * @param options.incomplete String used to indicate an incomplete test on the progress bar.
- * @param options.close String used to indicate the end of the progress bar.
- */
- constructor(runner: IRunner, options?: {
- open?: string;
- complete?: string;
- incomplete?: string;
- close?: string;
- });
- }
- export class Spec extends Base {}
- export class TAP extends Base {}
- export class XUnit extends Base {
- constructor(runner: IRunner, options?: any);
- }
- }
- }
- declare module "mocha" {
- export = Mocha;
- }
|