mocha-parallel-tests icon indicating copy to clipboard operation
mocha-parallel-tests copied to clipboard

Exit with exitCode = test count when running with --forbid-only flag

Open Lakitna opened this issue 5 years ago • 0 comments

When running any test suite in a pipeline I always make sure to give the --forbid-only flag. When doing that with this package it exits the process with a non-zero exit code.

In fact, when I have 10 tests, it will fail with exit code 10. When I have 9 it will exit with 9 etc.

Are you using .only internally to make the parallelism work? If you do the implementation of --forbid-only can't be simply passed to Mocha. If not, this is probably a bug.

To make this work as expected we'll probably have to add some logic to https://github.com/mocha-parallel/mocha-parallel-tests/blob/master/src/bin/options/forbid-only.ts.

For now, I'll work around this with a linting rule to make sure no test is set to .only. https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-exclusive-tests.md

Lakitna avatar Apr 08 '20 12:04 Lakitna