DJ-Glock
DJ-Glock

Reputation: 1411

Mocha: run tests in parallel and serial mode

I use mocha for running tests and mocha-teamcity-reporter as a reporter for teamcity. I have test files that can be run in parallel. And also I have some test files that should be run one by one - in serial mode. As I understood mocha documentation, mocha can run test files only in parallel or in serial mode. So I tried to do the following: run two mocha runs with & command in one yarn script, like this:

mocha --reporter mocha-teamcity-reporter --timeout 90000 -r ts-node/register/transpile-only src/Tests/.ts --parallel --jobs 4 & mocha --reporter mocha-teamcity-reporter --timeout 90000 -r ts-node/register/transpile-only src/Tests/seq.ts

But using this approach for some reason reporter does not work properly and TeamCity does not detect all tests that were run. Is there any way to run tests like I want with mocha and mocha-teamcity-reporter?

Upvotes: 2

Views: 2061

Answers (1)

DJ-Glock
DJ-Glock

Reputation: 1411

Okay, seems that this is the only way to do it. Mentioned issue with tests detecting was resolved in one of the recent mocha updates.

Upvotes: 1

Related Questions