detox 20.0.14-next-is-hittable-check-2.0 → 20.0.14-prerelease.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar} +0 -0
  12. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom} +1 -1
  17. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha512 +1 -0
  21. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  22. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  23. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  24. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  25. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  26. package/Detox-ios-src.tbz +0 -0
  27. package/Detox-ios.tbz +0 -0
  28. package/index.d.ts +3 -4
  29. package/internals.d.ts +26 -5
  30. package/local-cli/cli.js +1 -1
  31. package/local-cli/init.js +1 -1
  32. package/local-cli/test.js +6 -6
  33. package/local-cli/test.test.js +14 -18
  34. package/local-cli/testCommand/TestRunnerCommand.js +75 -86
  35. package/local-cli/testCommand/builder.js +0 -1
  36. package/local-cli/testCommand/middlewares.js +1 -11
  37. package/local-cli/testCommand/warnings.js +0 -3
  38. package/package.json +22 -8
  39. package/runners/deprecation.js +42 -44
  40. package/runners/jest/index.d.ts +60 -0
  41. package/runners/jest/index.js +3 -8
  42. package/runners/jest/reporters/DetoxReporter.js +21 -10
  43. package/runners/jest/testEnvironment/index.js +57 -41
  44. package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +7 -3
  45. package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
  46. package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
  47. package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
  48. package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
  49. package/src/DetoxWorker.js +84 -46
  50. package/src/artifacts/ArtifactsManager.js +6 -6
  51. package/src/configuration/collectCliConfig.js +1 -12
  52. package/src/configuration/composeRunnerConfig.js +4 -3
  53. package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
  54. package/src/errors/DetoxConfigErrorComposer.js +6 -1
  55. package/src/ipc/SessionState.js +7 -5
  56. package/src/logger/DetoxLogger.js +1 -19
  57. package/src/logger/index.js +1 -0
  58. package/src/logger/utils/CategoryThreadDispatcher.js +7 -29
  59. package/src/logger/utils/DetoxLogFinalizer.js +134 -0
  60. package/src/logger/utils/ThreadDispatcher.js +5 -25
  61. package/src/logger/utils/customConsoleLogger.js +4 -3
  62. package/src/logger/utils/streamUtils.js +34 -26
  63. package/src/realms/DetoxContext.js +8 -7
  64. package/src/realms/DetoxPrimaryContext.js +22 -82
  65. package/src/realms/DetoxSecondaryContext.js +0 -8
  66. package/src/utils/argparse.js +11 -0
  67. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.md5 +0 -1
  68. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha1 +0 -1
  69. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha256 +0 -1
  70. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha512 +0 -1
  71. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.md5 +0 -1
  72. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha1 +0 -1
  73. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha256 +0 -1
  74. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha512 +0 -1
  75. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.md5 +0 -1
  76. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha1 +0 -1
  77. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha256 +0 -1
  78. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha512 +0 -1
  79. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.md5 +0 -1
  80. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha1 +0 -1
  81. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha256 +0 -1
  82. package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha512 +0 -1
  83. package/runners/jest/deprecation.js +0 -25
  84. package/src/configuration/utils/warnings.js +0 -12
@@ -0,0 +1 @@
1
+ 31332781d3002ae93a1eaec77474e9f55bc7e5c7
@@ -0,0 +1 @@
1
+ dcdfc5160bc82d542532fabc0b278164e550b9df0fc3f7a5afe6beaff60701f5
@@ -0,0 +1 @@
1
+ 71f4200bf6199efed9fb74fb1cd92570ed90abbe4bdf7c37816571c49af0d0559fcb943eafac23fd3a4e4004b822bb2248e062185df77ea13110acc9b0a4c26d
@@ -0,0 +1 @@
1
+ 04ee086f0aed13fd42de03340cc5c1d8d8749f6d
@@ -0,0 +1 @@
1
+ 904c995d85c623ebe69096dba272c0e855d99b96c9997dfb2f4a2321b603356e
@@ -0,0 +1 @@
1
+ fc2b80324b5b497e17a4e9adf5d7b06d003fca036559e7e61b39b8777e9238377e182f0959e54ee452053538fa1b17d65537158ed952b8b99e995d2fde590b0f
@@ -0,0 +1 @@
1
+ c58bcf2c4a81d085044d69b52af78a5a
@@ -0,0 +1 @@
1
+ d04a40498c30936d34cb2e8a41fea10936344a2f
@@ -0,0 +1 @@
1
+ 4bd349ffd3768c46cd1bc7ce021607e38c08e8e7187a21d27b08aaf53dd52873
@@ -0,0 +1 @@
1
+ c5c0556c23c72736ecd14d2227fdb65ddd100c1f47f460a6d1c02ae0a23a1a2774deb598ac56e2b7e6624aa028a3db00c312666233ea730b6bc7ed4863b6ebbf
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox</artifactId>
6
- <version>20.0.14-next-is-hittable-check-2.0</version>
6
+ <version>20.0.14-prerelease.0</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ 8bd920eb4542d031002c33d93308f426
@@ -0,0 +1 @@
1
+ 914ef3c1658d24794b7b94393578d899b16c0ed0
@@ -0,0 +1 @@
1
+ a9b0b7bda22739644dee243f227c20d956ea3294378f75dea8d0f3d0d861d559
@@ -0,0 +1 @@
1
+ 523b294c136c5be73335a2c75f3ebb8bce7aa79579810a7cd96cb28a69e000043dbf188b44e30b06ee5762fead96255c3efd272ab4d9a8691428510e055160d5
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.0.14-next-is-hittable-check-2.0</latest>
7
- <release>20.0.14-next-is-hittable-check-2.0</release>
6
+ <latest>20.0.14-prerelease.0</latest>
7
+ <release>20.0.14-prerelease.0</release>
8
8
  <versions>
9
- <version>20.0.14-next-is-hittable-check-2.0</version>
9
+ <version>20.0.14-prerelease.0</version>
10
10
  </versions>
11
- <lastUpdated>20221102074725</lastUpdated>
11
+ <lastUpdated>20221108145605</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- a1b9fb9ca9d07b3262312c77cbff61fb
1
+ ba7d8cb5496d1d9366a8234bc4e64055
@@ -1 +1 @@
1
- e8e44759632af3d4984893f4a28563aea9527f22
1
+ 77f004770bdd78a7442584a10dd84ef431783841
@@ -1 +1 @@
1
- ae7d117aa6790de1a9487a514d0cf8244edb3885b266cc06030c77f14feb86ff
1
+ dd9c1791bb2c603c4806ebca0b071f52229edadedc9e487d52a434c1c24638b7
@@ -1 +1 @@
1
- d256253b0492f63eda88eebb21a54e0ee3d73ab7420ff1db8e766ef09f49d8c854e4054358a0ad0d539380faa918ac0334405977c1e73126f00f6e939e4cb9da
1
+ a2914ac9dc6c4bd7a1f84a46a8f84e467d314b71f96d6603c4303bc54344d354fdc2903e1934c275ee785cd4a544c7a7f575c512ad6b623b76f943b672be718c
package/Detox-ios-src.tbz CHANGED
Binary file
package/Detox-ios.tbz CHANGED
Binary file
package/index.d.ts CHANGED
@@ -82,7 +82,7 @@ declare global {
82
82
  */
83
83
  exposeGlobals?: boolean;
84
84
  /**
85
- * By default, Detox will uninstall and install the app upon the initialization.
85
+ * By default, Detox will uninstall and install the app upon initialization.
86
86
  * If you wish to reuse the existing app for a faster run, set the property to
87
87
  * `false`.
88
88
  */
@@ -408,8 +408,6 @@ declare global {
408
408
  os: string;
409
409
  }
410
410
 
411
- type DetoxKnownDeviceType = DetoxBuiltInDeviceConfig['type'];
412
-
413
411
  type DetoxConfiguration = DetoxConfigurationCommon & (
414
412
  | DetoxConfigurationSingleApp
415
413
  | DetoxConfigurationMultiApps
@@ -683,10 +681,11 @@ declare global {
683
681
  * Relaunch the app. Convenience method that calls {@link Device#launchApp}
684
682
  * with { newInstance: true } override.
685
683
  *
684
+ * @deprecated
686
685
  * @param config
687
686
  * @see Device#launchApp
688
687
  */
689
- relaunchApp(config?: Omit<DeviceLaunchAppConfig, 'newInstance'>): Promise<void>;
688
+ relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
690
689
 
691
690
  /**
692
691
  * Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and
package/internals.d.ts CHANGED
@@ -13,28 +13,36 @@ declare global {
13
13
  resolveConfig(options?: Partial<DetoxInitOptions>): Promise<RuntimeConfig>;
14
14
 
15
15
  /**
16
+ * Returns one of statuses depending on what’s going with the current Detox context:
16
17
  *
18
+ * `inactive` – before `init()` and after `cleanup()` is called.
19
+ * `init` – while `init()` is executing.
20
+ * `active` – after `init()` and before `cleanup()` is called.
21
+ * `cleanup` – while `cleanup()` is executing.
17
22
  */
18
23
  getStatus(): DetoxStatus;
19
24
 
20
25
  /**
21
- * This is the phase where Detox reads its configuration, starts a server.
26
+ * Starts a new Detox test session with the provided configuration.
27
+ * See {@link https://wix.github.io/Detox/docs/next/api/internals} for more details.
22
28
  */
23
29
  init(options?: Partial<DetoxInitOptions>): Promise<void>;
24
30
 
25
31
  /**
26
- * This is the phase where Detox loads its expectation library and starts a device.
32
+ * This is the phase where Detox loads its expectation library and boots a device.
33
+ * You don't need to call it separately unless you use `init({ workerId: null })` override.
27
34
  */
28
35
  installWorker(options?: Partial<DetoxInstallWorkerOptions>): Promise<void>;
29
36
 
30
37
  /**
31
38
  * Deallocates the device.
39
+ * Most Client API (device, by, element, expect) will stop working, except for the logger.
32
40
  */
33
41
  uninstallWorker(): Promise<void>;
34
42
 
35
43
  /**
36
- * The global cleanup phase should happen after all the tests have finished.
37
- * This is the phase where the Detox server shuts down.
44
+ * This method should be called when the main or child process is about to exit.
45
+ * See {@link https://wix.github.io/Detox/docs/next/api/internals} for more details.
38
46
  */
39
47
  cleanup(): Promise<void>;
40
48
  //#endregion
@@ -234,7 +242,7 @@ declare global {
234
242
  * or equal to "default" if the name is not configured.
235
243
  */
236
244
  apps: Record<string, Readonly<Detox.DetoxAppConfig>>;
237
- artifacts: Readonly<Detox.DetoxArtifactsConfig>;
245
+ artifacts: Readonly<RuntimeArtifactsConfig>;
238
246
  behavior: Readonly<Detox.DetoxBehaviorConfig>;
239
247
  cli: Readonly<CLIConfig>;
240
248
  device: Readonly<Detox.DetoxDeviceConfig>;
@@ -243,6 +251,19 @@ declare global {
243
251
  session: Readonly<Detox.DetoxSessionConfig>;
244
252
  }>;
245
253
 
254
+ type RuntimeArtifactsConfig = {
255
+ rootDir: string;
256
+ pathBuilder: string;
257
+ plugins: Readonly<{
258
+ log: Readonly<Detox.DetoxLogArtifactsPluginConfig>;
259
+ screenshot: Readonly<Detox.DetoxScreenshotArtifactsPluginConfig>;
260
+ video: Readonly<Detox.DetoxVideoArtifactsPluginConfig>;
261
+ instruments: Readonly<Detox.DetoxInstrumentsArtifactsPluginConfig>;
262
+ uiHierarchy: Readonly<Detox.DetoxUIHierarchyArtifactsPluginConfig>;
263
+ [pluginId: string]: unknown;
264
+ }>;
265
+ };
266
+
246
267
  type CLIConfig = Readonly<Partial<{
247
268
  appLaunchArgs: string;
248
269
  artifactsLocation: string;
package/local-cli/cli.js CHANGED
@@ -30,7 +30,7 @@ yargs
30
30
  if (err) {
31
31
  logger.error(DetoxError.format(err));
32
32
  // eslint-disable-next-line no-console
33
- console.error('');
33
+ process.stderr.write('\n');
34
34
  // @ts-ignore
35
35
  _.attempt(() => fs.unlinkSync(logger.file));
36
36
  // eslint-disable-next-line no-process-exit
package/local-cli/init.js CHANGED
@@ -9,7 +9,7 @@ const jestTemplates = require('./templates/jest');
9
9
  let exitCode = 0;
10
10
 
11
11
  module.exports.command = 'init';
12
- module.exports.desc = 'Scaffold initial E2E test folder structure for Detox';
12
+ module.exports.desc = 'Creates template files to get you started with Detox';
13
13
  module.exports.builder = {};
14
14
 
15
15
  module.exports.handler = async function init() {
package/local-cli/test.js CHANGED
@@ -3,7 +3,7 @@ const detox = require('../internals');
3
3
  const TestRunnerCommand = require('./testCommand/TestRunnerCommand');
4
4
 
5
5
  module.exports.command = 'test';
6
- module.exports.desc = 'Run your test suite with the test runner specified in package.json';
6
+ module.exports.desc = 'Run your test suites with the test runner specified in the project\'s Detox config';
7
7
  module.exports.builder = require('./testCommand/builder');
8
8
  module.exports.middlewares = require('./testCommand/middlewares').default;
9
9
 
@@ -16,14 +16,14 @@ module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
16
16
  };
17
17
 
18
18
  const config = await detox.resolveConfig(opts);
19
- if (!detoxArgs['inspect-brk']) {
19
+ if (!config.cli.inspectBrk) {
20
20
  await detox.init(opts);
21
21
  }
22
22
 
23
- const runnerCommand = new TestRunnerCommand()
24
- .setDeviceConfig(config.device)
25
- .replicateCLIConfig(config.cli)
26
- .setRunnerConfig(config.testRunner);
23
+ const runnerCommand = new TestRunnerCommand({
24
+ config,
25
+ env: process.env,
26
+ });
27
27
 
28
28
  await runnerCommand.execute();
29
29
  } finally {
@@ -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');
@@ -327,13 +328,6 @@ describe('CLI', () => {
327
328
  expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
328
329
  });
329
330
 
330
- test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
331
- await run(`--device-launch-args="--verbose"`);
332
- expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
333
- expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
334
- expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
335
- });
336
-
337
331
  test('--app-launch-args should be passed as an environment variable', async () => {
338
332
  await run(`--app-launch-args="--debug yes"`);
339
333
  expect(cliCall().env).toHaveProperty('DETOX_APP_LAUNCH_ARGS');
@@ -374,8 +368,6 @@ describe('CLI', () => {
374
368
  expect(cliCall().argv.slice(-2)).toEqual(['e2e/01.sanity.test.js', 'e2e/02.sanity.test.js']);
375
369
  });
376
370
 
377
- test.todo('--inspect-brk should work');
378
-
379
371
  test.each([
380
372
  ['-d e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
381
373
  ['--debug-synchronization e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
@@ -453,15 +445,14 @@ describe('CLI', () => {
453
445
  expect(cliCall().argv).toContain('--deepParameter');
454
446
  });
455
447
 
456
- // TODO: revive this test
457
- test.skip('--inspect-brk should prepend "node --inspect-brk" to the command', async () => {
458
- await run('--inspect-brk');
448
+ test('--inspect-brk should activate inspectBrk hook', async () => {
449
+ detoxConfig.testRunner.inspectBrk = (config) => {
450
+ config.args.customFlag = true;
451
+ return config;
452
+ };
459
453
 
460
- if (process.platform === 'win32') {
461
- expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/jest\/bin\/jest\.js/);
462
- } else {
463
- expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/\.bin\/jest/);
464
- }
454
+ await run('--inspect-brk');
455
+ expect(cliCall().argv).toContain('--customFlag');
465
456
  });
466
457
 
467
458
  test('should append $DETOX_ARGV_OVERRIDE to detox test ... command and print a warning', async () => {
@@ -531,7 +522,12 @@ describe('CLI', () => {
531
522
  }
532
523
 
533
524
  async function run(...args) {
534
- detoxConfigPath = tempfile('.json', JSON.stringify(detoxConfig));
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);
535
531
  const __configPath = Math.random() > 0.5 ? '-C' : '--config-path';
536
532
  return runRaw('test', __configPath, detoxConfigPath, ...args);
537
533
  }
@@ -11,98 +11,33 @@ const { printEnvironmentVariables, prependNodeModulesBinToPATH } = require('../.
11
11
  const { escapeSpaces } = require('../../src/utils/shellUtils');
12
12
 
13
13
  class TestRunnerCommand {
14
- constructor() {
15
- this._argv = {};
16
- this._cli2env = {};
17
- this._envHint = {};
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);
18
27
  this._envFwd = {};
19
- this._retries = 0;
20
- /** @type {Detox.DetoxDeviceConfig} */
21
- this._deviceConfig = null;
22
- }
23
-
24
- /**
25
- * @param {Partial<Readonly<DetoxInternals.CLIConfig>>} cliConfig
26
- * @returns {this}
27
- */
28
- replicateCLIConfig(cliConfig) {
29
- this._cli2env = _.omitBy({
30
- DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
31
- DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
32
- DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
33
- DETOX_CLEANUP: cliConfig.cleanup,
34
- DETOX_CONFIGURATION: cliConfig.configuration,
35
- DETOX_CONFIG_PATH: cliConfig.configPath,
36
- DETOX_DEBUG_SYNCHRONIZATION: cliConfig.debugSynchronization,
37
- DETOX_DEVICE_BOOT_ARGS: cliConfig.deviceBootArgs,
38
- DETOX_DEVICE_NAME: cliConfig.deviceName,
39
- DETOX_FORCE_ADB_INSTALL: this._deviceConfig.type.startsWith('android.')
40
- ? cliConfig.forceAdbInstall
41
- : undefined,
42
- DETOX_GPU: cliConfig.gpu,
43
- DETOX_HEADLESS: cliConfig.headless,
44
- DETOX_KEEP_LOCKFILE: cliConfig.keepLockFile,
45
- DETOX_LOGLEVEL: cliConfig.loglevel,
46
- DETOX_READ_ONLY_EMU: cliConfig.readonlyEmu,
47
- DETOX_RECORD_LOGS: cliConfig.recordLogs,
48
- DETOX_RECORD_PERFORMANCE: cliConfig.recordPerformance,
49
- DETOX_RECORD_VIDEOS: cliConfig.recordVideos,
50
- DETOX_REPORT_SPECS: cliConfig.jestReportSpecs,
51
- DETOX_RETRIES: cliConfig.retries,
52
- DETOX_REUSE: cliConfig.reuse,
53
- DETOX_TAKE_SCREENSHOTS: cliConfig.takeScreenshots,
54
- DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
55
- }, _.isUndefined);
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);
28
+ if (runnerConfig.forwardEnv) {
29
+ this._envFwd = this._buildEnvOverride(cliConfig, deviceConfig);
30
+ Object.assign(this._envHint, this._envFwd);
86
31
  }
87
-
88
- return this;
89
32
  }
90
33
 
91
34
  async execute() {
92
35
  let runsLeft = 1 + this._retries;
93
- let launchError;
36
+ let launchError = null;
94
37
 
95
38
  do {
96
39
  try {
97
- if (launchError) {
98
- const list = this._argv._.map((file, index) => ` ${index + 1}. ${file}`).join('\n');
99
- log.error(
100
- `There were failing tests in the following files:\n${list}\n\n` +
101
- 'Detox CLI is going to restart the test runner with those files...\n'
102
- );
103
- }
104
-
105
- await this._doExecute();
40
+ await this._spawnTestRunner();
106
41
  launchError = null;
107
42
  } catch (e) {
108
43
  launchError = e;
@@ -120,9 +55,10 @@ class TestRunnerCommand {
120
55
  }
121
56
 
122
57
  if (--runsLeft > 0) {
123
- this._argv._ = testFilesToRetry;
124
58
  // @ts-ignore
125
- detox.session.testSessionIndex++; // it is always a primary context, so we can update it
59
+ detox.session.testSessionIndex++; // it is always the primary context, so we can update it
60
+ this._argv._ = testFilesToRetry;
61
+ this._logRelaunchError();
126
62
  }
127
63
  }
128
64
  } while (launchError && runsLeft > 0);
@@ -132,7 +68,49 @@ class TestRunnerCommand {
132
68
  }
133
69
  }
134
70
 
135
- async _doExecute() {
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();
77
+ }
78
+
79
+ /**
80
+ * @param {DetoxInternals.CLIConfig} cliConfig
81
+ * @param {Detox.DetoxDeviceConfig} deviceConfig
82
+ */
83
+ _buildEnvOverride(cliConfig, deviceConfig) {
84
+ return _.omitBy({
85
+ DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
86
+ DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
87
+ DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
88
+ DETOX_CLEANUP: cliConfig.cleanup,
89
+ DETOX_CONFIGURATION: cliConfig.configuration,
90
+ DETOX_CONFIG_PATH: cliConfig.configPath,
91
+ DETOX_DEBUG_SYNCHRONIZATION: cliConfig.debugSynchronization,
92
+ DETOX_DEVICE_BOOT_ARGS: cliConfig.deviceBootArgs,
93
+ DETOX_DEVICE_NAME: cliConfig.deviceName,
94
+ DETOX_FORCE_ADB_INSTALL: deviceConfig.type.startsWith('android.')
95
+ ? cliConfig.forceAdbInstall
96
+ : undefined,
97
+ DETOX_GPU: cliConfig.gpu,
98
+ DETOX_HEADLESS: cliConfig.headless,
99
+ DETOX_KEEP_LOCKFILE: cliConfig.keepLockFile,
100
+ DETOX_LOGLEVEL: cliConfig.loglevel,
101
+ DETOX_READ_ONLY_EMU: cliConfig.readonlyEmu,
102
+ DETOX_RECORD_LOGS: cliConfig.recordLogs,
103
+ DETOX_RECORD_PERFORMANCE: cliConfig.recordPerformance,
104
+ DETOX_RECORD_VIDEOS: cliConfig.recordVideos,
105
+ DETOX_REPORT_SPECS: cliConfig.jestReportSpecs,
106
+ DETOX_RETRIES: cliConfig.retries,
107
+ DETOX_REUSE: cliConfig.reuse,
108
+ DETOX_TAKE_SCREENSHOTS: cliConfig.takeScreenshots,
109
+ DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
110
+ }, _.isUndefined);
111
+ }
112
+
113
+ async _spawnTestRunner() {
136
114
  const fullCommand = this._buildSpawnArguments().map(escapeSpaces);
137
115
  const fullCommandWithHint = printEnvironmentVariables(this._envHint) + fullCommand.join(' ');
138
116
 
@@ -168,6 +146,17 @@ class TestRunnerCommand {
168
146
  ...unparse({ _: [...passthrough, ...specs] }),
169
147
  ].map(String);
170
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
+ }
171
160
  }
172
161
 
173
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, DEVICE_LAUNCH_ARGS_DEPRECATION } = require('./warnings');
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
  };
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-next-is-hittable-check-2.0",
4
+ "version": "20.0.14-prerelease.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -49,7 +49,7 @@
49
49
  "jest": "^28.1.3",
50
50
  "mockdate": "^2.0.1",
51
51
  "prettier": "1.7.0",
52
- "react-native": "0.69.5",
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",
@@ -159,7 +160,20 @@
159
160
  "src/utils/pipeCommands.js",
160
161
  "src/utils/pressAnyKey.js",
161
162
  "src/utils/shellUtils.js",
162
- "runners/jest/.*.js"
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": 0,
181
- "branches": 0,
182
- "functions": 0,
183
- "lines": 0
194
+ "statements": 100,
195
+ "branches": 100,
196
+ "functions": 100,
197
+ "lines": 100
184
198
  }
185
199
  }
186
200
  },
187
- "gitHead": "e39754e793d51241d301c756faa193a9a9fa4c59"
201
+ "gitHead": "40d0a32720bb36575136f3c2769407bb2cef0cdf"
188
202
  }