diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index dffd86e44..f90fefaf9 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -24,6 +24,18 @@ function test_context() { }); } +function test_suite() { + suite('some context', () => { }); + + suite.only('some context', () => { }); + + suite.skip('some context', () => { }); + + suite('some context', function() { + this.timeout(2000); + }); +} + function test_it() { it('does something', () => { }); @@ -39,6 +51,21 @@ function test_it() { }); } +function test_test() { + + test('does something', () => { }); + + test('does something', (done) => { done(); }); + + test.only('does something', () => { }); + + test.skip('does something', () => { }); + + test('does something', function () { + this.timeout(2000); + }); +} + function test_before() { before(() => { }); @@ -221,4 +248,4 @@ function test_run_withOnComplete() { instance.run((failures: number): void => { console.log(failures); }); -} \ No newline at end of file +} diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 3f5d3e571..63ad66014 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -52,7 +52,7 @@ interface MochaDone { declare var mocha: Mocha; -declare var describe : { +declare var describe: { (description: string, spec: () => void): void; only(description: string, spec: () => void): void; skip(description: string, spec: () => void): void; @@ -60,12 +60,20 @@ declare var describe : { } // alias for `describe` -declare var context : { +declare var context: { (contextTitle: string, spec: () => void): void; only(contextTitle: string, spec: () => void): void; skip(contextTitle: string, spec: () => void): void; timeout(ms: number): void; -} +}; + +// alias for `describe` +declare var suite: { + (suiteTitle: string, spec: () => void): void; + only(suiteTitle: string, spec: () => void): void; + skip(suiteTitle: string, spec: () => void): void; + timeout(ms: number): void; +}; declare var it: { (expectation: string, assertion?: () => void): void; @@ -77,6 +85,17 @@ declare var it: { timeout(ms: number): void; }; +// alias for `it` +declare var test: { + (expectation: string, assertion?: () => void): void; + (expectation: string, assertion?: (done: MochaDone) => void): void; + only(expectation: string, assertion?: () => void): void; + only(expectation: string, assertion?: (done: MochaDone) => void): void; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; +}; + declare function before(action: () => void): void; declare function before(action: (done: MochaDone) => void): void;