detox 20.0.2-breaking.new-global-lifecycle.0 → 20.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/Detox-android/com/wix/detox/{20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.2/detox-20.0.2-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-sources.jar → 20.0.2/detox-20.0.2-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar +0 -0
  12. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/{20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.pom → 20.0.2/detox-20.0.2.pom} +1 -7
  17. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.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/README.md +1 -1
  29. package/android/build.gradle +12 -7
  30. package/android/detox/build.gradle +13 -9
  31. package/android/detox/proguard-rules-app.pro +6 -0
  32. package/android/detox/proguard-rules.pro +3 -0
  33. package/android/detox/publishing.gradle +27 -27
  34. package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
  35. package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
  36. package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +1 -1
  37. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
  38. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
  39. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +19 -13
  40. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
  41. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
  42. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
  43. package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
  44. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
  45. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
  46. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
  47. package/index.d.ts +195 -59
  48. package/internals.d.ts +216 -49
  49. package/local-cli/build.js +2 -2
  50. package/local-cli/build.test.js +14 -14
  51. package/local-cli/cli.js +11 -6
  52. package/local-cli/init.js +61 -21
  53. package/local-cli/rebuild-framework-cache.js +1 -1
  54. package/local-cli/reset-lock-file.js +16 -0
  55. package/local-cli/templates/jest.js +13 -10
  56. package/local-cli/test.js +14 -8
  57. package/local-cli/test.test.js +143 -62
  58. package/local-cli/testCommand/TestRunnerCommand.js +97 -77
  59. package/local-cli/testCommand/TestRunnerError.js +17 -0
  60. package/local-cli/testCommand/TestRunnerError.test.js +25 -0
  61. package/local-cli/testCommand/builder.js +0 -1
  62. package/local-cli/testCommand/middlewares.js +4 -13
  63. package/local-cli/testCommand/warnings.js +0 -3
  64. package/local-cli/utils/jestInternals.js +4 -1
  65. package/package.json +23 -17
  66. package/runners/deprecation.js +42 -44
  67. package/runners/jest/globalSetup.js +1 -1
  68. package/runners/jest/globalTeardown.js +1 -1
  69. package/runners/jest/index.d.ts +60 -0
  70. package/runners/jest/index.js +3 -8
  71. package/runners/jest/index.test.js +13 -0
  72. package/runners/jest/reporters/DetoxReporter.js +33 -2
  73. package/runners/jest/testEnvironment/index.js +119 -69
  74. package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +94 -47
  75. package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
  76. package/runners/jest/testEnvironment/listeners/SpecReporter.js +14 -16
  77. package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +2 -6
  78. package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
  79. package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
  80. package/src/DetoxWorker.js +105 -62
  81. package/src/android/core/NativeElement.js +56 -20
  82. package/src/android/core/NativeExpect.js +28 -9
  83. package/src/android/interactions/native.js +25 -18
  84. package/src/artifacts/ArtifactsManager.js +14 -47
  85. package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
  86. package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
  87. package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
  88. package/src/artifacts/templates/artifact/Artifact.js +1 -1
  89. package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
  90. package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
  91. package/src/artifacts/utils/temporaryPath.js +49 -8
  92. package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
  93. package/src/client/AsyncWebSocket.js +8 -17
  94. package/src/client/Client.js +19 -2
  95. package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
  96. package/src/configuration/collectCliConfig.js +1 -12
  97. package/src/configuration/composeAppsConfig.js +4 -0
  98. package/src/configuration/composeDeviceConfig.js +1 -1
  99. package/src/configuration/composeLoggerConfig.js +19 -10
  100. package/src/configuration/composeRunnerConfig.js +61 -9
  101. package/src/configuration/index.js +14 -9
  102. package/src/configuration/loadExternalConfig.js +1 -1
  103. package/src/devices/allocation/DeviceAllocator.js +3 -2
  104. package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
  105. package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
  106. package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
  107. package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -2
  108. package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
  109. package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
  110. package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
  111. package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
  112. package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
  113. package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
  114. package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
  115. package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
  116. package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +29 -3
  117. package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
  118. package/src/devices/runtime/RuntimeDevice.js +19 -12
  119. package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
  120. package/src/devices/runtime/drivers/android/AndroidDriver.js +10 -2
  121. package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
  122. package/src/errors/DetoxConfigErrorComposer.js +17 -2
  123. package/src/errors/DetoxError.js +5 -1
  124. package/src/ios/expectTwo.js +153 -67
  125. package/src/ipc/IPCClient.js +12 -13
  126. package/src/ipc/IPCServer.js +28 -24
  127. package/src/ipc/{state.js → SessionState.js} +26 -53
  128. package/src/logger/DetoxLogger.js +287 -154
  129. package/src/logger/index.js +5 -0
  130. package/src/logger/utils/BunyanLogger.js +115 -0
  131. package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
  132. package/src/logger/utils/DetoxLogFinalizer.js +162 -0
  133. package/src/logger/utils/MessageStack.js +35 -0
  134. package/src/logger/utils/ThreadDispatcher.js +61 -0
  135. package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
  136. package/src/logger/utils/getMainCategory.js +5 -0
  137. package/src/logger/utils/sanitizeBunyanContext.js +30 -0
  138. package/src/logger/utils/streams/BunyanTransformer.js +72 -0
  139. package/src/logger/utils/streams/ChromeTraceTransformer.js +127 -0
  140. package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
  141. package/src/logger/utils/streams/JSONLStringer.js +55 -0
  142. package/src/logger/utils/streams/index.js +7 -0
  143. package/src/logger/utils/streams/transformers.js +39 -0
  144. package/src/logger/utils/tracerLegacy.js +37 -0
  145. package/src/realms/DetoxContext.js +79 -65
  146. package/src/realms/DetoxInternalsFacade.js +8 -12
  147. package/src/realms/DetoxPrimaryContext.js +111 -72
  148. package/src/realms/DetoxSecondaryContext.js +29 -32
  149. package/src/server/DetoxConnection.js +18 -23
  150. package/src/server/DetoxServer.js +7 -10
  151. package/src/server/DetoxSession.js +6 -6
  152. package/src/server/DetoxSessionManager.js +1 -1
  153. package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
  154. package/src/symbols.js +16 -22
  155. package/src/utils/Timer.js +55 -38
  156. package/src/utils/argparse.js +11 -0
  157. package/src/utils/childProcess/exec.js +1 -1
  158. package/src/utils/childProcess/spawn.js +1 -1
  159. package/src/utils/errorUtils.js +24 -3
  160. package/src/utils/invocationTraceDescriptions.js +43 -0
  161. package/src/utils/logger.js +1 -1
  162. package/src/utils/pathUtils.js +11 -0
  163. package/src/utils/shellUtils.js +17 -0
  164. package/src/utils/traceInvocationCall.js +21 -0
  165. package/src/utils/traceMethods.js +15 -0
  166. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
  167. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
  168. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
  169. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
  170. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
  171. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
  172. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
  173. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
  174. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.aar +0 -0
  175. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.aar.md5 +0 -1
  176. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
  177. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
  178. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
  179. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.pom.md5 +0 -1
  180. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
  181. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
  182. package/Detox-android/com/wix/detox/20.0.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
  183. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
  184. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
  185. package/runners/jest/deprecation.js +0 -25
  186. package/src/configuration/utils/warnings.js +0 -12
  187. package/src/logger/DetoxTraceEventBuilder.js +0 -21
  188. package/src/logger/DetoxTracer.js +0 -133
  189. package/src/logger/TraceThreadDispatcher.js +0 -52
  190. package/src/utils/ChromeTracingExporter.js +0 -54
  191. package/src/utils/streamUtils.js +0 -214
  192. package/src/utils/trace.js +0 -19
package/index.d.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  // * Dor Ben Baruch <https://github.com/Dor256>
10
10
 
11
11
  import { BunyanDebugStreamOptions } from 'bunyan-debug-stream';
12
- import { EndHandle } from 'trace-event-lib';
13
12
 
14
13
  declare global {
14
+ const detox: Detox.DetoxExportWrapper;
15
15
  const device: Detox.DetoxExportWrapper['device'];
16
16
  const element: Detox.DetoxExportWrapper['element'];
17
17
  const waitFor: Detox.DetoxExportWrapper['waitFor'];
@@ -21,6 +21,7 @@ declare global {
21
21
 
22
22
  namespace NodeJS {
23
23
  interface Global {
24
+ detox: Detox.DetoxExportWrapper;
24
25
  device: Detox.DetoxExportWrapper['device'];
25
26
  element: Detox.DetoxExportWrapper['element'];
26
27
  waitFor: Detox.DetoxExportWrapper['waitFor'];
@@ -31,7 +32,7 @@ declare global {
31
32
  }
32
33
 
33
34
  namespace Detox {
34
- // region DetoxConfig
35
+ //#region DetoxConfig
35
36
 
36
37
  interface DetoxConfig extends DetoxConfigurationCommon {
37
38
  /**
@@ -81,15 +82,19 @@ declare global {
81
82
  */
82
83
  exposeGlobals?: boolean;
83
84
  /**
84
- * By default, Detox will uninstall and install the app upon the initialization.
85
+ * By default, Detox will uninstall and install the app upon initialization.
85
86
  * If you wish to reuse the existing app for a faster run, set the property to
86
87
  * `false`.
87
88
  */
88
89
  reinstallApp?: boolean;
89
90
  /**
90
- * If you wish to run multiple "detox test" commands in parallel,
91
- * make sure they don't delete the shared lock file only the
92
- * first command should reset the lock file.
91
+ * When false, `detox test` command always deletes the shared lock file on start,
92
+ * assuming it had been left from the previous, already finished test session.
93
+ * The lock file contains information about busy and free devices and ensures
94
+ * no device can be used simultaneously by multiple test workers.
95
+ *
96
+ * Setting it to **true** might be useful when if you need to run multiple
97
+ * `detox test` commands in parallel, e.g. test a few configurations at once.
93
98
  *
94
99
  * @default false
95
100
  */
@@ -101,13 +106,43 @@ declare global {
101
106
  };
102
107
  }
103
108
 
109
+ type _DetoxLoggerOptions = Omit<BunyanDebugStreamOptions, 'out'>;
110
+
104
111
  interface DetoxLoggerConfig {
112
+ /**
113
+ * Log level filters the messages printed to your terminal,
114
+ * and it does not affect the logs written to the artifacts.
115
+ *
116
+ * Use `info` by default.
117
+ * Use `error` or warn when you want to make the output as silent as possible.
118
+ * Use `debug` to control what generally is happening under the hood.
119
+ * Use `trace` when troubleshooting specific issues.
120
+ *
121
+ * @default 'info'
122
+ */
105
123
  level?: DetoxLogLevel;
106
124
  /**
107
- * @default 'sandbox'
125
+ * When enabled, hijacks all the console methods (console.log, console.warn, etc)
126
+ * so that the messages printed via them are formatted and saved as Detox logs.
127
+ *
128
+ * @default true
108
129
  */
109
- overrideConsole?: 'all' | 'sandbox' | 'none';
110
- options?: BunyanDebugStreamOptions;
130
+ overrideConsole?: boolean;
131
+ /**
132
+ * Since Detox is using
133
+ * {@link https://www.npmjs.com/package/bunyan-debug-stream bunyan-debug-stream}
134
+ * for printing logs, all its options are exposed for sake of simplicity
135
+ * of customization.
136
+ *
137
+ * The only exception is {@link BunyanDebugStreamOptions#out} option,
138
+ * which is always set to `process.stdout`.
139
+ *
140
+ * You can also pass a callback function to override the logger config
141
+ * programmatically, e.g. depending on the selected log level.
142
+ *
143
+ * @see {@link BunyanDebugStreamOptions}
144
+ */
145
+ options?: _DetoxLoggerOptions | ((config: Partial<DetoxLoggerConfig>) => _DetoxLoggerOptions);
111
146
  }
112
147
 
113
148
  interface DetoxSessionConfig {
@@ -132,32 +167,110 @@ declare global {
132
167
  */
133
168
  [prop: string]: unknown;
134
169
  };
170
+
135
171
  /**
136
- * Configuration of custom integration features
137
- * between Detox and Jest
172
+ * This is an add-on section used by our Jest integration code (but not Detox core itself).
173
+ * In other words, if you’re implementing (or using) a custom integration with some other test runner, feel free to define a section for yourself (e.g. `testRunner.mocha`)
138
174
  */
139
175
  jest?: {
140
176
  /**
141
- * Device init timeout
177
+ * Environment setup timeout
178
+ *
179
+ * As a part of the environment setup, Detox boots the device and installs the apps.
180
+ * If that takes longer than the specified value, the entire test suite will be considered as failed, e.g.:
181
+ * ```plain text
182
+ * FAIL e2e/starter.test.js
183
+ * ● Test suite failed to run
184
+ *
185
+ * Exceeded timeout of 300000ms while setting up Detox environment
186
+ * ```
187
+ *
188
+ * The default value is 5 minutes.
189
+ *
190
+ * @default 300000
191
+ * @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
192
+ */
193
+ setupTimeout?: number | undefined;
194
+ /**
195
+ * Environemnt teardown timeout
196
+ *
197
+ * If the environment teardown takes longer than the specified value, Detox will throw a timeout error.
198
+ * The default value is half a minute.
199
+ *
200
+ * @default 30000 (30 seconds)
201
+ * @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
142
202
  */
143
- initTimeout?: number | undefined;
203
+ teardownTimeout?: number | undefined;
144
204
  /**
145
- * Insist on CLI-based retry mechanism even when the failed tests have been handled
146
- * by jest.retryTimes(n) mechanism from Jest Circus.
205
+ * Jest provides an API to re-run individual failed tests: `jest.retryTimes(count)`.
206
+ * When Detox detects the use of this API, it suppresses its own CLI retry mechanism controlled via `detox test … --retries <N>` or {@link DetoxTestRunnerConfig#retries}.
207
+ * The motivation is simple – activating the both mechanisms is apt to increase your test duration dramatically, if your tests are flaky.
208
+ * If you wish nevertheless to use both the mechanisms simultaneously, set it to `true`.
209
+ *
210
+ * @default false
211
+ * @see {@link https://jestjs.io/docs/29.0/jest-object#jestretrytimesnumretries-options}
147
212
  */
148
213
  retryAfterCircusRetries?: boolean;
214
+ /**
215
+ * By default, Jest prints the test names and their status (_passed_ or _failed_) at the very end of the test session.
216
+ * When enabled, it makes Detox to print messages like these each time the new test starts and ends:
217
+ * ```plain text
218
+ * 18:03:36.258 detox[40125] i Sanity: should have welcome screen
219
+ * 18:03:37.495 detox[40125] i Sanity: should have welcome screen [OK]
220
+ * 18:03:37.496 detox[40125] i Sanity: should show hello screen after tap
221
+ * 18:03:38.928 detox[40125] i Sanity: should show hello screen after tap [OK]
222
+ * 18:03:38.929 detox[40125] i Sanity: should show world screen after tap
223
+ * 18:03:40.351 detox[40125] i Sanity: should show world screen after tap [OK]
224
+ * ```
225
+ * By default, it is enabled automatically in test sessions with a single worker.
226
+ * And vice versa, if multiple tests are executed concurrently, Detox turns it off to avoid confusion in the log.
227
+ * Use boolean values, `true` or `false`, to turn off the automatic choice.
228
+ *
229
+ * @default undefined
230
+ */
149
231
  reportSpecs?: boolean | undefined;
232
+ /**
233
+ * In the environment setup phase, Detox boots the device and installs the apps.
234
+ * This flag tells Detox to print messages like these every time the device gets assigned to a specific suite:
235
+ *
236
+ * ```plain text
237
+ * 18:03:29.869 detox[40125] i starter.test.js is assigned to 4EC84833-C7EA-4CA3-A6E9-5C30A29EA596 (iPhone 12 Pro Max)
238
+ * ```
239
+ *
240
+ * @default true
241
+ */
150
242
  reportWorkerAssign?: boolean | undefined;
151
243
  };
152
244
  /**
153
245
  * Retries count. Zero means a single attempt to run tests.
154
246
  */
155
247
  retries?: number;
248
+ /**
249
+ * When true, tells Detox CLI to cancel next retrying if it gets
250
+ * at least one report about a permanent test suite failure.
251
+ * Has no effect, if {@link DetoxTestRunnerConfig#retries} is
252
+ * undefined or set to zero.
253
+ *
254
+ * @default false
255
+ * @see {DetoxInternals.DetoxTestFileReport#isPermanentFailure}
256
+ */
257
+ bail?: boolean;
156
258
  /**
157
259
  * Custom handler to process --inspect-brk CLI flag.
158
- * Use it when you rely on another test runner than Jest.
260
+ * Use it when you rely on another test runner than Jest to mutate the config.
261
+ */
262
+ inspectBrk?: (config: DetoxTestRunnerConfig) => void;
263
+ /**
264
+ * Forward environment variables to the spawned test runner
265
+ * accordingly to the given CLI argument overrides.
266
+ *
267
+ * If false, Detox CLI will be only printing a hint message on
268
+ * how to start the test runner using environment variables,
269
+ * in case when a user wants to avoid using Detox CLI.
270
+ *
271
+ * @default false
159
272
  */
160
- inspectBrk?: boolean | ((config: DetoxTestRunnerConfig) => void);
273
+ forwardEnv?: boolean;
161
274
  }
162
275
 
163
276
  type DetoxAppConfig = (DetoxBuiltInAppConfig | DetoxCustomAppConfig) & {
@@ -228,6 +341,13 @@ declare global {
228
341
  build?: string;
229
342
  testBinaryPath?: string;
230
343
  launchArgs?: Record<string, any>;
344
+ /**
345
+ * TCP ports to `adb reverse` upon the installation.
346
+ * E.g. 8081 - to be able to access React Native packager in Debug mode.
347
+ *
348
+ * @example [8081]
349
+ */
350
+ reversePorts?: number[];
231
351
  }
232
352
 
233
353
  interface DetoxCustomAppConfig {
@@ -288,8 +408,6 @@ declare global {
288
408
  os: string;
289
409
  }
290
410
 
291
- type DetoxKnownDeviceType = DetoxBuiltInDeviceConfig['type'];
292
-
293
411
  type DetoxConfiguration = DetoxConfigurationCommon & (
294
412
  | DetoxConfigurationSingleApp
295
413
  | DetoxConfigurationMultiApps
@@ -309,7 +427,7 @@ declare global {
309
427
 
310
428
  type DetoxAliasedApp = string | DetoxAppConfig;
311
429
 
312
- // endregion DetoxConfig
430
+ //#endregion
313
431
 
314
432
  interface DetoxExportWrapper {
315
433
  readonly device: Device;
@@ -344,64 +462,81 @@ declare global {
344
462
  readonly log: Logger;
345
463
 
346
464
  /**
465
+ * @deprecated
466
+ *
467
+ * Deprecated - use {@link Detox.Logger#trace}
347
468
  * Detox tracer instance. Can be used for building timelines in Google Event Tracing format.
348
469
  */
349
- readonly trace: Tracer;
470
+ readonly trace: {
471
+ /** @deprecated */
472
+ readonly startSection: (name: string) => void;
473
+ /** @deprecated */
474
+ readonly endSection: (name: string) => void;
475
+ };
350
476
 
351
477
  /**
478
+ * Trace a single call, with a given name and arguments.
479
+ *
352
480
  * @deprecated
481
+ * @param sectionName The name of the section to trace.
482
+ * @param promiseOrFunction Promise or a function that provides a promise.
483
+ * @param args Optional arguments to pass to the trace.
484
+ * @returns The returned value of the traced call.
485
+ * @see https://wix.github.io/Detox/docs/19.x/api/detox-object-api/#detoxtracecall
353
486
  */
354
- readonly traceCall: _TraceCallSignature;
487
+ readonly traceCall: <T>(event: string, action: () => Promise<T>, args?: Record<string, unknown>) => Promise<T>;
355
488
  }
356
489
 
357
- /** @internal */
358
- type _TraceEventArgs = Record<string, unknown>;
490
+ interface Logger {
491
+ readonly level: DetoxLogLevel;
359
492
 
360
- type TraceEvent = {
361
- name?: string;
362
- cat?: string;
363
- cname?: string;
364
- id?: number;
365
- args?: _TraceEventArgs;
366
- };
493
+ readonly fatal: _LogMethod;
494
+ readonly error: _LogMethod;
495
+ readonly warn: _LogMethod;
496
+ readonly info: _LogMethod;
497
+ readonly debug: _LogMethod;
498
+ readonly trace: _LogMethod;
367
499
 
368
- /**
369
- * Trace a duration event before and after executing the action function
370
- *
371
- * @internal
372
- */
373
- interface _TraceCallSignature {
374
- <T>(event: string | TraceEvent, action: () => T): T;
375
- <T>(event: string | TraceEvent, action: () => Promise<T>): Promise<T>;
500
+ child(context?: Partial<LogEvent>): Logger;
376
501
  }
377
502
 
378
503
  /** @internal */
379
- interface _TraceSectionSignature<T> {
380
- (event?: string, args?: _TraceEventArgs): T;
381
- (event: TraceEvent): T;
504
+ interface _LogMethod extends _LogMethodSignature {
505
+ readonly begin: _LogMethodSignature;
506
+ readonly complete: _CompleteMethodSignature;
507
+ readonly end: _LogMethodSignature;
382
508
  }
383
509
 
384
- interface Tracer extends _TraceCallSignature {
385
- readonly begin: _TraceSectionSignature<EndHandle<{ cname: string; args: _TraceEventArgs; }>>;
386
- readonly end: _TraceSectionSignature<void>;
510
+ /** @internal */
511
+ interface _LogMethodSignature {
512
+ (...args: unknown[]): void
513
+ (event: LogEvent, ...args: unknown[]): void;
514
+ }
387
515
 
388
- /** @deprecated */
389
- readonly startSection: _TraceSectionSignature<void>;
390
- /** @deprecated */
391
- readonly endSection: _TraceSectionSignature<void>;
516
+ /** @internal */
517
+ interface _CompleteMethodSignature {
518
+ <T>(message: string, action: T | (() => T)): T;
519
+ <T>(event: LogEvent, message: string, action: T | (() => T)): T;
392
520
  }
393
521
 
394
- type Logger = {
395
- readonly level: DetoxLogLevel;
522
+ type LogEvent = {
523
+ /** Use when there's a risk of logging several parallel duration events. */
524
+ id?: string | number;
525
+ /** Optional. Event categories (tags) to facilitate filtering. */
526
+ cat?: string | string[];
527
+ /** Optional. Color name (applicable in Google Chrome Trace Format) */
528
+ cname?: string;
396
529
 
397
- fatal(context?: unknown, ...args: any[]): void;
398
- error(context?: unknown, ...args: any[]): void;
399
- warn(context?: unknown, ...args: any[]): void;
400
- info(context?: unknown, ...args: any[]): void;
401
- debug(context?: unknown, ...args: any[]): void;
402
- trace(context?: unknown, ...args: any[]): void;
530
+ /** Reserved property. Process ID. */
531
+ pid?: never;
532
+ /** Reserved property. Thread ID. */
533
+ tid?: never;
534
+ /** Reserved property. Timestamp. */
535
+ ts?: never;
536
+ /** Reserved property. Event phase. */
537
+ ph?: never;
403
538
 
404
- child(context?: Record<string, unknown>): Logger;
539
+ [customProperty: string]: unknown;
405
540
  };
406
541
 
407
542
  type DetoxLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
@@ -544,10 +679,11 @@ declare global {
544
679
  * Relaunch the app. Convenience method that calls {@link Device#launchApp}
545
680
  * with { newInstance: true } override.
546
681
  *
682
+ * @deprecated
547
683
  * @param config
548
684
  * @see Device#launchApp
549
685
  */
550
- relaunchApp(config?: Omit<DeviceLaunchAppConfig, 'newInstance'>): Promise<void>;
686
+ relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
551
687
 
552
688
  /**
553
689
  * Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and