I want to use globalSetup
and globalTeardown
from Jest with Detox so that the detox setup only happens one time but Detox seems to fail if the init is not beforeAll.
Any suggestions?
Jest version :22.0.4 Detox Version:6.0.4
config:
"globalSetup": "./setUpDetox.js",
"globalTeardown": "./tearDownDetox.js",
Instead of using the globalSetup and globalTeardown, setup and teardown the test environment from within your init. Just use jest's beforeAll and afterAll.
e2e/init.js
const detox = require('detox');
const config = require('../package.json').detox;
jest.setTimeout(120000);
beforeAll(async () => {
// custom setup
console.log('Initializing Detox');
await detox.init(config, { launchApp: false });
});
afterAll(async () => {
// custom teardown
await detox.cleanup();
});
e2e/config.json
{
"setupTestFrameworkScriptFile" : "./init.js"
}
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