Reputation: 1119
I try to create a test with mocha that has a timeout. However, I got an error TypeError: this.timeout is not a function
.
This seems to be an easy to solve error. But when I searched for this error I always find the solution: Don't use arrow functions
. Unfortunatly that does not seem to be the Problem here.
My simplified Test:
import 'mocha';
import 'ts-mockito';
describe('Function', function () {
it('function', function (done: MochaDone) {
this.timeout(5);
});
});
Upvotes: 2
Views: 2608
Reputation: 1119
I used another approach using anotaitions
@suite(timeout(3000), slow(1000))
export class MainTest {
@test async Test1() {
...
}
}
As discribed in the repo mocha-ts.
Upvotes: 4