diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index 597d9cbe2..672fac1cb 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -12,6 +12,18 @@ function test_describe() { }); } +function test_context() { + context('some context', () => { }); + + context.only('some context', () => { }); + + context.skip('some context', () => { }); + + context('some context', function() { + this.timeout(2000); + }); +} + function test_it() { it('does something', () => { }); diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 9b55761c6..ce0f15b38 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -1,6 +1,6 @@ // Type definitions for mocha 1.17.1 // Project: http://visionmedia.github.io/mocha/ -// Definitions by: Kazi Manzur Rashid +// Definitions by: Kazi Manzur Rashid and otiai10 // DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped interface Mocha { @@ -59,6 +59,14 @@ declare var describe : { timeout(ms: number): void; } +// alias for `describe` +declare var context : { + (contextTitle: string, spec: () => void): void; + only(contextTitle: string, spec: () => void): void; + skip(contextTitle: string, spec: () => void): void; + timeout(ms: number): void; +} + declare var it: { (expectation: string, assertion?: () => void): void; (expectation: string, assertion?: (done: MochaDone) => void): void;