-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-jasmine.js
40 lines (32 loc) · 1.15 KB
/
init-jasmine.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const detox = require('detox');
const adapter = require('detox/runners/jest/adapter');
const specReporter = require('detox/runners/jest/specReporter');
const assignReporter = require('detox/runners/jest/assignReporter');
const timeoutUtils = require('./utils/timeoutUtils');
jasmine.getEnv().addReporter(adapter);
// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
// This is strictly optional.
jasmine.getEnv().addReporter(specReporter);
// This will post which device has assigned to run a suite, which can be useful in a multiple-worker tests run.
// This is strictly optional.
jasmine.getEnv().addReporter(assignReporter);
// Set the default timeout
jest.setTimeout(timeoutUtils.testTimeout);
beforeAll(async () => {
await detox.init();
}, timeoutUtils.initTimeout);
beforeEach(async () => {
try {
await adapter.beforeEach();
} catch (err) {
await detox.cleanup();
throw err;
}
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});