949 B
949 B
id, title
| id | title |
|---|---|
| Guide.Jest | Jest |
Usage
0. Use the Getting Started Guide to set up Detox
1. Install Jest
npm install --save-dev jest
2. Run detox init
detox init -r jest
3. Modify package.json
"scripts": {
"test:e2e": "detox test -c ios.sim.debug",
"test:e2e:build": "detox build"
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json"
...
}
Writing Tests
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 globalexpectobject.
How to run unit test and E2E tests in the same project
- If you have a setup file for the unit tests pass
./jest/setupimplementation into your unit setup. - Call your E2E tests using
detox-cli:detox test