Merge pull request #4341 from Asana/master

Adding Mocha TDD style
This commit is contained in:
Horiuchi_H
2015-05-14 18:23:24 +09:00
2 changed files with 50 additions and 4 deletions
+28 -1
View File
@@ -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);
});
}
}
+22 -3
View File
@@ -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;