detox 20.0.14-is-hittable-over-master.0 → 20.0.14-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.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-javadoc.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-sources.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.aar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.aar.md5 → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.md5} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.aar.sha1 → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha1} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.aar.sha256 → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha256} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.aar.sha512 → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha512} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.pom → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-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/build.gradle +0 -1
- package/android/detox/proguard-rules-app.pro +4 -2
- package/index.d.ts +105 -19
- package/internals.d.ts +103 -22
- package/local-cli/cli.js +1 -1
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/test.test.js +41 -41
- package/local-cli/testCommand/TestRunnerCommand.js +75 -78
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +1 -11
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +27 -13
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/reporters/DetoxReporter.js +21 -10
- package/runners/jest/testEnvironment/index.js +57 -41
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +7 -3
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +95 -55
- package/src/artifacts/ArtifactsManager.js +6 -24
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeLoggerConfig.js +2 -2
- package/src/configuration/composeRunnerConfig.js +8 -6
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/ipc/SessionState.js +8 -6
- package/src/logger/DetoxLogger.js +5 -25
- package/src/logger/index.js +1 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +7 -29
- package/src/logger/utils/DetoxLogFinalizer.js +134 -0
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +4 -3
- package/src/logger/utils/streamUtils.js +34 -26
- package/src/realms/DetoxContext.js +10 -13
- package/src/realms/DetoxInternalsFacade.js +0 -6
- package/src/realms/DetoxPrimaryContext.js +29 -84
- package/src/realms/DetoxSecondaryContext.js +6 -10
- package/src/symbols.js +0 -12
- package/src/utils/argparse.js +11 -0
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-is-hittable-over-master.0/detox-20.0.14-is-hittable-over-master.0.pom.sha512 +0 -1
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
package/local-cli/test.test.js
CHANGED
@@ -12,6 +12,7 @@ const cp = require('child_process');
|
|
12
12
|
const cpSpawn = cp.spawn;
|
13
13
|
const os = require('os');
|
14
14
|
const path = require('path');
|
15
|
+
const util = require('util');
|
15
16
|
|
16
17
|
const fs = require('fs-extra');
|
17
18
|
const _ = require('lodash');
|
@@ -52,6 +53,7 @@ describe('CLI', () => {
|
|
52
53
|
$0: os.platform() === 'win32' ? `node ${executable}` : executable,
|
53
54
|
config: 'e2e/config.json'
|
54
55
|
},
|
56
|
+
forwardEnv: true,
|
55
57
|
},
|
56
58
|
configurations: {
|
57
59
|
single: {
|
@@ -114,11 +116,14 @@ describe('CLI', () => {
|
|
114
116
|
});
|
115
117
|
|
116
118
|
test('should not override environment variables', () => {
|
117
|
-
expect(cliCall().env).toEqual({
|
119
|
+
expect(cliCall().env).toEqual({
|
120
|
+
DETOX_CONFIG_PATH: expect.any(String),
|
121
|
+
DETOX_CONFIG_SNAPSHOT_PATH: expect.any(String)
|
122
|
+
});
|
118
123
|
});
|
119
124
|
|
120
125
|
test('should hint essential environment variables', () => {
|
121
|
-
expect(cliCall().fullCommand).toMatch(
|
126
|
+
expect(cliCall().fullCommand).toMatch(/\bDETOX_CONFIG_PATH=.*\bexecutable\b/);
|
122
127
|
});
|
123
128
|
});
|
124
129
|
|
@@ -135,7 +140,7 @@ describe('CLI', () => {
|
|
135
140
|
|
136
141
|
test.each([['-l'], ['--loglevel']])('%s <value> should be passed as environment variable', async (__loglevel) => {
|
137
142
|
await run(__loglevel, 'trace');
|
138
|
-
expect(cliCall().env).
|
143
|
+
expect(cliCall().env).toHaveProperty('DETOX_LOGLEVEL');
|
139
144
|
expect(cliCall().fullCommand).toMatch(/ DETOX_LOGLEVEL="trace" /);
|
140
145
|
});
|
141
146
|
|
@@ -192,8 +197,8 @@ describe('CLI', () => {
|
|
192
197
|
test.each([['-R'], ['--retries']])('%s <value> should not bail by default', async (__retries) => {
|
193
198
|
await run(__retries, 2).catch(_.noop);
|
194
199
|
|
195
|
-
expect(cliCall(0).env).not.toHaveProperty('DETOX_RERUN_INDEX');
|
196
200
|
expect(cliCall(0).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json']);
|
201
|
+
expect(cliCall(1).env).not.toHaveProperty('DETOX_RERUN_INDEX');
|
197
202
|
expect(cliCall(1).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', 'e2e/failing1.test.js']);
|
198
203
|
// note that it does not take the permanently failed test
|
199
204
|
});
|
@@ -234,111 +239,104 @@ describe('CLI', () => {
|
|
234
239
|
|
235
240
|
test.each([['-r'], ['--reuse']])('%s <value> should be passed as environment variable', async (__reuse) => {
|
236
241
|
await run(__reuse);
|
237
|
-
expect(cliCall().env).
|
242
|
+
expect(cliCall().env).toHaveProperty('DETOX_REUSE');
|
238
243
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_REUSE=true /);
|
239
244
|
});
|
240
245
|
|
241
246
|
test.each([['-u'], ['--cleanup']])('%s <value> should be passed as environment variable', async (__cleanup) => {
|
242
247
|
await run(__cleanup);
|
243
|
-
expect(cliCall().env).
|
248
|
+
expect(cliCall().env).toHaveProperty('DETOX_CLEANUP');
|
244
249
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_CLEANUP=true /);
|
245
250
|
});
|
246
251
|
|
247
252
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as environment variable', async (__debug_synchronization) => {
|
248
253
|
await run(__debug_synchronization, 5000);
|
249
|
-
expect(cliCall().env).
|
254
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
250
255
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=5000 /);
|
251
256
|
});
|
252
257
|
|
253
258
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as 0 when given false', async (__debug_synchronization) => {
|
254
259
|
await run(__debug_synchronization, false);
|
255
|
-
expect(cliCall().env).
|
260
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
256
261
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=0 /);
|
257
262
|
});
|
258
263
|
|
259
264
|
test.each([['-d'], ['--debug-synchronization']])('%s <value> should have default value = 3000', async (__debug_synchronization) => {
|
260
265
|
await run(`${__debug_synchronization}`);
|
261
|
-
expect(cliCall().env).
|
266
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
262
267
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=3000 /);
|
263
268
|
});
|
264
269
|
|
265
270
|
test.each([['-a'], ['--artifacts-location']])('%s <value> should be passed as environment variable', async (__artifacts_location) => {
|
266
271
|
await run(__artifacts_location, '/tmp');
|
267
|
-
expect(cliCall().env).
|
272
|
+
expect(cliCall().env).toHaveProperty('DETOX_ARTIFACTS_LOCATION');
|
268
273
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_ARTIFACTS_LOCATION="\/tmp" /);
|
269
274
|
});
|
270
275
|
|
271
276
|
test('--record-logs <value> should be passed as environment variable', async () => {
|
272
277
|
await run('--record-logs', 'all');
|
273
|
-
expect(cliCall().env).
|
278
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_LOGS');
|
274
279
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_LOGS="all" /);
|
275
280
|
});
|
276
281
|
|
277
282
|
test('--take-screenshots <value> should be passed as environment variable', async () => {
|
278
283
|
await run('--take-screenshots', 'failing');
|
279
|
-
expect(cliCall().env).
|
284
|
+
expect(cliCall().env).toHaveProperty('DETOX_TAKE_SCREENSHOTS');
|
280
285
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_TAKE_SCREENSHOTS="failing" /);
|
281
286
|
});
|
282
287
|
|
283
288
|
test('--record-videos <value> should be passed as environment variable', async () => {
|
284
289
|
await run('--record-videos', 'failing');
|
285
|
-
expect(cliCall().env).
|
290
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_VIDEOS');
|
286
291
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_VIDEOS="failing" /);
|
287
292
|
});
|
288
293
|
|
289
294
|
test('--record-performance <value> should be passed as environment variable', async () => {
|
290
295
|
await run('--record-performance', 'all');
|
291
|
-
expect(cliCall().env).
|
296
|
+
expect(cliCall().env).toHaveProperty('DETOX_RECORD_PERFORMANCE');
|
292
297
|
expect(cliCall().fullCommand).toMatch(/\DETOX_RECORD_PERFORMANCE="all" /);
|
293
298
|
});
|
294
299
|
|
295
300
|
test('--capture-view-hierarchy <value> should be passed as environment variable', async () => {
|
296
301
|
await run('--capture-view-hierarchy', 'enabled');
|
297
|
-
expect(cliCall().env).
|
302
|
+
expect(cliCall().env).toHaveProperty('DETOX_CAPTURE_VIEW_HIERARCHY');
|
298
303
|
expect(cliCall().fullCommand).toMatch(/\DETOX_CAPTURE_VIEW_HIERARCHY="enabled" /);
|
299
304
|
});
|
300
305
|
|
301
306
|
test('--jest-report-specs, set explicitly, should be passed as an environment variable', async () => {
|
302
307
|
await run('--jest-report-specs');
|
303
|
-
expect(cliCall().env).
|
308
|
+
expect(cliCall().env).toHaveProperty('DETOX_REPORT_SPECS');
|
304
309
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_REPORT_SPECS=true /);
|
305
310
|
});
|
306
311
|
|
307
312
|
test.each([['-H'], ['--headless']])('%s <value> should be passed as environment variable', async (__headless) => {
|
308
313
|
await run(__headless);
|
309
|
-
expect(cliCall().env).
|
314
|
+
expect(cliCall().env).toHaveProperty('DETOX_HEADLESS');
|
310
315
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_HEADLESS=true /);
|
311
316
|
});
|
312
317
|
|
313
318
|
test('--gpu <value> should be passed as environment variable', async () => {
|
314
319
|
await run('--gpu', 'angle_indirect');
|
315
|
-
expect(cliCall().env).
|
320
|
+
expect(cliCall().env).toHaveProperty('DETOX_GPU');
|
316
321
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_GPU="angle_indirect" /);
|
317
322
|
});
|
318
323
|
|
319
324
|
test('--device-boot-args should be passed as an environment variable (without deprecation warnings)', async () => {
|
320
325
|
await run('--device-boot-args="--verbose"');
|
321
|
-
expect(cliCall().env).
|
326
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
322
327
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
323
328
|
expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
324
329
|
});
|
325
330
|
|
326
|
-
test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
|
327
|
-
await run(`--device-launch-args="--verbose"`);
|
328
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
329
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
330
|
-
expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
331
|
-
});
|
332
|
-
|
333
331
|
test('--app-launch-args should be passed as an environment variable', async () => {
|
334
332
|
await run(`--app-launch-args="--debug yes"`);
|
335
|
-
expect(cliCall().env).
|
333
|
+
expect(cliCall().env).toHaveProperty('DETOX_APP_LAUNCH_ARGS');
|
336
334
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_APP_LAUNCH_ARGS="--debug yes" /);
|
337
335
|
});
|
338
336
|
|
339
337
|
test('--use-custom-logger false should be prevent passing environment variable', async () => {
|
340
338
|
await run(`--use-custom-logger=false`);
|
341
|
-
expect(cliCall().env).
|
339
|
+
expect(cliCall().env).toHaveProperty('DETOX_USE_CUSTOM_LOGGER');
|
342
340
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_USE_CUSTOM_LOGGER=false /);
|
343
341
|
});
|
344
342
|
|
@@ -352,13 +350,13 @@ describe('CLI', () => {
|
|
352
350
|
test('--force-adb-install should be passed as environment variable', async () => {
|
353
351
|
singleConfig().device.type = 'android.emulator';
|
354
352
|
await run(`--force-adb-install`);
|
355
|
-
expect(cliCall().env).
|
353
|
+
expect(cliCall().env).toHaveProperty('DETOX_FORCE_ADB_INSTALL');
|
356
354
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_FORCE_ADB_INSTALL=true /);
|
357
355
|
});
|
358
356
|
|
359
357
|
test.each([['-n'], ['--device-name']])('%s <value> should be passed as environment variable', async (__device_name) => {
|
360
358
|
await run(__device_name, 'TheDevice');
|
361
|
-
expect(cliCall().env).
|
359
|
+
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_NAME');
|
362
360
|
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_NAME="TheDevice" /);
|
363
361
|
});
|
364
362
|
|
@@ -370,8 +368,6 @@ describe('CLI', () => {
|
|
370
368
|
expect(cliCall().argv.slice(-2)).toEqual(['e2e/01.sanity.test.js', 'e2e/02.sanity.test.js']);
|
371
369
|
});
|
372
370
|
|
373
|
-
test.todo('--inspect-brk should work');
|
374
|
-
|
375
371
|
test.each([
|
376
372
|
['-d e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
377
373
|
['--debug-synchronization e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
@@ -449,15 +445,14 @@ describe('CLI', () => {
|
|
449
445
|
expect(cliCall().argv).toContain('--deepParameter');
|
450
446
|
});
|
451
447
|
|
452
|
-
|
453
|
-
|
454
|
-
|
448
|
+
test('--inspect-brk should activate inspectBrk hook', async () => {
|
449
|
+
detoxConfig.testRunner.inspectBrk = (config) => {
|
450
|
+
config.args.customFlag = true;
|
451
|
+
return config;
|
452
|
+
};
|
455
453
|
|
456
|
-
|
457
|
-
|
458
|
-
} else {
|
459
|
-
expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/\.bin\/jest/);
|
460
|
-
}
|
454
|
+
await run('--inspect-brk');
|
455
|
+
expect(cliCall().argv).toContain('--customFlag');
|
461
456
|
});
|
462
457
|
|
463
458
|
test('should append $DETOX_ARGV_OVERRIDE to detox test ... command and print a warning', async () => {
|
@@ -527,7 +522,12 @@ describe('CLI', () => {
|
|
527
522
|
}
|
528
523
|
|
529
524
|
async function run(...args) {
|
530
|
-
|
525
|
+
let contents = `module.exports = ${util.inspect(detoxConfig, { depth: Infinity })};`;
|
526
|
+
if (detoxConfig.testRunner && detoxConfig.testRunner.inspectBrk) {
|
527
|
+
contents = contents.replace(/\[Function.*\]/m, detoxConfig.testRunner.inspectBrk.toString());
|
528
|
+
}
|
529
|
+
|
530
|
+
detoxConfigPath = tempfile('.js', contents);
|
531
531
|
const __configPath = Math.random() > 0.5 ? '-C' : '--config-path';
|
532
532
|
return runRaw('test', __configPath, detoxConfigPath, ...args);
|
533
533
|
}
|
@@ -11,45 +11,77 @@ const { printEnvironmentVariables, prependNodeModulesBinToPATH } = require('../.
|
|
11
11
|
const { escapeSpaces } = require('../../src/utils/shellUtils');
|
12
12
|
|
13
13
|
class TestRunnerCommand {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
/*
|
15
|
+
@param {object} opts
|
16
|
+
@param {DetoxInternals.RuntimeConfig} opts.config
|
17
|
+
@param {ProcessEnv} [opts.env]
|
18
|
+
*/
|
19
|
+
constructor(opts) {
|
20
|
+
const cliConfig = opts.config.cli;
|
21
|
+
const deviceConfig = opts.config.device;
|
22
|
+
const runnerConfig = opts.config.testRunner;
|
23
|
+
|
24
|
+
this._argv = runnerConfig.args;
|
25
|
+
this._retries = runnerConfig.retries;
|
26
|
+
this._envHint = this._buildEnvHint(opts.env);
|
27
|
+
this._envFwd = {};
|
28
|
+
if (runnerConfig.forwardEnv) {
|
29
|
+
this._envFwd = this._buildEnvOverride(cliConfig, deviceConfig);
|
30
|
+
Object.assign(this._envHint, this._envFwd);
|
31
|
+
}
|
21
32
|
}
|
22
33
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
*/
|
27
|
-
setDeviceConfig(config) {
|
28
|
-
this._deviceConfig = config;
|
34
|
+
async execute() {
|
35
|
+
let runsLeft = 1 + this._retries;
|
36
|
+
let launchError = null;
|
29
37
|
|
30
|
-
|
31
|
-
|
38
|
+
do {
|
39
|
+
try {
|
40
|
+
await this._spawnTestRunner();
|
41
|
+
launchError = null;
|
42
|
+
} catch (e) {
|
43
|
+
launchError = e;
|
32
44
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
const failedTestFiles = detox.session.testResults.filter(r => !r.success);
|
46
|
+
|
47
|
+
const { bail } = detox.config.testRunner;
|
48
|
+
if (bail && failedTestFiles.some(r => r.isPermanentFailure)) {
|
49
|
+
throw e;
|
50
|
+
}
|
51
|
+
|
52
|
+
const testFilesToRetry = failedTestFiles.filter(r => !r.isPermanentFailure).map(r => r.testFilePath);
|
53
|
+
if (_.isEmpty(testFilesToRetry)) {
|
54
|
+
throw e;
|
55
|
+
}
|
56
|
+
|
57
|
+
if (--runsLeft > 0) {
|
58
|
+
// @ts-ignore
|
59
|
+
detox.session.testSessionIndex++; // it is always the primary context, so we can update it
|
60
|
+
this._argv._ = testFilesToRetry;
|
61
|
+
this._logRelaunchError();
|
62
|
+
}
|
63
|
+
}
|
64
|
+
} while (launchError && runsLeft > 0);
|
65
|
+
|
66
|
+
if (launchError) {
|
67
|
+
throw launchError;
|
42
68
|
}
|
69
|
+
}
|
43
70
|
|
44
|
-
|
71
|
+
_buildEnvHint(env = process.env) {
|
72
|
+
return _(env)
|
73
|
+
.mapKeys((_value, key) => key.toUpperCase())
|
74
|
+
.pickBy((_value, key) => key.startsWith('DETOX_'))
|
75
|
+
.omit(['DETOX_CONFIG_SNAPSHOT_PATH'])
|
76
|
+
.value();
|
45
77
|
}
|
46
78
|
|
47
79
|
/**
|
48
|
-
* @param {
|
49
|
-
* @
|
80
|
+
* @param {DetoxInternals.CLIConfig} cliConfig
|
81
|
+
* @param {Detox.DetoxDeviceConfig} deviceConfig
|
50
82
|
*/
|
51
|
-
|
52
|
-
|
83
|
+
_buildEnvOverride(cliConfig, deviceConfig) {
|
84
|
+
return _.omitBy({
|
53
85
|
DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
|
54
86
|
DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
|
55
87
|
DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
|
@@ -59,7 +91,7 @@ class TestRunnerCommand {
|
|
59
91
|
DETOX_DEBUG_SYNCHRONIZATION: cliConfig.debugSynchronization,
|
60
92
|
DETOX_DEVICE_BOOT_ARGS: cliConfig.deviceBootArgs,
|
61
93
|
DETOX_DEVICE_NAME: cliConfig.deviceName,
|
62
|
-
DETOX_FORCE_ADB_INSTALL:
|
94
|
+
DETOX_FORCE_ADB_INSTALL: deviceConfig.type.startsWith('android.')
|
63
95
|
? cliConfig.forceAdbInstall
|
64
96
|
: undefined,
|
65
97
|
DETOX_GPU: cliConfig.gpu,
|
@@ -76,55 +108,9 @@ class TestRunnerCommand {
|
|
76
108
|
DETOX_TAKE_SCREENSHOTS: cliConfig.takeScreenshots,
|
77
109
|
DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
|
78
110
|
}, _.isUndefined);
|
79
|
-
|
80
|
-
return this;
|
81
|
-
}
|
82
|
-
|
83
|
-
async execute() {
|
84
|
-
let runsLeft = 1 + this._retries;
|
85
|
-
let launchError;
|
86
|
-
|
87
|
-
do {
|
88
|
-
try {
|
89
|
-
if (launchError) {
|
90
|
-
const list = this._argv._.map((file, index) => ` ${index + 1}. ${file}`).join('\n');
|
91
|
-
log.error(
|
92
|
-
`There were failing tests in the following files:\n${list}\n\n` +
|
93
|
-
'Detox CLI is going to restart the test runner with those files...\n'
|
94
|
-
);
|
95
|
-
}
|
96
|
-
|
97
|
-
await this._doExecute();
|
98
|
-
launchError = null;
|
99
|
-
} catch (e) {
|
100
|
-
launchError = e;
|
101
|
-
|
102
|
-
const failedTestFiles = detox.session.testResults.filter(r => !r.success);
|
103
|
-
|
104
|
-
const { bail } = detox.config.testRunner;
|
105
|
-
if (bail && failedTestFiles.some(r => r.isPermanentFailure)) {
|
106
|
-
throw e;
|
107
|
-
}
|
108
|
-
|
109
|
-
const testFilesToRetry = failedTestFiles.filter(r => !r.isPermanentFailure).map(r => r.testFilePath);
|
110
|
-
if (_.isEmpty(testFilesToRetry)) {
|
111
|
-
throw e;
|
112
|
-
}
|
113
|
-
|
114
|
-
if (--runsLeft > 0) {
|
115
|
-
this._argv._ = testFilesToRetry;
|
116
|
-
// @ts-ignore
|
117
|
-
detox.session.testSessionIndex++; // it is always a primary context, so we can update it
|
118
|
-
}
|
119
|
-
}
|
120
|
-
} while (launchError && runsLeft > 0);
|
121
|
-
|
122
|
-
if (launchError) {
|
123
|
-
throw launchError;
|
124
|
-
}
|
125
111
|
}
|
126
112
|
|
127
|
-
async
|
113
|
+
async _spawnTestRunner() {
|
128
114
|
const fullCommand = this._buildSpawnArguments().map(escapeSpaces);
|
129
115
|
const fullCommandWithHint = printEnvironmentVariables(this._envHint) + fullCommand.join(' ');
|
130
116
|
|
@@ -136,7 +122,7 @@ class TestRunnerCommand {
|
|
136
122
|
stdio: 'inherit',
|
137
123
|
env: _({})
|
138
124
|
.assign(process.env)
|
139
|
-
.assign(this.
|
125
|
+
.assign(this._envFwd)
|
140
126
|
.omitBy(_.isUndefined)
|
141
127
|
.tap(prependNodeModulesBinToPATH)
|
142
128
|
.value()
|
@@ -160,6 +146,17 @@ class TestRunnerCommand {
|
|
160
146
|
...unparse({ _: [...passthrough, ...specs] }),
|
161
147
|
].map(String);
|
162
148
|
}
|
149
|
+
|
150
|
+
_logRelaunchError() {
|
151
|
+
const list = this._argv._.map((file, index) => {
|
152
|
+
return ` ${index + 1}. ${file}`;
|
153
|
+
}).join('\n');
|
154
|
+
|
155
|
+
log.error(
|
156
|
+
`There were failing tests in the following files:\n${list}\n\n` +
|
157
|
+
'Detox CLI is going to restart the test runner with those files...\n'
|
158
|
+
);
|
159
|
+
}
|
163
160
|
}
|
164
161
|
|
165
162
|
module.exports = TestRunnerCommand;
|
@@ -109,7 +109,6 @@ module.exports = {
|
|
109
109
|
describe: 'Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.',
|
110
110
|
},
|
111
111
|
'device-boot-args': {
|
112
|
-
alias: 'device-launch-args',
|
113
112
|
group: 'Execution:',
|
114
113
|
describe: 'Custom arguments to pass (through) onto the device (emulator/simulator) binary when booted.',
|
115
114
|
},
|
@@ -5,7 +5,7 @@ const { getJestBooleanArgs } = require('../utils/jestInternals');
|
|
5
5
|
const { simpleUnquote, extractKnownKeys, disengageBooleanArgs } = require('../utils/yargsUtils');
|
6
6
|
|
7
7
|
const testCommandArgs = require('./builder');
|
8
|
-
const { DETOX_ARGV_OVERRIDE_NOTICE
|
8
|
+
const { DETOX_ARGV_OVERRIDE_NOTICE } = require('./warnings');
|
9
9
|
|
10
10
|
function applyEnvironmentVariableAddendum(argv, yargs) {
|
11
11
|
if (process.env.DETOX_ARGV_OVERRIDE) {
|
@@ -29,14 +29,6 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
|
|
29
29
|
return argv;
|
30
30
|
}
|
31
31
|
|
32
|
-
function warnDeviceAppLaunchArgsDeprecation(argv) {
|
33
|
-
if (argv['device-boot-args'] && process.argv.some(a => a.startsWith('--device-launch-args'))) {
|
34
|
-
log.warn(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
35
|
-
}
|
36
|
-
|
37
|
-
return argv;
|
38
|
-
}
|
39
|
-
|
40
32
|
/**
|
41
33
|
* @param {Record<string, *>} argv
|
42
34
|
* @returns {{
|
@@ -64,12 +56,10 @@ function splitArgv(argv) {
|
|
64
56
|
// noinspection JSUnusedGlobalSymbols
|
65
57
|
module.exports = {
|
66
58
|
applyEnvironmentVariableAddendum,
|
67
|
-
warnDeviceAppLaunchArgsDeprecation,
|
68
59
|
splitArgv,
|
69
60
|
};
|
70
61
|
|
71
62
|
module.exports.default = [
|
72
63
|
applyEnvironmentVariableAddendum,
|
73
|
-
warnDeviceAppLaunchArgsDeprecation,
|
74
64
|
splitArgv,
|
75
65
|
];
|
@@ -1,5 +1,3 @@
|
|
1
|
-
const { DEVICE_LAUNCH_ARGS_DEPRECATION } = require('../../src/configuration/utils/warnings');
|
2
|
-
|
3
1
|
const DETOX_ARGV_OVERRIDE_NOTICE = `
|
4
2
|
_____ _____ ___________
|
5
3
|
/ ___|_ _| _ | ___ \\ $DETOX_ARGV_OVERRIDE is detected
|
@@ -22,5 +20,4 @@ const DETOX_ARGV_OVERRIDE_NOTICE = `
|
|
22
20
|
|
23
21
|
module.exports = {
|
24
22
|
DETOX_ARGV_OVERRIDE_NOTICE,
|
25
|
-
DEVICE_LAUNCH_ARGS_DEPRECATION,
|
26
23
|
};
|
@@ -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.14-
|
4
|
+
"version": "20.0.14-prerelease.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -35,8 +35,8 @@
|
|
35
35
|
"@types/bunyan": "^1.8.8",
|
36
36
|
"@types/child-process-promise": "^2.2.1",
|
37
37
|
"@types/fs-extra": "^9.0.13",
|
38
|
-
"@types/jest": "^
|
39
|
-
"@types/node": "^
|
38
|
+
"@types/jest": "^28.1.8",
|
39
|
+
"@types/node": "^14.18.33",
|
40
40
|
"@types/node-ipc": "^9.2.0",
|
41
41
|
"@types/ws": "^7.4.0",
|
42
42
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
@@ -46,10 +46,10 @@
|
|
46
46
|
"eslint-plugin-no-only-tests": "^2.6.0",
|
47
47
|
"eslint-plugin-node": "^11.1.0",
|
48
48
|
"eslint-plugin-unicorn": "^39.0.0",
|
49
|
-
"jest": "^28.
|
49
|
+
"jest": "^28.1.3",
|
50
50
|
"mockdate": "^2.0.1",
|
51
51
|
"prettier": "1.7.0",
|
52
|
-
"react-native": "0.69.
|
52
|
+
"react-native": "0.69.7",
|
53
53
|
"react-native-codegen": "^0.0.8",
|
54
54
|
"typescript": "^4.5.2",
|
55
55
|
"wtfnode": "^0.9.1"
|
@@ -58,6 +58,7 @@
|
|
58
58
|
"ajv": "^8.6.3",
|
59
59
|
"bunyan": "^1.8.12",
|
60
60
|
"bunyan-debug-stream": "^3.1.0",
|
61
|
+
"caf": "^15.0.1",
|
61
62
|
"chalk": "^2.4.2",
|
62
63
|
"child-process-promise": "^2.2.0",
|
63
64
|
"duplexify": "^4.1.2",
|
@@ -92,7 +93,7 @@
|
|
92
93
|
"yargs-unparser": "^2.0.0"
|
93
94
|
},
|
94
95
|
"peerDependencies": {
|
95
|
-
"jest": "28.x.x || ^27.2.5"
|
96
|
+
"jest": "29.x.x || 28.x.x || ^27.2.5"
|
96
97
|
},
|
97
98
|
"peerDependenciesMeta": {
|
98
99
|
"jest": {
|
@@ -100,7 +101,7 @@
|
|
100
101
|
}
|
101
102
|
},
|
102
103
|
"engines": {
|
103
|
-
"node": ">=
|
104
|
+
"node": ">=14.5.0"
|
104
105
|
},
|
105
106
|
"jest": {
|
106
107
|
"setupFiles": [
|
@@ -159,7 +160,20 @@
|
|
159
160
|
"src/utils/pipeCommands.js",
|
160
161
|
"src/utils/pressAnyKey.js",
|
161
162
|
"src/utils/shellUtils.js",
|
162
|
-
"
|
163
|
+
"local-cli/testCommand/TestRunnerCommand.js",
|
164
|
+
"local-cli/testCommand/middlewares.js",
|
165
|
+
"src/DetoxWorker.js",
|
166
|
+
"src/artifacts/ArtifactsManager.js",
|
167
|
+
"src/devices/lifecycle/GenyGlobalLifecycleHandler.js",
|
168
|
+
"src/errors/DetoxError.js",
|
169
|
+
"src/ipc",
|
170
|
+
"src/logger",
|
171
|
+
"src/realms",
|
172
|
+
"src/utils/Timer.js",
|
173
|
+
"src/utils/envUtils.js",
|
174
|
+
"runners/jest/index.js",
|
175
|
+
"runners/jest/reporters",
|
176
|
+
"runners/jest/testEnvironment"
|
163
177
|
],
|
164
178
|
"resetMocks": true,
|
165
179
|
"resetModules": true,
|
@@ -177,12 +191,12 @@
|
|
177
191
|
],
|
178
192
|
"coverageThreshold": {
|
179
193
|
"global": {
|
180
|
-
"statements":
|
181
|
-
"branches":
|
182
|
-
"functions":
|
183
|
-
"lines":
|
194
|
+
"statements": 100,
|
195
|
+
"branches": 100,
|
196
|
+
"functions": 100,
|
197
|
+
"lines": 100
|
184
198
|
}
|
185
199
|
}
|
186
200
|
},
|
187
|
-
"gitHead": "
|
201
|
+
"gitHead": "40d0a32720bb36575136f3c2769407bb2cef0cdf"
|
188
202
|
}
|