Running detox test runs all tests in the suite. Is there a way to run a subset of the tests? A single test file, or a single test case.
I've configured Detox to use Mocha as the test runner, as per the docs. I know that Mocha has a -g option to specify a pattern for the tests to run. But options passed to the detox command don't seem to be passed along to mocha:
# detox test -g mytestcase
error: unknown option `-g'
I'm attempting to use Detox for TDD, and the quicker the feedback I can get, the better. As my test suite grows, it would become less and less motivating to run tests as I develop if the time to run gets longer and longer.
Edit: Turns out you don't need the -f flag at all.
You can just do detox test /path/to/yourTest.spec.js and it works for single files (tested on v14.4.1).
Source
I ended up using the -f parameter for testing a specific test.
detox test -f /path/to/yourTest.spec.js
Came across it from the repo. Looks like it may have been updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With