detox 20.1.0-next-is-hittable-check.0 → 20.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +2 -7
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar → 20.1.1/detox-20.1.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar → 20.1.1/detox-20.1.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom → 20.1.1/detox-20.1.1.pom} +1 -1
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.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/android/build.gradle +0 -1
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +3 -3
- package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
- package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
- package/android/detox/src/full/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescription.kt → inquiry/DetoxBusyResourceDescription.kt} +6 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +14 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
- package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
- package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
- package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
- package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +5 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
- package/index.d.ts +102 -18
- package/index.js +12 -1
- package/internals.d.ts +34 -9
- package/internals.js +10 -3
- package/local-cli/cli.js +6 -3
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/testCommand/TestRunnerCommand.js +97 -94
- package/local-cli/testCommand/TestRunnerError.js +17 -0
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/package.json +31 -16
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- 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/src/DetoxWorker.js +96 -50
- package/src/android/core/NativeMatcher.js +14 -10
- package/src/android/espressoapi/EspressoDetox.js +1 -1
- package/src/android/espressoapi/web/WebElement.js +1 -1
- package/src/android/interactions/native.js +3 -2
- package/src/android/matchers/native.js +1 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
- package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
- package/src/artifacts/utils/temporaryPath.js +32 -2
- package/src/client/AsyncWebSocket.js +3 -2
- package/src/client/actions/SyncStatusSchema.json +21 -0
- package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
- package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
- package/src/configuration/collectCliConfig.js +2 -13
- package/src/configuration/composeLoggerConfig.js +1 -0
- package/src/configuration/composeRunnerConfig.js +5 -4
- package/src/devices/allocation/drivers/AllocationDriverBase.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -16
- package/src/devices/allocation/factories/base.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +4 -0
- package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
- package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
- package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
- 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/devices/runtime/drivers/android/AndroidDriver.js +7 -6
- package/src/devices/runtime/factories/android.js +6 -5
- package/src/devices/runtime/factories/base.js +3 -2
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +22 -13
- package/src/ipc/IPCClient.js +26 -17
- package/src/ipc/IPCServer.js +11 -3
- package/src/ipc/SessionState.js +11 -11
- package/src/logger/DetoxLogger.js +67 -47
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +54 -10
- package/src/logger/utils/CategoryThreadDispatcher.js +8 -29
- package/src/logger/utils/DetoxLogFinalizer.js +166 -0
- package/src/logger/utils/MessageStack.js +17 -6
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +22 -5
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +3 -1
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +14 -25
- package/src/realms/DetoxContext.js +16 -9
- package/src/realms/DetoxInternalsFacade.js +1 -7
- package/src/realms/DetoxPrimaryContext.js +42 -87
- package/src/realms/DetoxSecondaryContext.js +9 -13
- package/src/{symbols.js → realms/symbols.js} +0 -0
- package/src/servicelocator/android/index.js +2 -2
- package/src/utils/ExclusiveLockfile.js +1 -0
- package/src/utils/argparse.js +11 -27
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
- package/local-cli/build.test.js +0 -104
- package/local-cli/run-server.test.js +0 -23
- package/local-cli/test.test.js +0 -569
- package/runners/jest/deprecation.js +0 -25
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
- package/src/logger/utils/streamUtils.js +0 -240
- package/src/realms/index.js +0 -10
- package/src/utils/trace.js +0 -3
@@ -5,7 +5,7 @@ const { getJestBooleanArgs } = require('../utils/jestInternals');
|
|
5
5
|
const { simpleUnquote, extractKnownKeys, disengageBooleanArgs } = require('../utils/yargsUtils');
|
6
6
|
|
7
7
|
const testCommandArgs = require('./builder');
|
8
|
-
const { DETOX_ARGV_OVERRIDE_NOTICE
|
8
|
+
const { DETOX_ARGV_OVERRIDE_NOTICE } = require('./warnings');
|
9
9
|
|
10
10
|
function applyEnvironmentVariableAddendum(argv, yargs) {
|
11
11
|
if (process.env.DETOX_ARGV_OVERRIDE) {
|
@@ -13,12 +13,13 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
|
|
13
13
|
|
14
14
|
const { _: positional, '--': passthrough, ...named } = yargs.parse(process.env.DETOX_ARGV_OVERRIDE);
|
15
15
|
|
16
|
-
if (positional) {
|
16
|
+
if (!_.isEmpty(positional)) {
|
17
|
+
/* istanbul ignore next */
|
17
18
|
argv._ = argv._ || [];
|
18
19
|
argv._.push(...positional.map(simpleUnquote));
|
19
20
|
}
|
20
21
|
|
21
|
-
if (passthrough) {
|
22
|
+
if (!_.isEmpty(passthrough)) {
|
22
23
|
argv['--'] = argv['--'] || [];
|
23
24
|
argv['--'].push(...passthrough.map(simpleUnquote));
|
24
25
|
}
|
@@ -29,14 +30,6 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
|
|
29
30
|
return argv;
|
30
31
|
}
|
31
32
|
|
32
|
-
function warnDeviceAppLaunchArgsDeprecation(argv) {
|
33
|
-
if (argv['device-boot-args'] && process.argv.some(a => a.startsWith('--device-launch-args'))) {
|
34
|
-
log.warn(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
35
|
-
}
|
36
|
-
|
37
|
-
return argv;
|
38
|
-
}
|
39
|
-
|
40
33
|
/**
|
41
34
|
* @param {Record<string, *>} argv
|
42
35
|
* @returns {{
|
@@ -64,12 +57,10 @@ function splitArgv(argv) {
|
|
64
57
|
// noinspection JSUnusedGlobalSymbols
|
65
58
|
module.exports = {
|
66
59
|
applyEnvironmentVariableAddendum,
|
67
|
-
warnDeviceAppLaunchArgsDeprecation,
|
68
60
|
splitArgv,
|
69
61
|
};
|
70
62
|
|
71
63
|
module.exports.default = [
|
72
64
|
applyEnvironmentVariableAddendum,
|
73
|
-
warnDeviceAppLaunchArgsDeprecation,
|
74
65
|
splitArgv,
|
75
66
|
];
|
@@ -1,5 +1,3 @@
|
|
1
|
-
const { DEVICE_LAUNCH_ARGS_DEPRECATION } = require('../../src/configuration/utils/warnings');
|
2
|
-
|
3
1
|
const DETOX_ARGV_OVERRIDE_NOTICE = `
|
4
2
|
_____ _____ ___________
|
5
3
|
/ ___|_ _| _ | ___ \\ $DETOX_ARGV_OVERRIDE is detected
|
@@ -22,5 +20,4 @@ const DETOX_ARGV_OVERRIDE_NOTICE = `
|
|
22
20
|
|
23
21
|
module.exports = {
|
24
22
|
DETOX_ARGV_OVERRIDE_NOTICE,
|
25
|
-
DEVICE_LAUNCH_ARGS_DEPRECATION,
|
26
23
|
};
|
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.1.
|
4
|
+
"version": "20.1.1",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -35,21 +35,23 @@
|
|
35
35
|
"@types/bunyan": "^1.8.8",
|
36
36
|
"@types/child-process-promise": "^2.2.1",
|
37
37
|
"@types/fs-extra": "^9.0.13",
|
38
|
-
"@types/jest": "^
|
39
|
-
"@types/node": "^
|
38
|
+
"@types/jest": "^28.1.8",
|
39
|
+
"@types/node": "^14.18.33",
|
40
40
|
"@types/node-ipc": "^9.2.0",
|
41
41
|
"@types/ws": "^7.4.0",
|
42
42
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
43
43
|
"@typescript-eslint/parser": "^5.4.0",
|
44
|
+
"cross-env": "^7.0.3",
|
44
45
|
"eslint": "^8.3.0",
|
45
46
|
"eslint-plugin-import": "^2.23.3",
|
46
47
|
"eslint-plugin-no-only-tests": "^2.6.0",
|
47
48
|
"eslint-plugin-node": "^11.1.0",
|
48
49
|
"eslint-plugin-unicorn": "^39.0.0",
|
49
|
-
"jest": "^28.
|
50
|
+
"jest": "^28.1.3",
|
51
|
+
"jest-allure2-reporter": "^1.2.1",
|
50
52
|
"mockdate": "^2.0.1",
|
51
53
|
"prettier": "1.7.0",
|
52
|
-
"react-native": "0.69.
|
54
|
+
"react-native": "0.69.7",
|
53
55
|
"react-native-codegen": "^0.0.8",
|
54
56
|
"typescript": "^4.5.2",
|
55
57
|
"wtfnode": "^0.9.1"
|
@@ -58,17 +60,16 @@
|
|
58
60
|
"ajv": "^8.6.3",
|
59
61
|
"bunyan": "^1.8.12",
|
60
62
|
"bunyan-debug-stream": "^3.1.0",
|
63
|
+
"caf": "^15.0.1",
|
61
64
|
"chalk": "^2.4.2",
|
62
65
|
"child-process-promise": "^2.2.0",
|
63
|
-
"duplexify": "^4.1.2",
|
64
66
|
"find-up": "^4.1.0",
|
65
67
|
"fs-extra": "^4.0.2",
|
66
|
-
"funpermaproxy": "^1.0
|
68
|
+
"funpermaproxy": "^1.1.0",
|
67
69
|
"glob": "^8.0.3",
|
68
70
|
"ini": "^1.3.4",
|
69
71
|
"json-cycle": "^1.3.0",
|
70
72
|
"lodash": "^4.17.5",
|
71
|
-
"minimist": "^1.2.0",
|
72
73
|
"multi-sort-stream": "^1.0.3",
|
73
74
|
"multipipe": "^4.0.0",
|
74
75
|
"node-ipc": "^9.2.1",
|
@@ -81,7 +82,6 @@
|
|
81
82
|
"signal-exit": "^3.0.3",
|
82
83
|
"stream-json": "^1.7.4",
|
83
84
|
"strip-ansi": "^6.0.1",
|
84
|
-
"tail": "^2.0.0",
|
85
85
|
"telnet-client": "1.2.8",
|
86
86
|
"tempfile": "^2.0.0",
|
87
87
|
"trace-event-lib": "^1.3.1",
|
@@ -100,7 +100,7 @@
|
|
100
100
|
}
|
101
101
|
},
|
102
102
|
"engines": {
|
103
|
-
"node": ">=
|
103
|
+
"node": ">=14.5.0"
|
104
104
|
},
|
105
105
|
"jest": {
|
106
106
|
"setupFiles": [
|
@@ -123,6 +123,8 @@
|
|
123
123
|
"__tests__",
|
124
124
|
".test.js$",
|
125
125
|
".mock.js$",
|
126
|
+
"index.js",
|
127
|
+
"internals.js",
|
126
128
|
"local-cli/utils",
|
127
129
|
"src/environmentFactory",
|
128
130
|
"src/android/espressoapi",
|
@@ -159,10 +161,23 @@
|
|
159
161
|
"src/utils/pipeCommands.js",
|
160
162
|
"src/utils/pressAnyKey.js",
|
161
163
|
"src/utils/shellUtils.js",
|
162
|
-
"runners/jest
|
164
|
+
"runners/jest/reporters",
|
165
|
+
"runners/jest/testEnvironment",
|
166
|
+
"src/DetoxWorker.js",
|
167
|
+
"src/logger/utils/streamUtils.js",
|
168
|
+
"src/realms"
|
163
169
|
],
|
164
170
|
"resetMocks": true,
|
165
171
|
"resetModules": true,
|
172
|
+
"reporters": [
|
173
|
+
"default",
|
174
|
+
[
|
175
|
+
"jest-allure2-reporter",
|
176
|
+
{
|
177
|
+
"getEnvironmentInfo": false
|
178
|
+
}
|
179
|
+
]
|
180
|
+
],
|
166
181
|
"coverageReporters": [
|
167
182
|
"html",
|
168
183
|
"json",
|
@@ -177,12 +192,12 @@
|
|
177
192
|
],
|
178
193
|
"coverageThreshold": {
|
179
194
|
"global": {
|
180
|
-
"statements":
|
181
|
-
"branches":
|
182
|
-
"functions":
|
183
|
-
"lines":
|
195
|
+
"statements": 100,
|
196
|
+
"branches": 100,
|
197
|
+
"functions": 100,
|
198
|
+
"lines": 100
|
184
199
|
}
|
185
200
|
}
|
186
201
|
},
|
187
|
-
"gitHead": "
|
202
|
+
"gitHead": "c0135e1a0ce091318cc34b7f162157fbe73b11ab"
|
188
203
|
}
|
package/runners/deprecation.js
CHANGED
@@ -1,47 +1,45 @@
|
|
1
1
|
const chalk = require('chalk');
|
2
2
|
|
3
3
|
// @ts-ignore
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
throw
|
46
|
-
'\n\nPlease follow the new Jest setup guide:\nhttps://github.com/wix/Detox/blob/master/docs/Guide.Jest.md\n\n'
|
47
|
-
), { stack: '' });
|
4
|
+
const bold = chalk.bold;
|
5
|
+
|
6
|
+
function getMaxWidth(text) {
|
7
|
+
const lines = text.split('\n');
|
8
|
+
return lines.reduce((acc, line) => Math.max(acc, line.length), 0);
|
9
|
+
}
|
10
|
+
|
11
|
+
function centerText(text, maxWidth = getMaxWidth(text)) {
|
12
|
+
return text
|
13
|
+
.split('\n')
|
14
|
+
.map(line => {
|
15
|
+
const padStart = Math.max(0, Math.floor((maxWidth - line.length) / 2));
|
16
|
+
const padEnd = Math.max(0, maxWidth - line.length - padStart);
|
17
|
+
return ' '.repeat(padStart) + line + ' '.repeat(padEnd);
|
18
|
+
})
|
19
|
+
.join('\n');
|
20
|
+
}
|
21
|
+
|
22
|
+
const header = `\
|
23
|
+
========================= THE NEW JOURNEY BEGINS =============================`;
|
24
|
+
|
25
|
+
console.error(centerText(`\
|
26
|
+
|
27
|
+
${bold(header)}
|
28
|
+
|
29
|
+
https://wix.github.io/Detox/docs/guide/migration
|
30
|
+
|
31
|
+
Sorry to say that Detox 20 comes without old adapters for Jest.
|
32
|
+
You have to rearrange your init code before you can continue your journey.
|
33
|
+
|
34
|
+
Navigate to the link and follow the migration guide steps.
|
35
|
+
|
36
|
+
Sincerely yours,
|
37
|
+
Detox team.
|
38
|
+
|
39
|
+
${bold(header)}
|
40
|
+
|
41
|
+
`, header.length));
|
42
|
+
|
43
|
+
const error = new Error('\nPlease follow the migration guide:\nhttps://wix.github.io/Detox/docs/guide/migration\n\n');
|
44
|
+
error.stack = '';
|
45
|
+
throw error;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
declare module 'detox/runners/jest' {
|
2
|
+
import type NodeEnvironment from 'jest-environment-node';
|
3
|
+
|
4
|
+
export function globalSetup(): Promise<void>;
|
5
|
+
export function globalTeardown(): Promise<void>;
|
6
|
+
|
7
|
+
export type DetoxCircusListenerConstructorOpts = {
|
8
|
+
readonly env: DetoxCircusEnvironment;
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @example
|
13
|
+
* class CustomListener implements DetoxCircusListener {
|
14
|
+
* constructor(opts: DetoxCircusListenerConstructorOpts) {
|
15
|
+
* console.log('Current test path is:', opts.env.testPath);
|
16
|
+
* }
|
17
|
+
* }
|
18
|
+
*/
|
19
|
+
export interface DetoxCircusListener {
|
20
|
+
start_describe_definition?(event: unknown, state: unknown): void;
|
21
|
+
finish_describe_definition?(event: unknown, state: unknown): void;
|
22
|
+
add_hook?(event: unknown, state: unknown): void;
|
23
|
+
add_test?(event: unknown, state: unknown): void;
|
24
|
+
error?(event: unknown, state: unknown): void;
|
25
|
+
|
26
|
+
setup?(event: unknown, state: unknown): void | Promise<void>;
|
27
|
+
include_test_location_in_result?(event: unknown, state: unknown): void | Promise<void>;
|
28
|
+
hook_start?(event: unknown, state: unknown): void | Promise<void>;
|
29
|
+
hook_success?(event: unknown, state: unknown): void | Promise<void>;
|
30
|
+
hook_failure?(event: unknown, state: unknown): void | Promise<void>;
|
31
|
+
test_fn_start?(event: unknown, state: unknown): void | Promise<void>;
|
32
|
+
test_fn_success?(event: unknown, state: unknown): void | Promise<void>;
|
33
|
+
test_fn_failure?(event: unknown, state: unknown): void | Promise<void>;
|
34
|
+
test_retry?(event: unknown, state: unknown): void | Promise<void>;
|
35
|
+
test_start?(event: unknown, state: unknown): void | Promise<void>;
|
36
|
+
test_skip?(event: unknown, state: unknown): void | Promise<void>;
|
37
|
+
test_todo?(event: unknown, state: unknown): void | Promise<void>;
|
38
|
+
test_done?(event: unknown, state: unknown): void | Promise<void>;
|
39
|
+
run_describe_start?(event: unknown, state: unknown): void | Promise<void>;
|
40
|
+
run_describe_finish?(event: unknown, state: unknown): void | Promise<void>;
|
41
|
+
run_start?(event: unknown, state: unknown): void | Promise<void>;
|
42
|
+
run_finish?(event: unknown, state: unknown): void | Promise<void>;
|
43
|
+
teardown?(event: unknown, state: unknown): void | Promise<void>;
|
44
|
+
}
|
45
|
+
|
46
|
+
export interface DetoxListenerFactory {
|
47
|
+
new (opts: DetoxCircusListenerConstructorOpts): DetoxCircusListener;
|
48
|
+
}
|
49
|
+
|
50
|
+
export class DetoxCircusEnvironment extends NodeEnvironment {
|
51
|
+
public readonly handleTestEvent: (event: unknown, state: unknown) => void | Promise<void>;
|
52
|
+
public readonly testPath: string;
|
53
|
+
|
54
|
+
protected registerListeners(map: Record<string, DetoxListenerFactory>): void;
|
55
|
+
protected setupTimeout: number;
|
56
|
+
protected teardownTimeout: number;
|
57
|
+
protected initDetox(): Promise<DetoxInternals.Worker>;
|
58
|
+
protected cleanupDetox(): Promise<void>;
|
59
|
+
}
|
60
|
+
}
|
package/runners/jest/index.js
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// Lazy require() is used to avoid initializing a bare Detox context when it is not needed.
|
2
|
+
// At the moment, this safety measure is not really needed, but it's better to be on the safe side.
|
3
3
|
|
4
|
+
module.exports = {
|
4
5
|
get DetoxCircusEnvironment() {
|
5
6
|
return require('./testEnvironment');
|
6
7
|
},
|
7
8
|
|
8
|
-
//#endregion
|
9
|
-
|
10
|
-
//#region *** Worker Realm ***
|
11
|
-
|
12
9
|
get globalSetup() {
|
13
10
|
return require('./globalSetup');
|
14
11
|
},
|
@@ -16,6 +13,4 @@ module.exports = {
|
|
16
13
|
get globalTeardown() {
|
17
14
|
return require('./globalTeardown');
|
18
15
|
},
|
19
|
-
|
20
|
-
//#endregion
|
21
16
|
};
|
@@ -5,20 +5,31 @@ const JestVerboseReporter = require(resolveFrom(process.cwd(), '@jest/reporters'
|
|
5
5
|
const { config, reportTestResults } = require('../../../internals');
|
6
6
|
|
7
7
|
class DetoxReporter extends JestVerboseReporter {
|
8
|
+
/**
|
9
|
+
* @param {import('@jest/test-result').AggregatedResult} results
|
10
|
+
*/
|
11
|
+
// @ts-ignore
|
12
|
+
async onRunComplete(_contexts, results) {
|
13
|
+
// @ts-ignore
|
14
|
+
await super.onRunComplete(_contexts, results);
|
15
|
+
|
16
|
+
await reportTestResults(results.testResults.map(r => ({
|
17
|
+
success: !r.failureMessage,
|
18
|
+
testFilePath: r.testFilePath,
|
19
|
+
testExecError: r.testExecError,
|
20
|
+
isPermanentFailure: this._isPermanentFailure(r),
|
21
|
+
})));
|
22
|
+
}
|
23
|
+
|
8
24
|
/**
|
9
25
|
* @param {import('@jest/test-result').TestResult} testResult
|
10
26
|
*/
|
11
|
-
|
12
|
-
|
27
|
+
_isPermanentFailure(testResult) {
|
28
|
+
if (config.testRunner.jest.retryAfterCircusRetries) {
|
29
|
+
return false;
|
30
|
+
}
|
13
31
|
|
14
|
-
|
15
|
-
success: !testResult.failureMessage,
|
16
|
-
testFilePath: testResult.testFilePath,
|
17
|
-
testExecError: testResult.testExecError,
|
18
|
-
isPermanentFailure: config.testRunner.jest.retryAfterCircusRetries
|
19
|
-
? false
|
20
|
-
: testResult.testResults.some(r => r.status === 'failed' && r.invocations > 1)
|
21
|
-
}]);
|
32
|
+
return testResult.testResults.some(r => r.status === 'failed' && r.invocations > 1);
|
22
33
|
}
|
23
34
|
}
|
24
35
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
1
3
|
const resolveFrom = require('resolve-from');
|
2
4
|
const maybeNodeEnvironment = require(resolveFrom(process.cwd(), 'jest-environment-node'));
|
3
5
|
/** @type {typeof import('@jest/environment').JestEnvironment} */
|
@@ -39,7 +41,7 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
39
41
|
this._timer = new Timer();
|
40
42
|
|
41
43
|
/** @internal */
|
42
|
-
this.testPath = context.testPath;
|
44
|
+
this.testPath = path.relative(process.cwd(), context.testPath);
|
43
45
|
/** @protected */
|
44
46
|
this.testEventListeners = [];
|
45
47
|
/** @protected */
|
@@ -49,45 +51,8 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
49
51
|
|
50
52
|
log.trace.begin(this.testPath);
|
51
53
|
|
52
|
-
|
53
|
-
this.
|
54
|
-
await log.trace.complete('set up environment', async () => {
|
55
|
-
try {
|
56
|
-
this._timer.schedule(this.setupTimeout);
|
57
|
-
await this._handleTestEventAsync({ name: 'environment_setup_start' });
|
58
|
-
await this._timer.run(`setting up Detox environment`, _setup);
|
59
|
-
await this._handleTestEventAsync({ name: 'environment_setup_success' });
|
60
|
-
} catch (error) {
|
61
|
-
this._timer.schedule(this.teardownTimeout);
|
62
|
-
await this._handleTestEventAsync({ name: 'environment_setup_failure', error });
|
63
|
-
throw error;
|
64
|
-
} finally {
|
65
|
-
this._timer.clear();
|
66
|
-
}
|
67
|
-
});
|
68
|
-
};
|
69
|
-
|
70
|
-
const _teardown = this.teardown.bind(this);
|
71
|
-
this.teardown = async () => {
|
72
|
-
await log.trace.complete('tear down environment', async () => {
|
73
|
-
try {
|
74
|
-
this._timer.schedule(this.teardownTimeout);
|
75
|
-
await this._handleTestEventAsync({ name: 'environment_teardown_start' });
|
76
|
-
await this._timer.run(`tearing down Detox environment`, _teardown);
|
77
|
-
await this._handleTestEventAsync({ name: 'environment_teardown_success' });
|
78
|
-
} catch (error) {
|
79
|
-
if (this._timer.expired) {
|
80
|
-
this._timer.schedule(this.teardownTimeout);
|
81
|
-
}
|
82
|
-
|
83
|
-
await this._handleTestEventAsync({ name: 'environment_teardown_failure', error });
|
84
|
-
throw error;
|
85
|
-
} finally {
|
86
|
-
this._timer.clear();
|
87
|
-
log.trace.end();
|
88
|
-
}
|
89
|
-
});
|
90
|
-
};
|
54
|
+
this.setup = this._wrapSetup(this.setup);
|
55
|
+
this.teardown = this._wrapTeardown(this.teardown);
|
91
56
|
|
92
57
|
this.registerListeners({
|
93
58
|
DetoxInitErrorListener,
|
@@ -100,6 +65,7 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
100
65
|
|
101
66
|
/** @override */
|
102
67
|
async setup() {
|
68
|
+
await super.setup();
|
103
69
|
await this.initDetox();
|
104
70
|
}
|
105
71
|
|
@@ -115,7 +81,11 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
115
81
|
|
116
82
|
/** @override */
|
117
83
|
async teardown() {
|
118
|
-
|
84
|
+
try {
|
85
|
+
await this.cleanupDetox();
|
86
|
+
} finally {
|
87
|
+
await super.teardown();
|
88
|
+
}
|
119
89
|
}
|
120
90
|
|
121
91
|
/** @protected */
|
@@ -184,6 +154,52 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
184
154
|
}
|
185
155
|
}
|
186
156
|
}
|
157
|
+
|
158
|
+
_wrapSetup(fn) {
|
159
|
+
const _setup = fn.bind(this);
|
160
|
+
|
161
|
+
return async () => {
|
162
|
+
await log.trace.complete('set up environment', async () => {
|
163
|
+
try {
|
164
|
+
this._timer.schedule(this.setupTimeout);
|
165
|
+
await this._handleTestEventAsync({ name: 'environment_setup_start' });
|
166
|
+
await this._timer.run(`setting up Detox environment`, _setup);
|
167
|
+
await this._handleTestEventAsync({ name: 'environment_setup_success' });
|
168
|
+
} catch (error) {
|
169
|
+
this._timer.schedule(this.teardownTimeout);
|
170
|
+
await this._handleTestEventAsync({ name: 'environment_setup_failure', error });
|
171
|
+
throw error;
|
172
|
+
} finally {
|
173
|
+
this._timer.clear();
|
174
|
+
}
|
175
|
+
});
|
176
|
+
};
|
177
|
+
}
|
178
|
+
|
179
|
+
_wrapTeardown(fn) {
|
180
|
+
const _teardown = fn.bind(this);
|
181
|
+
|
182
|
+
return async () => {
|
183
|
+
await log.trace.complete('tear down environment', async () => {
|
184
|
+
try {
|
185
|
+
this._timer.schedule(this.teardownTimeout);
|
186
|
+
await this._handleTestEventAsync({ name: 'environment_teardown_start' });
|
187
|
+
await this._timer.run(`tearing down Detox environment`, _teardown);
|
188
|
+
await this._handleTestEventAsync({ name: 'environment_teardown_success' });
|
189
|
+
} catch (error) {
|
190
|
+
if (this._timer.expired) {
|
191
|
+
this._timer.schedule(this.teardownTimeout);
|
192
|
+
}
|
193
|
+
|
194
|
+
await this._handleTestEventAsync({ name: 'environment_teardown_failure', error });
|
195
|
+
throw error;
|
196
|
+
} finally {
|
197
|
+
this._timer.clear();
|
198
|
+
log.trace.end();
|
199
|
+
}
|
200
|
+
});
|
201
|
+
};
|
202
|
+
}
|
187
203
|
}
|
188
204
|
|
189
205
|
module.exports = DetoxCircusEnvironment;
|