detox 20.0.11-prerelease.0 → 20.0.13-prerelease.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0-javadoc.jar → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0-sources.jar → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.aar → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.aar} +0 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.aar.md5 → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.aar.md5} +0 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.aar.sha1 → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.aar.sha1} +0 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.aar.sha256 → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.aar.sha256} +0 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.aar.sha512 → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.aar.sha512} +0 -0
- package/Detox-android/com/wix/detox/{20.0.11-prerelease.0/detox-20.0.11-prerelease.0.pom → 20.0.13-prerelease.0/detox-20.0.13-prerelease.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.13-prerelease.0/detox-20.0.13-prerelease.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/android/detox/proguard-rules-app.pro +4 -2
- package/index.d.ts +22 -6
- package/internals.d.ts +106 -28
- package/local-cli/cli.js +7 -5
- package/local-cli/init.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/test.js +4 -4
- package/local-cli/test.test.js +85 -37
- package/local-cli/testCommand/TestRunnerCommand.js +45 -30
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +3 -3
- package/runners/jest/reporters/DetoxReporter.js +22 -2
- package/runners/jest/testEnvironment/index.js +83 -82
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +9 -24
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/src/DetoxWorker.js +0 -6
- package/src/artifacts/ArtifactsManager.js +0 -18
- package/src/configuration/composeLoggerConfig.js +2 -2
- package/src/configuration/composeRunnerConfig.js +7 -4
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +4 -4
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +1 -1
- package/src/ipc/IPCClient.js +9 -5
- package/src/ipc/IPCServer.js +17 -13
- package/src/ipc/SessionState.js +3 -5
- package/src/logger/DetoxLogger.js +4 -6
- package/src/realms/DetoxContext.js +2 -8
- package/src/realms/DetoxInternalsFacade.js +1 -1
- package/src/realms/DetoxPrimaryContext.js +6 -8
- package/src/realms/DetoxSecondaryContext.js +2 -2
- package/src/symbols.js +2 -14
- package/src/utils/Timer.js +55 -38
- package/src/utils/errorUtils.js +20 -0
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.11-prerelease.0/detox-20.0.11-prerelease.0.pom.sha512 +0 -1
package/local-cli/test.test.js
CHANGED
@@ -8,6 +8,8 @@ jest.mock('../src/devices/DeviceRegistry');
|
|
8
8
|
jest.mock('../src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory');
|
9
9
|
jest.mock('./utils/jestInternals');
|
10
10
|
|
11
|
+
const cp = require('child_process');
|
12
|
+
const cpSpawn = cp.spawn;
|
11
13
|
const os = require('os');
|
12
14
|
const path = require('path');
|
13
15
|
|
@@ -28,6 +30,10 @@ describe('CLI', () => {
|
|
28
30
|
let GenyDeviceRegistryFactory;
|
29
31
|
let jestInternals;
|
30
32
|
|
33
|
+
afterEach(() => {
|
34
|
+
cp.spawn = cpSpawn;
|
35
|
+
});
|
36
|
+
|
31
37
|
beforeEach(() => {
|
32
38
|
_cliCallDump = undefined;
|
33
39
|
_env = process.env;
|
@@ -46,6 +52,7 @@ describe('CLI', () => {
|
|
46
52
|
$0: os.platform() === 'win32' ? `node ${executable}` : executable,
|
47
53
|
config: 'e2e/config.json'
|
48
54
|
},
|
55
|
+
forwardEnv: true,
|
49
56
|
},
|
50
57
|
configurations: {
|
51
58
|
single: {
|
@@ -108,11 +115,14 @@ describe('CLI', () => {
|
|
108
115
|
});
|
109
116
|
|
110
117
|
test('should not override environment variables', () => {
|
111
|
-
expect(cliCall().env).toEqual({
|
118
|
+
expect(cliCall().env).toEqual({
|
119
|
+
DETOX_CONFIG_PATH: expect.any(String),
|
120
|
+
DETOX_CONFIG_SNAPSHOT_PATH: expect.any(String)
|
121
|
+
});
|
112
122
|
});
|
113
123
|
|
114
124
|
test('should hint essential environment variables', () => {
|
115
|
-
expect(cliCall().fullCommand).toMatch(
|
125
|
+
expect(cliCall().fullCommand).toMatch(/\bDETOX_CONFIG_PATH=.*\bexecutable\b/);
|
116
126
|
});
|
117
127
|
});
|
118
128
|
|
@@ -129,7 +139,7 @@ describe('CLI', () => {
|
|
129
139
|
|
130
140
|
test.each([['-l'], ['--loglevel']])('%s <value> should be passed as environment variable', async (__loglevel) => {
|
131
141
|
await run(__loglevel, 'trace');
|
132
|
-
expect(cliCall().env).
|
142
|
+
expect(cliCall().env).toHaveProperty('DETOX_LOGLEVEL');
|
133
143
|
expect(cliCall().fullCommand).toMatch(/ DETOX_LOGLEVEL="trace" /);
|
134
144
|
});
|
135
145
|
|
@@ -139,11 +149,28 @@ describe('CLI', () => {
|
|
139
149
|
});
|
140
150
|
|
141
151
|
test.each([['-R'], ['--retries']])('%s <value> should execute unsuccessful run N extra times', async (__retries) => {
|
152
|
+
function toTestResult(testFilePath) {
|
153
|
+
return {
|
154
|
+
testFilePath,
|
155
|
+
success: false,
|
156
|
+
isPermanentFailure: false,
|
157
|
+
};
|
158
|
+
}
|
159
|
+
|
142
160
|
const context = require('../internals');
|
143
|
-
|
144
|
-
|
145
|
-
.mockImplementationOnce(() =>
|
146
|
-
|
161
|
+
|
162
|
+
jest.spyOn(cp, 'spawn')
|
163
|
+
.mockImplementationOnce((...args) => {
|
164
|
+
context.session.testResults = ['e2e/failing1.test.js', 'e2e/failing2.test.js'].map(toTestResult);
|
165
|
+
return cpSpawn(...args);
|
166
|
+
})
|
167
|
+
.mockImplementationOnce((...args) => {
|
168
|
+
context.session.testResults = ['e2e/failing2.test.js'].map(toTestResult);
|
169
|
+
return cpSpawn(...args);
|
170
|
+
})
|
171
|
+
.mockImplementationOnce((...args) => {
|
172
|
+
return cpSpawn(...args);
|
173
|
+
});
|
147
174
|
|
148
175
|
mockExitCode(1);
|
149
176
|
|
@@ -154,18 +181,35 @@ describe('CLI', () => {
|
|
154
181
|
expect(cliCall(2).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', 'e2e/failing2.test.js']);
|
155
182
|
});
|
156
183
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
184
|
+
describe('when there are permanently failed tests', () => {
|
185
|
+
beforeEach(() => {
|
186
|
+
const context = require('../internals');
|
187
|
+
context.session.testResults = ['e2e/failing1.test.js', 'e2e/failing2.test.js'].map((testFilePath, index) => ({
|
188
|
+
testFilePath,
|
189
|
+
success: false,
|
190
|
+
isPermanentFailure: index > 0,
|
191
|
+
}));
|
161
192
|
|
162
|
-
|
193
|
+
mockExitCode(1);
|
194
|
+
});
|
163
195
|
|
164
|
-
|
196
|
+
test.each([['-R'], ['--retries']])('%s <value> should not bail by default', async (__retries) => {
|
197
|
+
await run(__retries, 2).catch(_.noop);
|
165
198
|
|
166
|
-
|
167
|
-
|
168
|
-
|
199
|
+
expect(cliCall(0).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json']);
|
200
|
+
expect(cliCall(1).env).not.toHaveProperty('DETOX_RERUN_INDEX');
|
201
|
+
expect(cliCall(1).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', 'e2e/failing1.test.js']);
|
202
|
+
// note that it does not take the permanently failed test
|
203
|
+
});
|
204
|
+
|
205
|
+
test.each([['-R'], ['--retries']])('%s <value> should bail if configured', async (__retries) => {
|
206
|
+
detoxConfig.testRunner.bail = true;
|
207
|
+
await run(__retries, 2).catch(_.noop);
|
208
|
+
|
209
|
+
expect(cliCall(0).env).not.toHaveProperty('DETOX_RERUN_INDEX');
|
210
|
+
expect(cliCall(0).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json']);
|
211
|
+
expect(cliCall(1)).toBe(null);
|
212
|
+
});
|
169
213
|
});
|
170
214
|
|
171
215
|
test.each([['-R'], ['--retries']])('%s <value> should not restart test runner if there are no failing tests paths', async (__retries) => {
|
@@ -178,7 +222,11 @@ describe('CLI', () => {
|
|
178
222
|
|
179
223
|
test.each([['-R'], ['--retries']])('%s <value> should retain -- <...explicitPassthroughArgs>', async (__retries) => {
|
180
224
|
const context = require('../internals');
|
181
|
-
context.session.
|
225
|
+
context.session.testResults = [{
|
226
|
+
testFilePath: 'tests/failing.test.js',
|
227
|
+
success: false,
|
228
|
+
isPermanentFailure: false,
|
229
|
+
}];
|
182
230
|
|
183
231
|
mockExitCode(1);
|
184
232
|
|
@@ -190,111 +238,111 @@ describe('CLI', () => {
|
|
190
238
|
|
191
239
|
test.each([['-r'], ['--reuse']])('%s <value> should be passed as environment variable', async (__reuse) => {
|
192
240
|
await run(__reuse);
|
193
|
-
expect(cliCall().env).
|
241
|
+
expect(cliCall().env).toHaveProperty('DETOX_REUSE');
|
194
242
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_REUSE=true /);
|
195
243
|
});
|
196
244
|
|
197
245
|
test.each([['-u'], ['--cleanup']])('%s <value> should be passed as environment variable', async (__cleanup) => {
|
198
246
|
await run(__cleanup);
|
199
|
-
expect(cliCall().env).
|
247
|
+
expect(cliCall().env).toHaveProperty('DETOX_CLEANUP');
|
200
248
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_CLEANUP=true /);
|
201
249
|
});
|
202
250
|
|
203
251
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as environment variable', async (__debug_synchronization) => {
|
204
252
|
await run(__debug_synchronization, 5000);
|
205
|
-
expect(cliCall().env).
|
253
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
206
254
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=5000 /);
|
207
255
|
});
|
208
256
|
|
209
257
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as 0 when given false', async (__debug_synchronization) => {
|
210
258
|
await run(__debug_synchronization, false);
|
211
|
-
expect(cliCall().env).
|
259
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
212
260
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=0 /);
|
213
261
|
});
|
214
262
|
|
215
263
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should have default value = 3000', async (__debug_synchronization) => {
|
216
264
|
await run(`${__debug_synchronization}`);
|
217
|
-
expect(cliCall().env).
|
265
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
218
266
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=3000 /);
|
219
267
|
});
|
220
268
|
|
221
269
|
test.each([['-a'], ['--artifacts-location']])('%s <value> should be passed as environment variable', async (__artifacts_location) => {
|
222
270
|
await run(__artifacts_location, '/tmp');
|
223
|
-
expect(cliCall().env).
|
271
|
+
expect(cliCall().env).toHaveProperty('DETOX_ARTIFACTS_LOCATION');
|
224
272
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_ARTIFACTS_LOCATION="\/tmp" /);
|
225
273
|
});
|
226
274
|
|
227
275
|
test('--record-logs <value> should be passed as environment variable', async () => {
|
228
276
|
await run('--record-logs', 'all');
|
229
|
-
expect(cliCall().env).
|
277
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_LOGS');
|
230
278
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_LOGS="all" /);
|
231
279
|
});
|
232
280
|
|
233
281
|
test('--take-screenshots <value> should be passed as environment variable', async () => {
|
234
282
|
await run('--take-screenshots', 'failing');
|
235
|
-
expect(cliCall().env).
|
283
|
+
expect(cliCall().env).toHaveProperty('DETOX_TAKE_SCREENSHOTS');
|
236
284
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_TAKE_SCREENSHOTS="failing" /);
|
237
285
|
});
|
238
286
|
|
239
287
|
test('--record-videos <value> should be passed as environment variable', async () => {
|
240
288
|
await run('--record-videos', 'failing');
|
241
|
-
expect(cliCall().env).
|
289
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_VIDEOS');
|
242
290
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_VIDEOS="failing" /);
|
243
291
|
});
|
244
292
|
|
245
293
|
test('--record-performance <value> should be passed as environment variable', async () => {
|
246
294
|
await run('--record-performance', 'all');
|
247
|
-
expect(cliCall().env).
|
295
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_PERFORMANCE');
|
248
296
|
expect(cliCall().fullCommand).toMatch(/\DETOX_RECORD_PERFORMANCE="all" /);
|
249
297
|
});
|
250
298
|
|
251
299
|
test('--capture-view-hierarchy <value> should be passed as environment variable', async () => {
|
252
300
|
await run('--capture-view-hierarchy', 'enabled');
|
253
|
-
expect(cliCall().env).
|
301
|
+
expect(cliCall().env).toHaveProperty('DETOX_CAPTURE_VIEW_HIERARCHY');
|
254
302
|
expect(cliCall().fullCommand).toMatch(/\DETOX_CAPTURE_VIEW_HIERARCHY="enabled" /);
|
255
303
|
});
|
256
304
|
|
257
305
|
test('--jest-report-specs, set explicitly, should be passed as an environment variable', async () => {
|
258
306
|
await run('--jest-report-specs');
|
259
|
-
expect(cliCall().env).
|
307
|
+
expect(cliCall().env).toHaveProperty('DETOX_REPORT_SPECS');
|
260
308
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_REPORT_SPECS=true /);
|
261
309
|
});
|
262
310
|
|
263
311
|
test.each([['-H'], ['--headless']])('%s <value> should be passed as environment variable', async (__headless) => {
|
264
312
|
await run(__headless);
|
265
|
-
expect(cliCall().env).
|
313
|
+
expect(cliCall().env).toHaveProperty('DETOX_HEADLESS');
|
266
314
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_HEADLESS=true /);
|
267
315
|
});
|
268
316
|
|
269
317
|
test('--gpu <value> should be passed as environment variable', async () => {
|
270
318
|
await run('--gpu', 'angle_indirect');
|
271
|
-
expect(cliCall().env).
|
319
|
+
expect(cliCall().env).toHaveProperty('DETOX_GPU');
|
272
320
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_GPU="angle_indirect" /);
|
273
321
|
});
|
274
322
|
|
275
323
|
test('--device-boot-args should be passed as an environment variable (without deprecation warnings)', async () => {
|
276
324
|
await run('--device-boot-args="--verbose"');
|
277
|
-
expect(cliCall().env).
|
325
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
278
326
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
279
327
|
expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
280
328
|
});
|
281
329
|
|
282
330
|
test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
|
283
331
|
await run(`--device-launch-args="--verbose"`);
|
284
|
-
expect(cliCall().env).
|
332
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
285
333
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
286
334
|
expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
287
335
|
});
|
288
336
|
|
289
337
|
test('--app-launch-args should be passed as an environment variable', async () => {
|
290
338
|
await run(`--app-launch-args="--debug yes"`);
|
291
|
-
expect(cliCall().env).
|
339
|
+
expect(cliCall().env).toHaveProperty('DETOX_APP_LAUNCH_ARGS');
|
292
340
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_APP_LAUNCH_ARGS="--debug yes" /);
|
293
341
|
});
|
294
342
|
|
295
343
|
test('--use-custom-logger false should be prevent passing environment variable', async () => {
|
296
344
|
await run(`--use-custom-logger=false`);
|
297
|
-
expect(cliCall().env).
|
345
|
+
expect(cliCall().env).toHaveProperty('DETOX_USE_CUSTOM_LOGGER');
|
298
346
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_USE_CUSTOM_LOGGER=false /);
|
299
347
|
});
|
300
348
|
|
@@ -308,13 +356,13 @@ describe('CLI', () => {
|
|
308
356
|
test('--force-adb-install should be passed as environment variable', async () => {
|
309
357
|
singleConfig().device.type = 'android.emulator';
|
310
358
|
await run(`--force-adb-install`);
|
311
|
-
expect(cliCall().env).
|
359
|
+
expect(cliCall().env).toHaveProperty('DETOX_FORCE_ADB_INSTALL');
|
312
360
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_FORCE_ADB_INSTALL=true /);
|
313
361
|
});
|
314
362
|
|
315
363
|
test.each([['-n'], ['--device-name']])('%s <value> should be passed as environment variable', async (__device_name) => {
|
316
364
|
await run(__device_name, 'TheDevice');
|
317
|
-
expect(cliCall().env).
|
365
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_NAME');
|
318
366
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_NAME="TheDevice" /);
|
319
367
|
});
|
320
368
|
|
@@ -13,43 +13,20 @@ const { escapeSpaces } = require('../../src/utils/shellUtils');
|
|
13
13
|
class TestRunnerCommand {
|
14
14
|
constructor() {
|
15
15
|
this._argv = {};
|
16
|
-
this.
|
16
|
+
this._cli2env = {};
|
17
17
|
this._envHint = {};
|
18
|
+
this._envFwd = {};
|
18
19
|
this._retries = 0;
|
19
20
|
/** @type {Detox.DetoxDeviceConfig} */
|
20
21
|
this._deviceConfig = null;
|
21
22
|
}
|
22
23
|
|
23
|
-
/**
|
24
|
-
* @param {Detox.DetoxDeviceConfig} config
|
25
|
-
* @returns {this}
|
26
|
-
*/
|
27
|
-
setDeviceConfig(config) {
|
28
|
-
this._deviceConfig = config;
|
29
|
-
|
30
|
-
return this;
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* @param {Detox.DetoxTestRunnerConfig} config
|
35
|
-
* @returns {this}
|
36
|
-
*/
|
37
|
-
setRunnerConfig(config) {
|
38
|
-
this._argv = config.args;
|
39
|
-
this._retries = config.inspectBrk ? 0 : config.retries;
|
40
|
-
if (config.inspectBrk || config.forwardEnv) {
|
41
|
-
this._env = this._envHint;
|
42
|
-
}
|
43
|
-
|
44
|
-
return this;
|
45
|
-
}
|
46
|
-
|
47
24
|
/**
|
48
25
|
* @param {Partial<Readonly<DetoxInternals.CLIConfig>>} cliConfig
|
49
26
|
* @returns {this}
|
50
27
|
*/
|
51
28
|
replicateCLIConfig(cliConfig) {
|
52
|
-
this.
|
29
|
+
this._cli2env = _.omitBy({
|
53
30
|
DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
|
54
31
|
DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
|
55
32
|
DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
|
@@ -77,6 +54,37 @@ class TestRunnerCommand {
|
|
77
54
|
DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
|
78
55
|
}, _.isUndefined);
|
79
56
|
|
57
|
+
this._envHint = _(process.env)
|
58
|
+
.mapKeys((_value, key) => key.toUpperCase())
|
59
|
+
.pickBy((_value, key) => key.startsWith('DETOX_'))
|
60
|
+
.omit(['DETOX_CONFIG_SNAPSHOT_PATH'])
|
61
|
+
.value();
|
62
|
+
|
63
|
+
return this;
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @param {Detox.DetoxDeviceConfig} config
|
68
|
+
* @returns {this}
|
69
|
+
*/
|
70
|
+
setDeviceConfig(config) {
|
71
|
+
this._deviceConfig = config;
|
72
|
+
|
73
|
+
return this;
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @param {Detox.DetoxTestRunnerConfig} config
|
78
|
+
* @returns {this}
|
79
|
+
*/
|
80
|
+
setRunnerConfig(config) {
|
81
|
+
this._argv = config.args;
|
82
|
+
this._retries = config.inspectBrk ? 0 : config.retries;
|
83
|
+
if (config.forwardEnv) {
|
84
|
+
this._envFwd = this._cli2env;
|
85
|
+
Object.assign(this._envHint, this._cli2env);
|
86
|
+
}
|
87
|
+
|
80
88
|
return this;
|
81
89
|
}
|
82
90
|
|
@@ -99,13 +107,20 @@ class TestRunnerCommand {
|
|
99
107
|
} catch (e) {
|
100
108
|
launchError = e;
|
101
109
|
|
102
|
-
const
|
103
|
-
|
110
|
+
const failedTestFiles = detox.session.testResults.filter(r => !r.success);
|
111
|
+
|
112
|
+
const { bail } = detox.config.testRunner;
|
113
|
+
if (bail && failedTestFiles.some(r => r.isPermanentFailure)) {
|
114
|
+
throw e;
|
115
|
+
}
|
116
|
+
|
117
|
+
const testFilesToRetry = failedTestFiles.filter(r => !r.isPermanentFailure).map(r => r.testFilePath);
|
118
|
+
if (_.isEmpty(testFilesToRetry)) {
|
104
119
|
throw e;
|
105
120
|
}
|
106
121
|
|
107
122
|
if (--runsLeft > 0) {
|
108
|
-
this._argv._ = testFilesToRetry
|
123
|
+
this._argv._ = testFilesToRetry;
|
109
124
|
// @ts-ignore
|
110
125
|
detox.session.testSessionIndex++; // it is always a primary context, so we can update it
|
111
126
|
}
|
@@ -129,7 +144,7 @@ class TestRunnerCommand {
|
|
129
144
|
stdio: 'inherit',
|
130
145
|
env: _({})
|
131
146
|
.assign(process.env)
|
132
|
-
.assign(this.
|
147
|
+
.assign(this._envFwd)
|
133
148
|
.omitBy(_.isUndefined)
|
134
149
|
.tap(prependNodeModulesBinToPATH)
|
135
150
|
.value()
|
@@ -4,6 +4,7 @@ const path = require('path');
|
|
4
4
|
|
5
5
|
const _ = require('lodash');
|
6
6
|
const resolveFrom = require('resolve-from');
|
7
|
+
const semver = require('semver');
|
7
8
|
|
8
9
|
const { DetoxRuntimeError } = require('../../src/errors');
|
9
10
|
|
@@ -50,7 +51,9 @@ function resolveJestCliArgs() {
|
|
50
51
|
|
51
52
|
try {
|
52
53
|
const jestCliManifest = resolveJestDependency(jestLocation, 'jest-cli/package.json');
|
53
|
-
const
|
54
|
+
const jestCliVersion = require(jestCliManifest).version;
|
55
|
+
const argsJsFilePath = semver.gt(jestCliVersion, '29.1.2') ? 'build/args.js' : 'build/cli/args.js';
|
56
|
+
const argsJsFile = path.join(path.dirname(jestCliManifest), argsJsFilePath);
|
54
57
|
|
55
58
|
return require(argsJsFile);
|
56
59
|
} catch (e) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "detox",
|
3
3
|
"description": "E2E tests and automation for mobile",
|
4
|
-
"version": "20.0.
|
4
|
+
"version": "20.0.13-prerelease.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -92,7 +92,7 @@
|
|
92
92
|
"yargs-unparser": "^2.0.0"
|
93
93
|
},
|
94
94
|
"peerDependencies": {
|
95
|
-
"jest": "28.x.x || ^27.2.5"
|
95
|
+
"jest": "29.x.x || 28.x.x || ^27.2.5"
|
96
96
|
},
|
97
97
|
"peerDependenciesMeta": {
|
98
98
|
"jest": {
|
@@ -184,5 +184,5 @@
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
},
|
187
|
-
"gitHead": "
|
187
|
+
"gitHead": "7fef4609b820542ce27263e0c2cd1f03a2ae02fe"
|
188
188
|
}
|
@@ -1,5 +1,25 @@
|
|
1
|
-
const
|
1
|
+
const resolveFrom = require('resolve-from');
|
2
|
+
/** @type {typeof import('@jest/reporters').VerboseReporter} */
|
3
|
+
const JestVerboseReporter = require(resolveFrom(process.cwd(), '@jest/reporters')).VerboseReporter;
|
2
4
|
|
3
|
-
|
5
|
+
const { config, reportTestResults } = require('../../../internals');
|
6
|
+
|
7
|
+
class DetoxReporter extends JestVerboseReporter {
|
8
|
+
/**
|
9
|
+
* @param {import('@jest/test-result').TestResult} testResult
|
10
|
+
*/
|
11
|
+
async onTestResult(test, testResult, results) {
|
12
|
+
await super.onTestResult(test, testResult, results);
|
13
|
+
|
14
|
+
await reportTestResults([{
|
15
|
+
success: !testResult.failureMessage,
|
16
|
+
testFilePath: testResult.testFilePath,
|
17
|
+
testExecError: testResult.testExecError,
|
18
|
+
isPermanentFailure: config.testRunner.jest.retryAfterCircusRetries
|
19
|
+
? false
|
20
|
+
: testResult.testResults.some(r => r.status === 'failed' && r.invocations > 1)
|
21
|
+
}]);
|
22
|
+
}
|
23
|
+
}
|
4
24
|
|
5
25
|
module.exports = DetoxReporter;
|