detox 20.0.2-breaking.new-global-lifecycle.0 → 20.0.5-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.2-breaking.new-global-lifecycle.0/detox-20.0.2-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-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.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0-sources.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.aar → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-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 → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.aar.md5} +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.sha1 → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.aar.sha1} +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.sha256 → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.aar.sha256} +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.sha512 → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.aar.sha512} +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.pom → 20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.5-breaking.new-global-lifecycle.0/detox-20.0.5-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 +75 -22
- package/local-cli/build.js +1 -1
- package/local-cli/build.test.js +14 -14
- package/local-cli/cli.js +1 -1
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/test.js +6 -5
- package/local-cli/test.test.js +2 -2
- package/local-cli/testCommand/TestRunnerCommand.js +4 -3
- 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 +34 -17
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +78 -43
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +2 -2
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +2 -2
- package/src/DetoxWorker.js +11 -2
- 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 +49 -2
- 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 +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/errors/DetoxConfigErrorComposer.js +4 -2
- 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 +118 -41
- 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.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.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/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/utils/ChromeTracingExporter.js +0 -54
@@ -0,0 +1 @@
|
|
1
|
+
1c28e1a121a1eb49cfae610647edf0ad
|
@@ -0,0 +1 @@
|
|
1
|
+
e7d9c6c15b4467c257ee92ae349d3465446b4a40
|
@@ -0,0 +1 @@
|
|
1
|
+
274e47fbbdbe85abdf2ebfd4c76e00ef33ad353309da375460f71f9f6fe04c2a
|
@@ -0,0 +1 @@
|
|
1
|
+
063f4a5549133b4d661a7677d68a91473877b26ed3e29ef9d7502a83c179810d68f15dd9e35399b5bab23f3c97f96ee875a80abcb07d1dfa57a6177399dcc347
|
@@ -0,0 +1 @@
|
|
1
|
+
20a7fdefedfc40238042f083ca693c54
|
@@ -0,0 +1 @@
|
|
1
|
+
471d2b163fac9e08859166f2aacec3a1609348c8
|
@@ -0,0 +1 @@
|
|
1
|
+
4a344c3b3b5597488fece53c9cc7358705e6d40116b0779122428094bd021db7
|
@@ -0,0 +1 @@
|
|
1
|
+
93443f0d56c9f84ec24523b954e6e9782652c4bd5d8c94bf558812fade6750beb49f4678dcbaef53e1948edcf5fb5e35c47efb49c7acc79cd2ffa0fea2b287bd
|
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.5-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
|
+
f947833decee666021174627c8909b4b
|
@@ -0,0 +1 @@
|
|
1
|
+
ae94fe4f6480eee73e5f4cc2617dc9b64c5602e0
|
@@ -0,0 +1 @@
|
|
1
|
+
b9ea5a9228c8248ce58fcfc5eb12983b642c2240ae61fd0929cfdafb664cc9a6
|
@@ -0,0 +1 @@
|
|
1
|
+
7d5986795398d9c6021a9d4085a4e1b2c3e794e51fb873ddfefc596d2f8b3a04a58c553fdb4202f6bd5fa4bbbf36373b318a7497a66e345b6f8f23bfee8b4145
|
@@ -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.5-breaking.new-global-lifecycle.0</latest>
|
7
|
+
<release>20.0.5-breaking.new-global-lifecycle.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.0.
|
9
|
+
<version>20.0.5-breaking.new-global-lifecycle.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20220904154935</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
90746dab45626ae5891c33be157b7921
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
81eeaefaf3b36e2c9883bcf08e42f41532e2007a
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
07a51f70f99dd28e9f3bee0eb85dbb265fc16087a96ebed98c654855c2cca88b
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
01e0caff588c876ccc96cbad6c8d317178f6fdac4a9c4468134ace9997090a7862a80df9de8634c6d1db0c9e956b91af5828760fd928eda3e725c101017ac794
|
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}
|
12
|
+
*/
|
13
|
+
resolveConfig(options?: Partial<DetoxInitOptions>): Promise<RuntimeConfig>;
|
14
|
+
|
15
|
+
/**
|
16
|
+
*
|
10
17
|
*/
|
11
|
-
|
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,45 +66,91 @@ 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
|
|
87
135
|
type RuntimeConfig = Readonly<{
|
88
136
|
configurationName: string;
|
89
137
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
138
|
+
/**
|
139
|
+
* Dictionary of app configurations,
|
140
|
+
* where the keys are defined by {@link Detox.DetoxAppConfig#name}
|
141
|
+
* or equal to "default" if the name is not configured.
|
142
|
+
*/
|
143
|
+
apps: Record<string, Readonly<Detox.DetoxAppConfig>>;
|
144
|
+
artifacts: Readonly<Detox.DetoxArtifactsConfig>;
|
145
|
+
behavior: Readonly<Detox.DetoxBehaviorConfig>;
|
146
|
+
cli: Readonly<CLIConfig>;
|
147
|
+
device: Readonly<Detox.DetoxDeviceConfig>;
|
148
|
+
logger: Readonly<Detox.DetoxLoggerConfig>;
|
149
|
+
testRunner: Readonly<Detox.DetoxTestRunnerConfig>;
|
150
|
+
session: Readonly<Detox.DetoxSessionConfig>;
|
98
151
|
}>;
|
99
152
|
|
100
|
-
type
|
153
|
+
type CLIConfig = Readonly<Partial<{
|
101
154
|
appLaunchArgs: string;
|
102
155
|
artifactsLocation: string;
|
103
156
|
captureViewHierarchy: string;
|
package/local-cli/build.js
CHANGED
@@ -37,7 +37,7 @@ module.exports.builder = {
|
|
37
37
|
};
|
38
38
|
|
39
39
|
module.exports.handler = async function build(argv) {
|
40
|
-
const { appsConfig, errorComposer } = await detox.resolveConfig({ argv });
|
40
|
+
const { apps: appsConfig, errorComposer } = await detox.resolveConfig({ argv });
|
41
41
|
const apps = _.entries(appsConfig);
|
42
42
|
|
43
43
|
for (const [appName, app] of apps) {
|
package/local-cli/build.test.js
CHANGED
@@ -14,12 +14,12 @@ describe('build', () => {
|
|
14
14
|
const DetoxConfigErrorComposer = require('../src/errors/DetoxConfigErrorComposer');
|
15
15
|
|
16
16
|
const config = {
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
apps: {},
|
18
|
+
artifacts: {},
|
19
|
+
behavior: {},
|
20
20
|
errorComposer: new DetoxConfigErrorComposer(),
|
21
|
-
|
22
|
-
|
21
|
+
device: {},
|
22
|
+
session: {}
|
23
23
|
};
|
24
24
|
|
25
25
|
return ({
|
@@ -44,14 +44,14 @@ describe('build', () => {
|
|
44
44
|
});
|
45
45
|
|
46
46
|
it('runs the build script from the composed device config', async () => {
|
47
|
-
detox.config.
|
47
|
+
detox.config.apps.default = { build: 'yet another command' };
|
48
48
|
|
49
49
|
await callCli('./build', 'build');
|
50
50
|
expect(execSync).toHaveBeenCalledWith('yet another command', expect.anything());
|
51
51
|
});
|
52
52
|
|
53
53
|
it('skips building the app if the binary exists and --if-missing flag is set', async () => {
|
54
|
-
detox.config.
|
54
|
+
detox.config.apps.default = { build: 'yet another command', binaryPath: __filename };
|
55
55
|
|
56
56
|
await callCli('./build', 'build -i');
|
57
57
|
expect(execSync).not.toHaveBeenCalled();
|
@@ -63,32 +63,32 @@ describe('build', () => {
|
|
63
63
|
});
|
64
64
|
|
65
65
|
it('fails with an error if a build script has not been found', async () => {
|
66
|
-
detox.config.
|
66
|
+
detox.config.apps.default = {};
|
67
67
|
await expect(callCli('./build', 'build')).rejects.toThrowError(/Failed to build/);
|
68
68
|
});
|
69
69
|
|
70
70
|
it('should ignore missing build command with -s, --silent flag', async () => {
|
71
|
-
detox.config.
|
71
|
+
detox.config.apps.default = {};
|
72
72
|
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
73
73
|
expect(detox.log.warn).not.toHaveBeenCalled();
|
74
74
|
});
|
75
75
|
|
76
76
|
it('should print a warning upon user build script failure', async () => {
|
77
|
-
detox.config.
|
77
|
+
detox.config.apps.default = { build: 'a command' };
|
78
78
|
execSync.mockImplementation(() => { throw new Error('Build failure'); });
|
79
79
|
await expect(callCli('./build', 'build')).rejects.toThrowError(/Build failure/);
|
80
80
|
expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('You are responsible'));
|
81
81
|
});
|
82
82
|
|
83
83
|
it('should print a warning if app is not found at binary path', async () => {
|
84
|
-
detox.config.
|
84
|
+
detox.config.apps.default = { binaryPath: tempfile() };
|
85
85
|
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
86
86
|
expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('could not find your app at the given binary path'));
|
87
87
|
});
|
88
88
|
|
89
89
|
it('should print extra message with the app name before building (in a multi-app configuration)', async () => {
|
90
|
-
detox.config.
|
91
|
-
detox.config.
|
90
|
+
detox.config.apps.app1 = { binaryPath: tempfile(), build: ':' };
|
91
|
+
detox.config.apps.app2 = { binaryPath: tempfile(), build: ':' };
|
92
92
|
|
93
93
|
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
94
94
|
expect(detox.log.info).toHaveBeenCalledWith(expect.stringContaining('app1'));
|
@@ -96,7 +96,7 @@ describe('build', () => {
|
|
96
96
|
});
|
97
97
|
|
98
98
|
it('should not print that extra message when the app is single', async () => {
|
99
|
-
detox.config.
|
99
|
+
detox.config.apps.default = { binaryPath: tempfile(), build: ':' };
|
100
100
|
|
101
101
|
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
102
102
|
expect(detox.log.info).not.toHaveBeenCalledWith(expect.stringContaining('default'));
|
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,18 +9,19 @@ 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()
|
18
|
-
.setRunnerConfig(detox.config.
|
19
|
-
.setDeviceConfig(detox.config.
|
20
|
-
.replicateCLIConfig(detox.config.
|
19
|
+
.setRunnerConfig(detox.config.testRunner)
|
20
|
+
.setDeviceConfig(detox.config.device)
|
21
|
+
.replicateCLIConfig(detox.config.cli);
|
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
@@ -116,7 +116,7 @@ describe('CLI', () => {
|
|
116
116
|
});
|
117
117
|
});
|
118
118
|
|
119
|
-
test('should use
|
119
|
+
test('should use testRunner.args._ as default specs', async () => {
|
120
120
|
detoxConfig.testRunner.args._ = ['e2e/sanity'];
|
121
121
|
await run();
|
122
122
|
expect(_.last(cliCall().argv)).toEqual('e2e/sanity');
|
@@ -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
|
);
|
@@ -119,7 +120,7 @@ class TestRunnerCommand {
|
|
119
120
|
const fullCommand = this._buildSpawnArguments().map(escapeSpaces);
|
120
121
|
const fullCommandWithHint = printEnvironmentVariables(this._envHint) + fullCommand.join(' ');
|
121
122
|
|
122
|
-
|
123
|
+
log.info({ env: this._envHint }, fullCommandWithHint);
|
123
124
|
|
124
125
|
return new Promise((resolve, reject) => {
|
125
126
|
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.5-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": "e299576e350a493084cf00a3007e5dd1ae03c3d5"
|
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();
|