mocha-suite
Version:
suite-level wrapper for mocha's describe
24 lines (23 loc) • 1.07 kB
TypeScript
import * as mocha from 'mocha';
declare function Suite<T, U>(suite: (tests: Suite.Tests<T>, opts?: U) => void, _describe?: mocha.IContextDefinition): Suite.ModifiedDescription<T, U>;
declare namespace Suite {
type Builder = <T, U>(modifier?: Suite.Modifier) => ContextDescription<T, U>;
type BuildDescription = <T, U>(builder: Suite.Builder) => ModifiedDescription<T, U>;
type Tests<T> = (utils: T) => void;
type Modifier = 'only' | 'skip';
interface ContextDescription<T, U> {
(description: string, tests: Suite.Tests<T>): void;
(description: string, opts: U, tests: Suite.Tests<T>): void;
}
interface ModifiedDescription<T, U> extends ContextDescription<T, U> {
only: ContextDescription<T, U>;
skip: ContextDescription<T, U>;
}
namespace Modifier {
const ONLY: Modifier;
const SKIP: Modifier;
}
const build: BuildDescription;
const run: (modifier: Modifier, _describe: mocha.IContextDefinition, description: string, suite: () => void) => void | mocha.ISuite;
}
export = Suite;