detox 20.0.14-next-is-hittable-check-2.0 → 20.0.15-prerelease.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.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.md5 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.md5} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha1 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha1} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha256 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha256} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha512 → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.aar.sha512} +0 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom → 20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.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 +3 -6
- package/internals.d.ts +26 -5
- package/local-cli/cli.js +1 -1
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/test.test.js +61 -28
- package/local-cli/testCommand/TestRunnerCommand.js +77 -87
- 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/package.json +14 -8
- package/runners/deprecation.js +42 -44
- 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 +21 -10
- package/runners/jest/testEnvironment/index.js +57 -41
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +62 -35
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +84 -46
- package/src/android/interactions/native.js +3 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeRunnerConfig.js +4 -3
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +2 -0
- package/src/devices/runtime/RuntimeDevice.js +3 -3
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/ios/expectTwo.js +3 -2
- package/src/ipc/SessionState.js +7 -5
- package/src/logger/DetoxLogger.js +32 -41
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +11 -7
- package/src/logger/utils/CategoryThreadDispatcher.js +7 -29
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +4 -3
- package/src/logger/utils/sanitizeBunyanContext.js +3 -1
- package/src/logger/utils/streamUtils.js +34 -26
- package/src/logger/utils/tracerLegacy.js +14 -25
- package/src/realms/DetoxContext.js +8 -7
- package/src/realms/DetoxPrimaryContext.js +22 -82
- package/src/realms/DetoxSecondaryContext.js +0 -8
- package/src/utils/argparse.js +11 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/traceInvocationCall.js +21 -0
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha512 +0 -1
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/utils/trace.js +0 -3
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.md5
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ef866445bee1b7191de4336c76dd93f9
|
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-javadoc.jar.sha1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3d69a7ece65dfc290ba7c7a71d7e76227353d86f
|
@@ -0,0 +1 @@
|
|
1
|
+
d34810beb66a73776549bfa5f5c2eefc40250584f69bf471612403f18ea8b518
|
@@ -0,0 +1 @@
|
|
1
|
+
c59585aa86f4995c6873ae6fc086b882076b6c3a655388515abcacbadb3dbddd46712869703619e903dff89c466ed080634e113b3a480465fa27ec3edde08d7a
|
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.md5
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ff0f0578be190c91b57c6024df4b5fb6
|
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0-sources.jar.sha1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
8cc49ca4de60598d65767133544f0bd6ad97b494
|
@@ -0,0 +1 @@
|
|
1
|
+
5ad08ad6fb9c09f1391a326d24d96b939ca8cde038f78dbc7ff0a4604e27f3b0
|
@@ -0,0 +1 @@
|
|
1
|
+
403e4e5b90acce7b564bb73213361df77e3e226a36465c7308875a7511e6c8794ab22c8cbd3580eb439798b0245d4a54be94e818a08ffa5125bc85913e802f94
|
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.15-prerelease.0</version>
|
7
7
|
<packaging>aar</packaging>
|
8
8
|
<name>Detox</name>
|
9
9
|
<description>Gray box end-to-end testing and automation library for mobile apps</description>
|
@@ -0,0 +1 @@
|
|
1
|
+
8c1df15d68775116019b04b9496a6ff6
|
@@ -0,0 +1 @@
|
|
1
|
+
dbe3d335c31886336e6c969b38e222d6f92004da
|
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha256
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
4ec36429edce121f9a29981a67b9ea84bce00e7c4991bd6d1636c8edb0d3b322
|
package/Detox-android/com/wix/detox/20.0.15-prerelease.0/detox-20.0.15-prerelease.0.pom.sha512
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
c4b645ab10c009733624a5aebb04c701a0b73e22dc419b3ba5a396d6937bad9d26e1ae7d9c4057bfc5d915b4af91250af6c5b991535b8554ba1d80abb3990b10
|
@@ -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.15-prerelease.0</latest>
|
7
|
+
<release>20.0.15-prerelease.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.0.
|
9
|
+
<version>20.0.15-prerelease.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20221110171141</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
0a8740dfdf732622e512707d164837bc
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
f892f8ff0cda46b0e16a893224d340c1e3d2c803
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
9ed56153c167d071db724c68d6e141358916df50340cf29bb3ff23ea8db43091
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
13e2b660cbe1403226c025fe83ebb5f8c9f28de41fd432bcc355a9b42562e9158e68c161b6cf801f45c9878565d46beb7884b5b62d6ace714e36d06d17a1d1e3
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
package/index.d.ts
CHANGED
@@ -82,7 +82,7 @@ declare global {
|
|
82
82
|
*/
|
83
83
|
exposeGlobals?: boolean;
|
84
84
|
/**
|
85
|
-
* By default, Detox will uninstall and install the app upon
|
85
|
+
* By default, Detox will uninstall and install the app upon initialization.
|
86
86
|
* If you wish to reuse the existing app for a faster run, set the property to
|
87
87
|
* `false`.
|
88
88
|
*/
|
@@ -408,8 +408,6 @@ declare global {
|
|
408
408
|
os: string;
|
409
409
|
}
|
410
410
|
|
411
|
-
type DetoxKnownDeviceType = DetoxBuiltInDeviceConfig['type'];
|
412
|
-
|
413
411
|
type DetoxConfiguration = DetoxConfigurationCommon & (
|
414
412
|
| DetoxConfigurationSingleApp
|
415
413
|
| DetoxConfigurationMultiApps
|
@@ -474,8 +472,6 @@ declare global {
|
|
474
472
|
readonly startSection: (name: string) => void;
|
475
473
|
/** @deprecated */
|
476
474
|
readonly endSection: (name: string) => void;
|
477
|
-
/** @private */
|
478
|
-
readonly invocationCall: (...args: unknown[]) => unknown;
|
479
475
|
};
|
480
476
|
|
481
477
|
/**
|
@@ -683,10 +679,11 @@ declare global {
|
|
683
679
|
* Relaunch the app. Convenience method that calls {@link Device#launchApp}
|
684
680
|
* with { newInstance: true } override.
|
685
681
|
*
|
682
|
+
* @deprecated
|
686
683
|
* @param config
|
687
684
|
* @see Device#launchApp
|
688
685
|
*/
|
689
|
-
relaunchApp(config?:
|
686
|
+
relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
|
690
687
|
|
691
688
|
/**
|
692
689
|
* Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and
|
package/internals.d.ts
CHANGED
@@ -13,28 +13,36 @@ declare global {
|
|
13
13
|
resolveConfig(options?: Partial<DetoxInitOptions>): Promise<RuntimeConfig>;
|
14
14
|
|
15
15
|
/**
|
16
|
+
* Returns one of statuses depending on what’s going with the current Detox context:
|
16
17
|
*
|
18
|
+
* `inactive` – before `init()` and after `cleanup()` is called.
|
19
|
+
* `init` – while `init()` is executing.
|
20
|
+
* `active` – after `init()` and before `cleanup()` is called.
|
21
|
+
* `cleanup` – while `cleanup()` is executing.
|
17
22
|
*/
|
18
23
|
getStatus(): DetoxStatus;
|
19
24
|
|
20
25
|
/**
|
21
|
-
*
|
26
|
+
* Starts a new Detox test session with the provided configuration.
|
27
|
+
* See {@link https://wix.github.io/Detox/docs/next/api/internals} for more details.
|
22
28
|
*/
|
23
29
|
init(options?: Partial<DetoxInitOptions>): Promise<void>;
|
24
30
|
|
25
31
|
/**
|
26
|
-
* This is the phase where Detox loads its expectation library and
|
32
|
+
* This is the phase where Detox loads its expectation library and boots a device.
|
33
|
+
* You don't need to call it separately unless you use `init({ workerId: null })` override.
|
27
34
|
*/
|
28
35
|
installWorker(options?: Partial<DetoxInstallWorkerOptions>): Promise<void>;
|
29
36
|
|
30
37
|
/**
|
31
38
|
* Deallocates the device.
|
39
|
+
* Most Client API (device, by, element, expect) will stop working, except for the logger.
|
32
40
|
*/
|
33
41
|
uninstallWorker(): Promise<void>;
|
34
42
|
|
35
43
|
/**
|
36
|
-
*
|
37
|
-
*
|
44
|
+
* This method should be called when the main or child process is about to exit.
|
45
|
+
* See {@link https://wix.github.io/Detox/docs/next/api/internals} for more details.
|
38
46
|
*/
|
39
47
|
cleanup(): Promise<void>;
|
40
48
|
//#endregion
|
@@ -234,7 +242,7 @@ declare global {
|
|
234
242
|
* or equal to "default" if the name is not configured.
|
235
243
|
*/
|
236
244
|
apps: Record<string, Readonly<Detox.DetoxAppConfig>>;
|
237
|
-
artifacts: Readonly<
|
245
|
+
artifacts: Readonly<RuntimeArtifactsConfig>;
|
238
246
|
behavior: Readonly<Detox.DetoxBehaviorConfig>;
|
239
247
|
cli: Readonly<CLIConfig>;
|
240
248
|
device: Readonly<Detox.DetoxDeviceConfig>;
|
@@ -243,6 +251,19 @@ declare global {
|
|
243
251
|
session: Readonly<Detox.DetoxSessionConfig>;
|
244
252
|
}>;
|
245
253
|
|
254
|
+
type RuntimeArtifactsConfig = {
|
255
|
+
rootDir: string;
|
256
|
+
pathBuilder: string;
|
257
|
+
plugins: Readonly<{
|
258
|
+
log: Readonly<Detox.DetoxLogArtifactsPluginConfig>;
|
259
|
+
screenshot: Readonly<Detox.DetoxScreenshotArtifactsPluginConfig>;
|
260
|
+
video: Readonly<Detox.DetoxVideoArtifactsPluginConfig>;
|
261
|
+
instruments: Readonly<Detox.DetoxInstrumentsArtifactsPluginConfig>;
|
262
|
+
uiHierarchy: Readonly<Detox.DetoxUIHierarchyArtifactsPluginConfig>;
|
263
|
+
[pluginId: string]: unknown;
|
264
|
+
}>;
|
265
|
+
};
|
266
|
+
|
246
267
|
type CLIConfig = Readonly<Partial<{
|
247
268
|
appLaunchArgs: string;
|
248
269
|
artifactsLocation: string;
|
package/local-cli/cli.js
CHANGED
@@ -30,7 +30,7 @@ yargs
|
|
30
30
|
if (err) {
|
31
31
|
logger.error(DetoxError.format(err));
|
32
32
|
// eslint-disable-next-line no-console
|
33
|
-
|
33
|
+
process.stderr.write('\n');
|
34
34
|
// @ts-ignore
|
35
35
|
_.attempt(() => fs.unlinkSync(logger.file));
|
36
36
|
// eslint-disable-next-line no-process-exit
|
package/local-cli/init.js
CHANGED
@@ -9,7 +9,7 @@ const jestTemplates = require('./templates/jest');
|
|
9
9
|
let exitCode = 0;
|
10
10
|
|
11
11
|
module.exports.command = 'init';
|
12
|
-
module.exports.desc = '
|
12
|
+
module.exports.desc = 'Creates template files to get you started with Detox';
|
13
13
|
module.exports.builder = {};
|
14
14
|
|
15
15
|
module.exports.handler = async function init() {
|
package/local-cli/test.js
CHANGED
@@ -3,7 +3,7 @@ const detox = require('../internals');
|
|
3
3
|
const TestRunnerCommand = require('./testCommand/TestRunnerCommand');
|
4
4
|
|
5
5
|
module.exports.command = 'test';
|
6
|
-
module.exports.desc = 'Run your test
|
6
|
+
module.exports.desc = 'Run your test suites with the test runner specified in the project\'s Detox config';
|
7
7
|
module.exports.builder = require('./testCommand/builder');
|
8
8
|
module.exports.middlewares = require('./testCommand/middlewares').default;
|
9
9
|
|
@@ -16,14 +16,14 @@ module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
|
|
16
16
|
};
|
17
17
|
|
18
18
|
const config = await detox.resolveConfig(opts);
|
19
|
-
if (!
|
19
|
+
if (!config.cli.inspectBrk) {
|
20
20
|
await detox.init(opts);
|
21
21
|
}
|
22
22
|
|
23
|
-
const runnerCommand = new TestRunnerCommand(
|
24
|
-
|
25
|
-
.
|
26
|
-
|
23
|
+
const runnerCommand = new TestRunnerCommand({
|
24
|
+
config,
|
25
|
+
env: process.env,
|
26
|
+
});
|
27
27
|
|
28
28
|
await runnerCommand.execute();
|
29
29
|
} finally {
|
package/local-cli/test.test.js
CHANGED
@@ -12,6 +12,7 @@ const cp = require('child_process');
|
|
12
12
|
const cpSpawn = cp.spawn;
|
13
13
|
const os = require('os');
|
14
14
|
const path = require('path');
|
15
|
+
const util = require('util');
|
15
16
|
|
16
17
|
const fs = require('fs-extra');
|
17
18
|
const _ = require('lodash');
|
@@ -107,22 +108,49 @@ describe('CLI', () => {
|
|
107
108
|
])('given no extra args (%s)', (_platform, deviceType) => {
|
108
109
|
beforeEach(async () => {
|
109
110
|
singleConfig().device.type = deviceType;
|
110
|
-
await run();
|
111
111
|
});
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
describe('when testRunner.forwardEnv is true', () => {
|
114
|
+
beforeEach(async () => {
|
115
|
+
singleConfig().testRunner = { forwardEnv: true };
|
116
|
+
await run();
|
117
|
+
});
|
118
|
+
|
119
|
+
test('should produce a default command', () => {
|
120
|
+
expect(cliCall().argv).toEqual([expect.stringContaining('executable'), '--config', 'e2e/config.json']);
|
121
|
+
});
|
116
122
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
test('should override environment variables', () => {
|
124
|
+
expect(cliCall().env).toEqual({
|
125
|
+
DETOX_CONFIG_PATH: expect.any(String),
|
126
|
+
DETOX_CONFIG_SNAPSHOT_PATH: expect.any(String)
|
127
|
+
});
|
128
|
+
});
|
129
|
+
|
130
|
+
test('should hint essential environment variables', () => {
|
131
|
+
expect(cliCall().fullCommand).toMatch(/\bDETOX_CONFIG_PATH=.*\bexecutable\b/);
|
121
132
|
});
|
122
133
|
});
|
123
134
|
|
124
|
-
|
125
|
-
|
135
|
+
describe('when testRunner.forwardEnv is false', () => {
|
136
|
+
beforeEach(async () => {
|
137
|
+
singleConfig().testRunner = { forwardEnv: false };
|
138
|
+
await run();
|
139
|
+
});
|
140
|
+
|
141
|
+
test('should produce a default command', () => {
|
142
|
+
expect(cliCall().argv).toEqual([expect.stringContaining('executable'), '--config', 'e2e/config.json']);
|
143
|
+
});
|
144
|
+
|
145
|
+
test('should not override environment variables', () => {
|
146
|
+
expect(cliCall().env).toEqual({
|
147
|
+
DETOX_CONFIG_SNAPSHOT_PATH: expect.any(String)
|
148
|
+
});
|
149
|
+
});
|
150
|
+
|
151
|
+
test('should not hint essential environment variables', () => {
|
152
|
+
expect(cliCall().fullCommand).not.toMatch(/\bDETOX_CONFIG_PATH=.*\bexecutable\b/);
|
153
|
+
});
|
126
154
|
});
|
127
155
|
});
|
128
156
|
|
@@ -327,13 +355,6 @@ describe('CLI', () => {
|
|
327
355
|
expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
328
356
|
});
|
329
357
|
|
330
|
-
test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
|
331
|
-
await run(`--device-launch-args="--verbose"`);
|
332
|
-
expect(cliCall().env).toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
333
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
334
|
-
expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
335
|
-
});
|
336
|
-
|
337
358
|
test('--app-launch-args should be passed as an environment variable', async () => {
|
338
359
|
await run(`--app-launch-args="--debug yes"`);
|
339
360
|
expect(cliCall().env).toHaveProperty('DETOX_APP_LAUNCH_ARGS');
|
@@ -374,8 +395,6 @@ describe('CLI', () => {
|
|
374
395
|
expect(cliCall().argv.slice(-2)).toEqual(['e2e/01.sanity.test.js', 'e2e/02.sanity.test.js']);
|
375
396
|
});
|
376
397
|
|
377
|
-
test.todo('--inspect-brk should work');
|
378
|
-
|
379
398
|
test.each([
|
380
399
|
['-d e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
381
400
|
['--debug-synchronization e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
@@ -453,15 +472,14 @@ describe('CLI', () => {
|
|
453
472
|
expect(cliCall().argv).toContain('--deepParameter');
|
454
473
|
});
|
455
474
|
|
456
|
-
|
457
|
-
|
458
|
-
|
475
|
+
test('--inspect-brk should activate inspectBrk hook', async () => {
|
476
|
+
detoxConfig.testRunner.inspectBrk = (config) => {
|
477
|
+
config.args.customFlag = true;
|
478
|
+
return config;
|
479
|
+
};
|
459
480
|
|
460
|
-
|
461
|
-
|
462
|
-
} else {
|
463
|
-
expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/\.bin\/jest/);
|
464
|
-
}
|
481
|
+
await run('--inspect-brk');
|
482
|
+
expect(cliCall().argv).toContain('--customFlag');
|
465
483
|
});
|
466
484
|
|
467
485
|
test('should append $DETOX_ARGV_OVERRIDE to detox test ... command and print a warning', async () => {
|
@@ -477,6 +495,16 @@ describe('CLI', () => {
|
|
477
495
|
expect(logger().warn).toHaveBeenCalledWith(expect.stringContaining('$DETOX_ARGV_OVERRIDE is detected'));
|
478
496
|
});
|
479
497
|
|
498
|
+
test('should append $DETOX_ARGV_OVERRIDE "--" part to test runner command', async () => {
|
499
|
+
process.env.PLATFORM = 'ios';
|
500
|
+
process.env.DETOX_ARGV_OVERRIDE = '-- --help';
|
501
|
+
|
502
|
+
await run();
|
503
|
+
|
504
|
+
expect(cliCall().argv.slice(-1)).toEqual(['--help']);
|
505
|
+
expect(logger().warn).toHaveBeenCalledWith(expect.stringContaining('$DETOX_ARGV_OVERRIDE is detected'));
|
506
|
+
});
|
507
|
+
|
480
508
|
// Helpers
|
481
509
|
|
482
510
|
function tempfile(extension, content) {
|
@@ -531,7 +559,12 @@ describe('CLI', () => {
|
|
531
559
|
}
|
532
560
|
|
533
561
|
async function run(...args) {
|
534
|
-
|
562
|
+
let contents = `module.exports = ${util.inspect(detoxConfig, { depth: Infinity })};`;
|
563
|
+
if (detoxConfig.testRunner && detoxConfig.testRunner.inspectBrk) {
|
564
|
+
contents = contents.replace(/\[Function.*\]/m, detoxConfig.testRunner.inspectBrk.toString());
|
565
|
+
}
|
566
|
+
|
567
|
+
detoxConfigPath = tempfile('.js', contents);
|
535
568
|
const __configPath = Math.random() > 0.5 ? '-C' : '--config-path';
|
536
569
|
return runRaw('test', __configPath, detoxConfigPath, ...args);
|
537
570
|
}
|
@@ -11,98 +11,33 @@ const { printEnvironmentVariables, prependNodeModulesBinToPATH } = require('../.
|
|
11
11
|
const { escapeSpaces } = require('../../src/utils/shellUtils');
|
12
12
|
|
13
13
|
class TestRunnerCommand {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
/*
|
15
|
+
@param {object} opts
|
16
|
+
@param {DetoxInternals.RuntimeConfig} opts.config
|
17
|
+
@param {ProcessEnv} opts.env
|
18
|
+
*/
|
19
|
+
constructor(opts) {
|
20
|
+
const cliConfig = opts.config.cli;
|
21
|
+
const deviceConfig = opts.config.device;
|
22
|
+
const runnerConfig = opts.config.testRunner;
|
23
|
+
|
24
|
+
this._argv = runnerConfig.args;
|
25
|
+
this._retries = runnerConfig.retries;
|
26
|
+
this._envHint = this._buildEnvHint(opts.env);
|
18
27
|
this._envFwd = {};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* @param {Partial<Readonly<DetoxInternals.CLIConfig>>} cliConfig
|
26
|
-
* @returns {this}
|
27
|
-
*/
|
28
|
-
replicateCLIConfig(cliConfig) {
|
29
|
-
this._cli2env = _.omitBy({
|
30
|
-
DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
|
31
|
-
DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
|
32
|
-
DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
|
33
|
-
DETOX_CLEANUP: cliConfig.cleanup,
|
34
|
-
DETOX_CONFIGURATION: cliConfig.configuration,
|
35
|
-
DETOX_CONFIG_PATH: cliConfig.configPath,
|
36
|
-
DETOX_DEBUG_SYNCHRONIZATION: cliConfig.debugSynchronization,
|
37
|
-
DETOX_DEVICE_BOOT_ARGS: cliConfig.deviceBootArgs,
|
38
|
-
DETOX_DEVICE_NAME: cliConfig.deviceName,
|
39
|
-
DETOX_FORCE_ADB_INSTALL: this._deviceConfig.type.startsWith('android.')
|
40
|
-
? cliConfig.forceAdbInstall
|
41
|
-
: undefined,
|
42
|
-
DETOX_GPU: cliConfig.gpu,
|
43
|
-
DETOX_HEADLESS: cliConfig.headless,
|
44
|
-
DETOX_KEEP_LOCKFILE: cliConfig.keepLockFile,
|
45
|
-
DETOX_LOGLEVEL: cliConfig.loglevel,
|
46
|
-
DETOX_READ_ONLY_EMU: cliConfig.readonlyEmu,
|
47
|
-
DETOX_RECORD_LOGS: cliConfig.recordLogs,
|
48
|
-
DETOX_RECORD_PERFORMANCE: cliConfig.recordPerformance,
|
49
|
-
DETOX_RECORD_VIDEOS: cliConfig.recordVideos,
|
50
|
-
DETOX_REPORT_SPECS: cliConfig.jestReportSpecs,
|
51
|
-
DETOX_RETRIES: cliConfig.retries,
|
52
|
-
DETOX_REUSE: cliConfig.reuse,
|
53
|
-
DETOX_TAKE_SCREENSHOTS: cliConfig.takeScreenshots,
|
54
|
-
DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
|
55
|
-
}, _.isUndefined);
|
56
|
-
|
57
|
-
this._envHint = _(process.env)
|
58
|
-
.mapKeys((_value, key) => key.toUpperCase())
|
59
|
-
.pickBy((_value, key) => key.startsWith('DETOX_'))
|
60
|
-
.omit(['DETOX_CONFIG_SNAPSHOT_PATH'])
|
61
|
-
.value();
|
62
|
-
|
63
|
-
return this;
|
64
|
-
}
|
65
|
-
|
66
|
-
/**
|
67
|
-
* @param {Detox.DetoxDeviceConfig} config
|
68
|
-
* @returns {this}
|
69
|
-
*/
|
70
|
-
setDeviceConfig(config) {
|
71
|
-
this._deviceConfig = config;
|
72
|
-
|
73
|
-
return this;
|
74
|
-
}
|
75
|
-
|
76
|
-
/**
|
77
|
-
* @param {Detox.DetoxTestRunnerConfig} config
|
78
|
-
* @returns {this}
|
79
|
-
*/
|
80
|
-
setRunnerConfig(config) {
|
81
|
-
this._argv = config.args;
|
82
|
-
this._retries = config.inspectBrk ? 0 : config.retries;
|
83
|
-
if (config.forwardEnv) {
|
84
|
-
this._envFwd = this._cli2env;
|
85
|
-
Object.assign(this._envHint, this._cli2env);
|
28
|
+
if (runnerConfig.forwardEnv) {
|
29
|
+
this._envFwd = this._buildEnvOverride(cliConfig, deviceConfig);
|
30
|
+
Object.assign(this._envHint, this._envFwd);
|
86
31
|
}
|
87
|
-
|
88
|
-
return this;
|
89
32
|
}
|
90
33
|
|
91
34
|
async execute() {
|
92
35
|
let runsLeft = 1 + this._retries;
|
93
|
-
let launchError;
|
36
|
+
let launchError = null;
|
94
37
|
|
95
38
|
do {
|
96
39
|
try {
|
97
|
-
|
98
|
-
const list = this._argv._.map((file, index) => ` ${index + 1}. ${file}`).join('\n');
|
99
|
-
log.error(
|
100
|
-
`There were failing tests in the following files:\n${list}\n\n` +
|
101
|
-
'Detox CLI is going to restart the test runner with those files...\n'
|
102
|
-
);
|
103
|
-
}
|
104
|
-
|
105
|
-
await this._doExecute();
|
40
|
+
await this._spawnTestRunner();
|
106
41
|
launchError = null;
|
107
42
|
} catch (e) {
|
108
43
|
launchError = e;
|
@@ -120,9 +55,10 @@ class TestRunnerCommand {
|
|
120
55
|
}
|
121
56
|
|
122
57
|
if (--runsLeft > 0) {
|
123
|
-
this._argv._ = testFilesToRetry;
|
124
58
|
// @ts-ignore
|
125
|
-
detox.session.testSessionIndex++; // it is always
|
59
|
+
detox.session.testSessionIndex++; // it is always the primary context, so we can update it
|
60
|
+
this._argv._ = testFilesToRetry;
|
61
|
+
this._logRelaunchError();
|
126
62
|
}
|
127
63
|
}
|
128
64
|
} while (launchError && runsLeft > 0);
|
@@ -132,7 +68,49 @@ class TestRunnerCommand {
|
|
132
68
|
}
|
133
69
|
}
|
134
70
|
|
135
|
-
|
71
|
+
_buildEnvHint(env) {
|
72
|
+
return _(env)
|
73
|
+
.mapKeys((_value, key) => key.toUpperCase())
|
74
|
+
.pickBy((_value, key) => key.startsWith('DETOX_'))
|
75
|
+
.omit(['DETOX_CONFIG_SNAPSHOT_PATH'])
|
76
|
+
.value();
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @param {DetoxInternals.CLIConfig} cliConfig
|
81
|
+
* @param {Detox.DetoxDeviceConfig} deviceConfig
|
82
|
+
*/
|
83
|
+
_buildEnvOverride(cliConfig, deviceConfig) {
|
84
|
+
return _.omitBy({
|
85
|
+
DETOX_APP_LAUNCH_ARGS: cliConfig.appLaunchArgs,
|
86
|
+
DETOX_ARTIFACTS_LOCATION: cliConfig.artifactsLocation,
|
87
|
+
DETOX_CAPTURE_VIEW_HIERARCHY: cliConfig.captureViewHierarchy,
|
88
|
+
DETOX_CLEANUP: cliConfig.cleanup,
|
89
|
+
DETOX_CONFIGURATION: cliConfig.configuration,
|
90
|
+
DETOX_CONFIG_PATH: cliConfig.configPath,
|
91
|
+
DETOX_DEBUG_SYNCHRONIZATION: cliConfig.debugSynchronization,
|
92
|
+
DETOX_DEVICE_BOOT_ARGS: cliConfig.deviceBootArgs,
|
93
|
+
DETOX_DEVICE_NAME: cliConfig.deviceName,
|
94
|
+
DETOX_FORCE_ADB_INSTALL: deviceConfig.type.startsWith('android.')
|
95
|
+
? cliConfig.forceAdbInstall
|
96
|
+
: undefined,
|
97
|
+
DETOX_GPU: cliConfig.gpu,
|
98
|
+
DETOX_HEADLESS: cliConfig.headless,
|
99
|
+
DETOX_KEEP_LOCKFILE: cliConfig.keepLockFile,
|
100
|
+
DETOX_LOGLEVEL: cliConfig.loglevel,
|
101
|
+
DETOX_READ_ONLY_EMU: cliConfig.readonlyEmu,
|
102
|
+
DETOX_RECORD_LOGS: cliConfig.recordLogs,
|
103
|
+
DETOX_RECORD_PERFORMANCE: cliConfig.recordPerformance,
|
104
|
+
DETOX_RECORD_VIDEOS: cliConfig.recordVideos,
|
105
|
+
DETOX_REPORT_SPECS: cliConfig.jestReportSpecs,
|
106
|
+
DETOX_RETRIES: cliConfig.retries,
|
107
|
+
DETOX_REUSE: cliConfig.reuse,
|
108
|
+
DETOX_TAKE_SCREENSHOTS: cliConfig.takeScreenshots,
|
109
|
+
DETOX_USE_CUSTOM_LOGGER: cliConfig.useCustomLogger,
|
110
|
+
}, _.isUndefined);
|
111
|
+
}
|
112
|
+
|
113
|
+
async _spawnTestRunner() {
|
136
114
|
const fullCommand = this._buildSpawnArguments().map(escapeSpaces);
|
137
115
|
const fullCommandWithHint = printEnvironmentVariables(this._envHint) + fullCommand.join(' ');
|
138
116
|
|
@@ -149,7 +127,7 @@ class TestRunnerCommand {
|
|
149
127
|
.tap(prependNodeModulesBinToPATH)
|
150
128
|
.value()
|
151
129
|
})
|
152
|
-
.on('error', (err) => reject(err))
|
130
|
+
.on('error', /* istanbul ignore next */ (err) => reject(err))
|
153
131
|
.on('exit', (code) => code === 0
|
154
132
|
? resolve()
|
155
133
|
: reject(new DetoxRuntimeError(`Command failed with exit code = ${code}:\n${fullCommandWithHint}`)
|
@@ -158,6 +136,7 @@ class TestRunnerCommand {
|
|
158
136
|
}
|
159
137
|
|
160
138
|
_buildSpawnArguments() {
|
139
|
+
/* istanbul ignore next */
|
161
140
|
const { _: specs = [], '--': passthrough = [], $0, ...argv } = this._argv;
|
162
141
|
const { _: $0_, ...$0argv } = parser($0);
|
163
142
|
|
@@ -168,6 +147,17 @@ class TestRunnerCommand {
|
|
168
147
|
...unparse({ _: [...passthrough, ...specs] }),
|
169
148
|
].map(String);
|
170
149
|
}
|
150
|
+
|
151
|
+
_logRelaunchError() {
|
152
|
+
const list = this._argv._.map((file, index) => {
|
153
|
+
return ` ${index + 1}. ${file}`;
|
154
|
+
}).join('\n');
|
155
|
+
|
156
|
+
log.error(
|
157
|
+
`There were failing tests in the following files:\n${list}\n\n` +
|
158
|
+
'Detox CLI is going to restart the test runner with those files...\n'
|
159
|
+
);
|
160
|
+
}
|
171
161
|
}
|
172
162
|
|
173
163
|
module.exports = TestRunnerCommand;
|
@@ -109,7 +109,6 @@ module.exports = {
|
|
109
109
|
describe: 'Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.',
|
110
110
|
},
|
111
111
|
'device-boot-args': {
|
112
|
-
alias: 'device-launch-args',
|
113
112
|
group: 'Execution:',
|
114
113
|
describe: 'Custom arguments to pass (through) onto the device (emulator/simulator) binary when booted.',
|
115
114
|
},
|