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.
- 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
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-javadoc.jar.sha512 +1 -0
- 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
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.aar.sha512 +1 -0
- 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
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.2/detox-20.0.2.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/README.md +1 -1
- package/android/build.gradle +12 -7
- package/android/detox/build.gradle +13 -9
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publishing.gradle +27 -27
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +19 -13
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/index.d.ts +195 -59
- package/internals.d.ts +216 -49
- package/local-cli/build.js +2 -2
- package/local-cli/build.test.js +14 -14
- package/local-cli/cli.js +11 -6
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/test.test.js +143 -62
- package/local-cli/testCommand/TestRunnerCommand.js +97 -77
- package/local-cli/testCommand/TestRunnerError.js +17 -0
- package/local-cli/testCommand/TestRunnerError.test.js +25 -0
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +23 -17
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporters/DetoxReporter.js +33 -2
- package/runners/jest/testEnvironment/index.js +119 -69
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +94 -47
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +14 -16
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +2 -6
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +105 -62
- package/src/android/core/NativeElement.js +56 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/interactions/native.js +25 -18
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +49 -8
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +19 -2
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeAppsConfig.js +4 -0
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +19 -10
- package/src/configuration/composeRunnerConfig.js +61 -9
- package/src/configuration/index.js +14 -9
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +29 -3
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +19 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +10 -2
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +17 -2
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +153 -67
- package/src/ipc/IPCClient.js +12 -13
- package/src/ipc/IPCServer.js +28 -24
- package/src/ipc/{state.js → SessionState.js} +26 -53
- package/src/logger/DetoxLogger.js +287 -154
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +115 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
- package/src/logger/utils/DetoxLogFinalizer.js +162 -0
- package/src/logger/utils/MessageStack.js +35 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +127 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +79 -65
- package/src/realms/DetoxInternalsFacade.js +8 -12
- package/src/realms/DetoxPrimaryContext.js +111 -72
- package/src/realms/DetoxSecondaryContext.js +29 -32
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +6 -6
- package/src/server/DetoxSessionManager.js +1 -1
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/symbols.js +16 -22
- package/src/utils/Timer.js +55 -38
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +43 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/utils/ChromeTracingExporter.js +0 -54
- package/src/utils/streamUtils.js +0 -214
- 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
|
-
|
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
|
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
|
-
*
|
91
|
-
*
|
92
|
-
*
|
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
|
-
*
|
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?:
|
110
|
-
|
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
|
-
*
|
137
|
-
*
|
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
|
-
*
|
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
|
-
|
203
|
+
teardownTimeout?: number | undefined;
|
144
204
|
/**
|
145
|
-
*
|
146
|
-
*
|
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
|
-
|
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
|
-
|
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:
|
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:
|
487
|
+
readonly traceCall: <T>(event: string, action: () => Promise<T>, args?: Record<string, unknown>) => Promise<T>;
|
355
488
|
}
|
356
489
|
|
357
|
-
|
358
|
-
|
490
|
+
interface Logger {
|
491
|
+
readonly level: DetoxLogLevel;
|
359
492
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
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
|
380
|
-
|
381
|
-
|
504
|
+
interface _LogMethod extends _LogMethodSignature {
|
505
|
+
readonly begin: _LogMethodSignature;
|
506
|
+
readonly complete: _CompleteMethodSignature;
|
507
|
+
readonly end: _LogMethodSignature;
|
382
508
|
}
|
383
509
|
|
384
|
-
|
385
|
-
|
386
|
-
|
510
|
+
/** @internal */
|
511
|
+
interface _LogMethodSignature {
|
512
|
+
(...args: unknown[]): void
|
513
|
+
(event: LogEvent, ...args: unknown[]): void;
|
514
|
+
}
|
387
515
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
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
|
395
|
-
|
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
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
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
|
-
|
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?:
|
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
|