Can I set mocha timeout per directory? -
i have 2 tests directories. unit tests, , integration tests. both use mocha.
unit tests run on average between 1-5 ms. unfortunately our integration tests take longer. of them 30 seconds.
i wondering if set timeout 30 seconds test/integration directory, leave test/unit using default mocha timeout (2 seconds) in mocha.opts file. or perhaps have multiple mocha.opts files.
there's no support multiple mocha.opts files being active single invocation of mocha. have 2 mocha invocations each own mocha.opts, however.
if want in single mocha invocation, , set different timeouts different parts of suite, there's no direct way telling mocha "files in directory have 1 timeout, , files in other directory have timeout". limited calling this.timeout in callbacks, this:
describe("user view", function () { this.timeout(...); // tests.... }); if structure suite integration tests seen mocha being descendants of single top describe, can set timeout in 1 location (the top describe) integration tests. see this question , answers ways structure suite in way.
Comments
Post a Comment