Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run individual Detox test

Tags:

detox

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.

like image 787
Josh Justice Avatar asked Jan 19 '18 12:01

Josh Justice


1 Answers

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.

like image 86
Simon Avatar answered Sep 22 '22 09:09

Simon