id | title |
---|---|
Guide.Jest |
Jest |
0. Use the Getting Started Guide to set up Detox
npm install --save-dev jest
detox init -r jest
"scripts": {
"test:e2e": "detox test -c ios.sim.debug",
"test:e2e:build": "detox build"
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json"
...
}
There are some things you should notice:
- Don't worry about mocks being used, Detox works on the compiled version of your app.
- Detox exposes it's primitives (
expect
,device
, ...) globally, it will override Jest's globalexpect
object.
- If you have a setup file for the unit tests pass
./jest/setup
implementation into your unit setup. - Call your E2E tests using
detox-cli
:detox test