detox 20.0.3-breaking.new-global-lifecycle.0 → 20.0.6-breaking.new-global-lifecycle.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.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.aar} +0 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.md5 → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.aar.md5} +0 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha1 → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.aar.sha1} +0 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha256 → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.aar.sha256} +0 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha512 → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.aar.sha512} +0 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom → 20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.6-breaking.new-global-lifecycle.0/detox-20.0.6-breaking.new-global-lifecycle.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/index.d.ts +49 -40
- package/internals.d.ts +63 -15
- package/local-cli/cli.js +1 -1
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/test.js +3 -2
- package/local-cli/test.test.js +1 -1
- package/local-cli/testCommand/TestRunnerCommand.js +10 -7
- package/package.json +5 -4
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/testEnvironment/index.js +33 -16
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +76 -41
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +1 -1
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -1
- package/src/DetoxWorker.js +4 -1
- package/src/artifacts/ArtifactsManager.js +8 -23
- 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/utils/temporaryPath.js +18 -7
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +1 -1
- package/src/configuration/collectCliConfig.js +1 -1
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +17 -8
- package/src/configuration/composeRunnerConfig.js +1 -1
- package/src/configuration/index.js +5 -1
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +3 -2
- 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/ios/tools/AppleSimUtils.js +1 -1
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +9 -13
- package/src/devices/runtime/RuntimeDevice.js +7 -8
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +1 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
- package/src/ipc/IPCClient.js +3 -8
- package/src/ipc/IPCServer.js +11 -11
- package/src/ipc/{state.js → SessionState.js} +23 -50
- package/src/logger/DetoxLogger.js +264 -155
- package/src/logger/index.js +4 -0
- package/src/logger/utils/BunyanLogger.js +72 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +58 -0
- package/src/logger/utils/MessageStack.js +24 -0
- package/src/logger/{TraceThreadDispatcher.js → utils/ThreadDispatcher.js} +34 -5
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +4 -4
- package/src/logger/utils/sanitizeBunyanContext.js +28 -0
- package/src/logger/utils/tracerLegacy.js +25 -0
- package/src/realms/DetoxContext.js +65 -57
- package/src/realms/DetoxInternalsFacade.js +7 -5
- package/src/realms/DetoxPrimaryContext.js +125 -40
- package/src/realms/DetoxSecondaryContext.js +31 -30
- 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 +12 -8
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/streamUtils.js +10 -11
- package/src/utils/trace.js +2 -18
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/utils/ChromeTracingExporter.js +0 -54
@@ -0,0 +1 @@
|
|
1
|
+
91686ed0f19733f7c115a7139ed4186b
|
@@ -0,0 +1 @@
|
|
1
|
+
b1948b37f2825ae6901ecf5b0f0e77974d383e90
|
@@ -0,0 +1 @@
|
|
1
|
+
c78417c3025b0c430f0270d630bd8cc3d680cbd413481ce57f63f44f682fa734
|
@@ -0,0 +1 @@
|
|
1
|
+
2ed2683d4799f88018b813696666c11fceba5be25b261a780fba9b4f85fa52518577315762760f2c5898bb75dfd8b9f7141a4fe276f17dbf431f4db2f8972b62
|
@@ -0,0 +1 @@
|
|
1
|
+
4a1f392222691dde5ff23796ed1f9be2
|
@@ -0,0 +1 @@
|
|
1
|
+
a26bb973c995a237be6da201ee7ce88c73c1633f
|
@@ -0,0 +1 @@
|
|
1
|
+
88cf8c98c0342ba8052e6483f32c0b21c55e8b49e3e821a8ab7f4d1241f3ac95
|
@@ -0,0 +1 @@
|
|
1
|
+
086ec58c930ddd33b055906bc7baeab54bf0c61e824168e714542b3c12435765ea79207f73084cf9f865d5afd4d0d277454bad7df260d91904fc839068ba3345
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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.
|
6
|
+
<version>20.0.6-breaking.new-global-lifecycle.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
|
+
7ed72c62d3647105b8ba45872b8ea606
|
@@ -0,0 +1 @@
|
|
1
|
+
57c6d248535a325fb3b5f8ff5ae28fe452723d3c
|
@@ -0,0 +1 @@
|
|
1
|
+
33f28069a49462150368c6c44ea5644083c155771aefdd51f0e41858dc43e61d
|
@@ -0,0 +1 @@
|
|
1
|
+
6d57cb6061f616f09785d65238df8c1bb4751a95e65f1dd038b4c4b7d7b72a5d6572fc49ee4085c26a44407219a8c952e46263457fee030a17b3767654557da6
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>20.0.
|
7
|
-
<release>20.0.
|
6
|
+
<latest>20.0.6-breaking.new-global-lifecycle.0</latest>
|
7
|
+
<release>20.0.6-breaking.new-global-lifecycle.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.0.
|
9
|
+
<version>20.0.6-breaking.new-global-lifecycle.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20220905115247</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
97dde91895b9c45b58fb7cc6364a9e8d
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
11290dd2dfe8f2c159e0e12f674e42613903c592
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
077984469b0de32349680ac5d31fd15ad7f4bc9bbcb81cc9e6a1138a14c5ad57
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
15ce6f12a05807a757acb5ae887aac0ffac8cc2738327275ada27b3b4849662a832fce5203d3a5aca7223b49b438176e990204726878456f5cb9dadb0f1a38d9
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
package/index.d.ts
CHANGED
@@ -9,7 +9,6 @@
|
|
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 {
|
15
14
|
const device: Detox.DetoxExportWrapper['device'];
|
@@ -107,7 +106,7 @@ declare global {
|
|
107
106
|
* @default 'sandbox'
|
108
107
|
*/
|
109
108
|
overrideConsole?: 'all' | 'sandbox' | 'none';
|
110
|
-
options?: BunyanDebugStreamOptions;
|
109
|
+
options?: BunyanDebugStreamOptions | ((config: Partial<DetoxLoggerConfig>) => BunyanDebugStreamOptions);
|
111
110
|
}
|
112
111
|
|
113
112
|
interface DetoxSessionConfig {
|
@@ -344,64 +343,74 @@ declare global {
|
|
344
343
|
readonly log: Logger;
|
345
344
|
|
346
345
|
/**
|
346
|
+
* @deprecated
|
347
|
+
*
|
348
|
+
* Deprecated - use {@link Detox.Logger#trace}
|
347
349
|
* Detox tracer instance. Can be used for building timelines in Google Event Tracing format.
|
348
350
|
*/
|
349
|
-
readonly trace:
|
351
|
+
readonly trace: {
|
352
|
+
/** @deprecated */
|
353
|
+
readonly startSection: (name: string) => void;
|
354
|
+
/** @deprecated */
|
355
|
+
readonly endSection: (name: string) => void;
|
356
|
+
};
|
350
357
|
|
351
358
|
/**
|
352
359
|
* @deprecated
|
353
360
|
*/
|
354
|
-
readonly traceCall:
|
361
|
+
readonly traceCall: <T>(event: string, action: () => Promise<T>) => Promise<T>;
|
355
362
|
}
|
356
363
|
|
357
|
-
|
358
|
-
|
364
|
+
interface Logger {
|
365
|
+
readonly level: DetoxLogLevel;
|
359
366
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
};
|
367
|
+
readonly fatal: _LogMethod;
|
368
|
+
readonly error: _LogMethod;
|
369
|
+
readonly warn: _LogMethod;
|
370
|
+
readonly info: _LogMethod;
|
371
|
+
readonly debug: _LogMethod;
|
372
|
+
readonly trace: _LogMethod;
|
367
373
|
|
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>;
|
374
|
+
child(context?: Partial<LogEvent>): Logger;
|
376
375
|
}
|
377
376
|
|
378
377
|
/** @internal */
|
379
|
-
interface
|
380
|
-
|
381
|
-
|
378
|
+
interface _LogMethod extends _LogMethodSignature {
|
379
|
+
readonly begin: _LogMethodSignature;
|
380
|
+
readonly complete: _CompleteMethodSignature;
|
381
|
+
readonly end: _LogMethodSignature;
|
382
382
|
}
|
383
383
|
|
384
|
-
|
385
|
-
|
386
|
-
|
384
|
+
/** @internal */
|
385
|
+
interface _LogMethodSignature {
|
386
|
+
(...args: unknown[]): void
|
387
|
+
(event: LogEvent, ...args: unknown[]): void;
|
388
|
+
}
|
387
389
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
390
|
+
/** @internal */
|
391
|
+
interface _CompleteMethodSignature {
|
392
|
+
<T>(message: string, action: T | (() => T)): T;
|
393
|
+
<T>(event: LogEvent, message: string, action: T | (() => T)): T;
|
392
394
|
}
|
393
395
|
|
394
|
-
type
|
395
|
-
|
396
|
+
type LogEvent = {
|
397
|
+
/** Use when there's a risk of logging several parallel duration events. */
|
398
|
+
id?: string | number;
|
399
|
+
/** Optional. Event categories (tags) to facilitate filtering. */
|
400
|
+
cat?: string | string[];
|
401
|
+
/** Optional. Color name (applicable in Google Chrome Trace Format) */
|
402
|
+
cname?: string;
|
396
403
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
404
|
+
/** Reserved property. Process ID. */
|
405
|
+
pid?: never;
|
406
|
+
/** Reserved property. Thread ID. */
|
407
|
+
tid?: never;
|
408
|
+
/** Reserved property. Timestamp. */
|
409
|
+
ts?: never;
|
410
|
+
/** Reserved property. Event phase. */
|
411
|
+
ph?: never;
|
403
412
|
|
404
|
-
|
413
|
+
[customProperty: string]: unknown;
|
405
414
|
};
|
406
415
|
|
407
416
|
type DetoxLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
package/internals.d.ts
CHANGED
@@ -3,33 +3,40 @@
|
|
3
3
|
|
4
4
|
declare global {
|
5
5
|
namespace DetoxInternals {
|
6
|
+
type DetoxStatus = 'inactive' | 'init' | 'active' | 'cleanup';
|
7
|
+
|
6
8
|
type Facade = {
|
7
9
|
// region Initialization
|
8
10
|
/**
|
9
|
-
* Use with a caution, when you still have no config, yet need to avoid {@link Facade#
|
11
|
+
* Use with a caution, when you still have no config, yet need to avoid {@link Facade#init}
|
10
12
|
*/
|
11
|
-
resolveConfig(options?: Partial<
|
13
|
+
resolveConfig(options?: Partial<DetoxInitOptions>): Promise<RuntimeConfig>;
|
14
|
+
|
15
|
+
/**
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
getStatus(): DetoxStatus;
|
12
19
|
|
13
20
|
/**
|
14
21
|
* This is the phase where Detox reads its configuration, starts a server.
|
15
22
|
*/
|
16
|
-
|
23
|
+
init(options?: Partial<DetoxInitOptions>): Promise<void>;
|
17
24
|
|
18
25
|
/**
|
19
|
-
* This is the phase where Detox loads its
|
26
|
+
* This is the phase where Detox loads its expectation library and starts a device.
|
20
27
|
*/
|
21
|
-
|
28
|
+
installWorker(options?: Partial<DetoxInstallWorkerOptions>): Promise<void>;
|
22
29
|
|
23
30
|
/**
|
24
|
-
*
|
31
|
+
* Deallocates the device.
|
25
32
|
*/
|
26
|
-
|
33
|
+
uninstallWorker(): Promise<void>;
|
27
34
|
|
28
35
|
/**
|
29
36
|
* The global cleanup phase should happen after all the tests have finished.
|
30
37
|
* This is the phase where the Detox server shuts down.
|
31
38
|
*/
|
32
|
-
|
39
|
+
cleanup(): Promise<void>;
|
33
40
|
// endregion
|
34
41
|
|
35
42
|
// region Lifecycle
|
@@ -59,28 +66,69 @@ declare global {
|
|
59
66
|
|
60
67
|
readonly config: RuntimeConfig;
|
61
68
|
readonly log: Detox.Logger;
|
62
|
-
readonly trace: Detox.Tracer;
|
63
69
|
readonly session: SessionState;
|
64
70
|
|
65
|
-
readonly worker:
|
71
|
+
readonly worker: Worker;
|
72
|
+
}
|
73
|
+
|
74
|
+
interface Worker extends Detox.DetoxExportWrapper {
|
75
|
+
readonly id: string;
|
66
76
|
}
|
67
77
|
|
68
|
-
type
|
78
|
+
type DetoxInitOptions = {
|
69
79
|
cwd: string;
|
70
80
|
argv: Record<string, unknown>;
|
71
81
|
testRunnerArgv: Record<string, unknown>;
|
72
82
|
override: Partial<Detox.DetoxConfig>;
|
83
|
+
/** @inheritDoc */
|
84
|
+
global: NodeJS.Global;
|
85
|
+
/**
|
86
|
+
* Worker ID. Used to distinguish allocated workers in parallel test execution environment.
|
87
|
+
*
|
88
|
+
* If explicitly set to null, tells {@link Facade#init} to skip {@link Facade#installWorker} call.
|
89
|
+
* Useful for complex test runner integrations, where you have to install the worker via a separate call,
|
90
|
+
* when the environment is ready for that.
|
91
|
+
*
|
92
|
+
* @default 'worker'
|
93
|
+
*/
|
94
|
+
workerId: string | null;
|
73
95
|
};
|
74
96
|
|
75
|
-
type
|
97
|
+
type DetoxInstallWorkerOptions = {
|
98
|
+
/**
|
99
|
+
* Used for integration with sandboxed test environments.
|
100
|
+
* {@link DetoxInternals.Facade#setup} might override {@link Console} methods
|
101
|
+
* to integrate it with Detox loggeing subsystem.
|
102
|
+
*/
|
76
103
|
global: NodeJS.Global;
|
77
|
-
|
104
|
+
/**
|
105
|
+
* Worker ID. Used to distinguish allocated workers in parallel test execution environment.
|
106
|
+
*
|
107
|
+
* @default 'worker'
|
108
|
+
*/
|
109
|
+
workerId: string;
|
78
110
|
};
|
79
111
|
|
80
112
|
type SessionState = Readonly<{
|
113
|
+
/**
|
114
|
+
* Randomly generated ID for the entire Detox test session, including retries.
|
115
|
+
*/
|
116
|
+
id: string;
|
117
|
+
/**
|
118
|
+
* Permanently failed test file paths.
|
119
|
+
*/
|
81
120
|
failedTestFiles: string[];
|
121
|
+
/**
|
122
|
+
* Failed test file paths suggested to retry via Detox CLI mechanism.
|
123
|
+
*/
|
82
124
|
testFilesToRetry: string[];
|
125
|
+
/**
|
126
|
+
* Retry index of the test session: 0..retriesCount.
|
127
|
+
*/
|
83
128
|
testSessionIndex: number;
|
129
|
+
/**
|
130
|
+
* TODO
|
131
|
+
*/
|
84
132
|
workersCount: number;
|
85
133
|
}>;
|
86
134
|
|
@@ -95,14 +143,14 @@ declare global {
|
|
95
143
|
apps: Record<string, Readonly<Detox.DetoxAppConfig>>;
|
96
144
|
artifacts: Readonly<Detox.DetoxArtifactsConfig>;
|
97
145
|
behavior: Readonly<Detox.DetoxBehaviorConfig>;
|
98
|
-
cli: Readonly<
|
146
|
+
cli: Readonly<CLIConfig>;
|
99
147
|
device: Readonly<Detox.DetoxDeviceConfig>;
|
100
148
|
logger: Readonly<Detox.DetoxLoggerConfig>;
|
101
149
|
testRunner: Readonly<Detox.DetoxTestRunnerConfig>;
|
102
150
|
session: Readonly<Detox.DetoxSessionConfig>;
|
103
151
|
}>;
|
104
152
|
|
105
|
-
type
|
153
|
+
type CLIConfig = Readonly<Partial<{
|
106
154
|
appLaunchArgs: string;
|
107
155
|
artifactsLocation: string;
|
108
156
|
captureViewHierarchy: string;
|
package/local-cli/cli.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
const yargs = require('yargs');
|
3
3
|
|
4
4
|
const DetoxError = require('../src/errors/DetoxError');
|
5
|
-
const logger = require('../src/utils/logger').child({
|
5
|
+
const logger = require('../src/utils/logger').child({ cat: 'cli' });
|
6
6
|
|
7
7
|
yargs
|
8
8
|
.scriptName('detox')
|
@@ -4,7 +4,7 @@ const path = require('path');
|
|
4
4
|
|
5
5
|
const fs = require('fs-extra');
|
6
6
|
|
7
|
-
const log = require('../src/utils/logger').child({
|
7
|
+
const log = require('../src/utils/logger').child({ cat: 'cli' });
|
8
8
|
|
9
9
|
module.exports.command = 'rebuild-framework-cache';
|
10
10
|
module.exports.desc = 'Rebuilds a cached Detox framework for the current environment in ~/Library/Detox. The cached framework is unique for each combination of Xcode and Detox version. (macOS only)';
|
package/local-cli/test.js
CHANGED
@@ -9,9 +9,10 @@ module.exports.middlewares = require('./testCommand/middlewares').default;
|
|
9
9
|
|
10
10
|
module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
|
11
11
|
try {
|
12
|
-
await detox.
|
12
|
+
await detox.init({
|
13
13
|
argv: detoxArgs,
|
14
14
|
testRunnerArgv: runnerArgs,
|
15
|
+
workerId: null,
|
15
16
|
});
|
16
17
|
|
17
18
|
const runnerCommand = new TestRunnerCommand()
|
@@ -21,6 +22,6 @@ module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
|
|
21
22
|
|
22
23
|
await runnerCommand.execute();
|
23
24
|
} finally {
|
24
|
-
await detox.
|
25
|
+
await detox.cleanup();
|
25
26
|
}
|
26
27
|
};
|
package/local-cli/test.test.js
CHANGED
@@ -504,7 +504,7 @@ describe('CLI', () => {
|
|
504
504
|
return {
|
505
505
|
...mockCall,
|
506
506
|
fullCommand: _.chain(logger().log.mock.calls)
|
507
|
-
.filter(([_level, _childMeta, meta]) => meta && meta.
|
507
|
+
.filter(([_level, _childMeta, meta]) => meta && meta.env)
|
508
508
|
.get(index)
|
509
509
|
.get(3)
|
510
510
|
.value(),
|
@@ -5,6 +5,7 @@ const parser = require('yargs-parser');
|
|
5
5
|
const unparse = require('yargs-unparser');
|
6
6
|
|
7
7
|
const detox = require('../../internals');
|
8
|
+
const log = detox.log.child({ cat: ['lifecycle', 'cli'] });
|
8
9
|
const { DetoxRuntimeError } = require('../../src/errors');
|
9
10
|
const { printEnvironmentVariables, prependNodeModulesBinToPATH } = require('../../src/utils/envUtils');
|
10
11
|
const { escapeSpaces } = require('../../src/utils/shellUtils');
|
@@ -45,7 +46,7 @@ class TestRunnerCommand {
|
|
45
46
|
}
|
46
47
|
|
47
48
|
/**
|
48
|
-
* @param {Partial<Readonly<DetoxInternals.
|
49
|
+
* @param {Partial<Readonly<DetoxInternals.CLIConfig>>} cliConfig
|
49
50
|
* @returns {this}
|
50
51
|
*/
|
51
52
|
replicateCLIConfig(cliConfig) {
|
@@ -88,7 +89,7 @@ class TestRunnerCommand {
|
|
88
89
|
try {
|
89
90
|
if (launchError) {
|
90
91
|
const list = this._argv._.map((file, index) => ` ${index + 1}. ${file}`).join('\n');
|
91
|
-
|
92
|
+
log.error(
|
92
93
|
`There were failing tests in the following files:\n${list}\n\n` +
|
93
94
|
'Detox CLI is going to restart the test runner with those files...\n'
|
94
95
|
);
|
@@ -104,11 +105,13 @@ class TestRunnerCommand {
|
|
104
105
|
throw e;
|
105
106
|
}
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
if (--runsLeft > 0) {
|
109
|
+
this._argv._ = testFilesToRetry.splice(0, Infinity);
|
110
|
+
// @ts-ignore
|
111
|
+
detox.session.testSessionIndex++; // it is always a primary context, so we can update it
|
112
|
+
}
|
110
113
|
}
|
111
|
-
} while (launchError &&
|
114
|
+
} while (launchError && runsLeft > 0);
|
112
115
|
|
113
116
|
if (launchError) {
|
114
117
|
throw launchError;
|
@@ -119,7 +122,7 @@ class TestRunnerCommand {
|
|
119
122
|
const fullCommand = this._buildSpawnArguments().map(escapeSpaces);
|
120
123
|
const fullCommandWithHint = printEnvironmentVariables(this._envHint) + fullCommand.join(' ');
|
121
124
|
|
122
|
-
|
125
|
+
log.info({ env: this._envHint }, fullCommandWithHint);
|
123
126
|
|
124
127
|
return new Promise((resolve, reject) => {
|
125
128
|
cp.spawn(fullCommand[0], fullCommand.slice(1), {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "detox",
|
3
3
|
"description": "E2E tests and automation for mobile",
|
4
|
-
"version": "20.0.
|
4
|
+
"version": "20.0.6-breaking.new-global-lifecycle.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -57,13 +57,14 @@
|
|
57
57
|
"dependencies": {
|
58
58
|
"ajv": "^8.6.3",
|
59
59
|
"bunyan": "^1.8.12",
|
60
|
-
"bunyan-debug-stream": "^3.0
|
60
|
+
"bunyan-debug-stream": "^3.1.0",
|
61
61
|
"chalk": "^2.4.2",
|
62
62
|
"child-process-promise": "^2.2.0",
|
63
63
|
"duplexify": "^4.1.2",
|
64
64
|
"find-up": "^4.1.0",
|
65
65
|
"fs-extra": "^4.0.2",
|
66
66
|
"funpermaproxy": "^1.0.1",
|
67
|
+
"glob": "^8.0.3",
|
67
68
|
"ini": "^1.3.4",
|
68
69
|
"json-cycle": "^1.3.0",
|
69
70
|
"lodash": "^4.17.5",
|
@@ -83,7 +84,7 @@
|
|
83
84
|
"tail": "^2.0.0",
|
84
85
|
"telnet-client": "1.2.8",
|
85
86
|
"tempfile": "^2.0.0",
|
86
|
-
"trace-event-lib": "^1.1
|
87
|
+
"trace-event-lib": "^1.3.1",
|
87
88
|
"which": "^1.3.1",
|
88
89
|
"ws": "^7.0.0",
|
89
90
|
"yargs": "^16.0.3",
|
@@ -183,5 +184,5 @@
|
|
183
184
|
}
|
184
185
|
}
|
185
186
|
},
|
186
|
-
"gitHead": "
|
187
|
+
"gitHead": "29baf7cab1ff919fd57d11f5e41664e741777f76"
|
187
188
|
}
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = async () => require('../../internals').
|
1
|
+
module.exports = async () => require('../../internals').init({ workerId: null });
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = async () => require('../../internals').
|
1
|
+
module.exports = async () => require('../../internals').cleanup();
|
@@ -3,7 +3,6 @@ const maybeNodeEnvironment = require('jest-environment-node'); // eslint-disable
|
|
3
3
|
const NodeEnvironment = maybeNodeEnvironment.default || maybeNodeEnvironment;
|
4
4
|
|
5
5
|
const detox = require('../../../internals');
|
6
|
-
const { DetoxError } = require('../../../src/errors');
|
7
6
|
const Timer = require('../../../src/utils/Timer');
|
8
7
|
|
9
8
|
const {
|
@@ -24,6 +23,8 @@ const SYNC_CIRCUS_EVENTS = new Set([
|
|
24
23
|
'error',
|
25
24
|
]);
|
26
25
|
|
26
|
+
const log = detox.log.child({ cat: 'lifecycle,jest-environment' });
|
27
|
+
|
27
28
|
/**
|
28
29
|
* @see https://www.npmjs.com/package/jest-circus#overview
|
29
30
|
*/
|
@@ -41,18 +42,31 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
41
42
|
SpecReporter,
|
42
43
|
WorkerAssignReporter,
|
43
44
|
};
|
44
|
-
/** @
|
45
|
+
/** @private */
|
46
|
+
this._shouldManageDetox = detox.getStatus() === 'inactive';
|
47
|
+
/** @internal */
|
45
48
|
this.testPath = context.testPath;
|
46
49
|
/** @protected */
|
47
50
|
this.testEventListeners = [];
|
48
51
|
/** @protected */
|
49
52
|
this.initTimeout = detox.config.testRunner.jest.initTimeout;
|
53
|
+
/** @internal */
|
54
|
+
log.trace.begin(this.testPath);
|
55
|
+
|
56
|
+
this.setup = log.trace.complete.bind(null, 'set up environment', this.setup.bind(this));
|
57
|
+
const _teardown = this.teardown.bind(this);
|
58
|
+
this.teardown = async () => {
|
59
|
+
try {
|
60
|
+
await log.trace.complete('tear down environment', _teardown);
|
61
|
+
} finally {
|
62
|
+
await log.trace.end();
|
63
|
+
}
|
64
|
+
};
|
50
65
|
}
|
51
66
|
|
52
67
|
/** @override */
|
53
68
|
async setup() {
|
54
69
|
await super.setup();
|
55
|
-
|
56
70
|
await Timer.run({
|
57
71
|
description: `setting up Detox environment`,
|
58
72
|
timeout: this.initTimeout,
|
@@ -85,7 +99,7 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
85
99
|
try {
|
86
100
|
await this._timer.run(() => listener[name](event, state));
|
87
101
|
} catch (listenerError) {
|
88
|
-
|
102
|
+
log.error(listenerError);
|
89
103
|
break;
|
90
104
|
}
|
91
105
|
}
|
@@ -100,9 +114,7 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
100
114
|
await Timer.run({
|
101
115
|
description: `tearing down Detox environment`,
|
102
116
|
timeout: this.initTimeout,
|
103
|
-
fn: async () =>
|
104
|
-
await this.cleanupDetox();
|
105
|
-
},
|
117
|
+
fn: async () => await this.cleanupDetox(),
|
106
118
|
});
|
107
119
|
}
|
108
120
|
|
@@ -115,15 +127,25 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
115
127
|
* @protected
|
116
128
|
*/
|
117
129
|
async initDetox() {
|
118
|
-
|
130
|
+
const opts = {
|
119
131
|
global: this.global,
|
120
|
-
workerId:
|
121
|
-
}
|
132
|
+
workerId: `w${process.env.JEST_WORKER_ID}`,
|
133
|
+
};
|
134
|
+
|
135
|
+
if (this._shouldManageDetox) {
|
136
|
+
await detox.init(opts);
|
137
|
+
} else {
|
138
|
+
await detox.installWorker(opts);
|
139
|
+
}
|
122
140
|
}
|
123
141
|
|
124
142
|
/** @protected */
|
125
143
|
async cleanupDetox() {
|
126
|
-
|
144
|
+
if (this._shouldManageDetox) {
|
145
|
+
await detox.cleanup();
|
146
|
+
} else {
|
147
|
+
await detox.uninstallWorker();
|
148
|
+
}
|
127
149
|
}
|
128
150
|
|
129
151
|
/** @private */
|
@@ -145,11 +167,6 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
145
167
|
}));
|
146
168
|
}
|
147
169
|
}
|
148
|
-
|
149
|
-
/** @private */
|
150
|
-
_logError(e) {
|
151
|
-
detox.log.error(DetoxError.format(e));
|
152
|
-
}
|
153
170
|
}
|
154
171
|
|
155
172
|
module.exports = DetoxCircusEnvironment;
|