There's no support for multiple mocha.opts
files being active for a single invocation of Mocha. You could have two Mocha invocations each with their own mocha.opts
, however.
If you want everything in a single Mocha invocation, and set different timeouts for different parts of the suite, there's no direct way for telling Mocha "files in this directory have one timeout, and files in that other directory have another timeout". You are limited to calling this.timeout
in your callbacks, like this:
describe("User view", function () {
this.timeout(...);
// Tests....
});
If you structure your suite so that all integration tests are seen by Mocha as being descendants of a single top describe
, you can effectively set this timeout in only one location (the top describe
) for all your integration tests. See this question and its answers for ways to structure a suite in this way.