detox 20.1.0-next-is-hittable-check.0 → 20.1.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.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar → 20.1.0/detox-20.1.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-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.0/detox-20.1.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.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.0/detox-20.1.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.0/detox-20.1.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/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 +2 -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 +1 -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/internals.d.ts +34 -9
- 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 +18 -15
- 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 +95 -49
- package/src/android/interactions/native.js +3 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/artifacts/utils/temporaryPath.js +32 -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 +1 -12
- package/src/configuration/composeRunnerConfig.js +5 -4
- 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/common/drivers/android/exec/ADB.js +4 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +4 -0
- package/src/devices/runtime/RuntimeDevice.js +3 -3
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +3 -2
- 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 +63 -43
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +50 -7
- 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 +11 -7
- package/src/realms/DetoxInternalsFacade.js +0 -6
- package/src/realms/DetoxPrimaryContext.js +42 -87
- package/src/realms/DetoxSecondaryContext.js +8 -12
- package/src/utils/argparse.js +11 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/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/logger/utils/streamUtils.js +0 -240
- package/src/utils/trace.js +0 -3
package/src/utils/argparse.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
1
3
|
const _ = require('lodash');
|
2
4
|
const argv = require('minimist')(process.argv.slice(2));
|
3
5
|
|
@@ -81,9 +83,18 @@ function joinArgs(keyValues, options = DEFAULT_JOIN_ARGUMENTS_OPTIONS) {
|
|
81
83
|
return argArray.join(' ');
|
82
84
|
}
|
83
85
|
|
86
|
+
function getCurrentCommand() {
|
87
|
+
const cwd = process.cwd();
|
88
|
+
|
89
|
+
return process.argv.slice(1).map((value, index) => {
|
90
|
+
return index ? value : path.relative(cwd, value);
|
91
|
+
}).join(' ');
|
92
|
+
}
|
93
|
+
|
84
94
|
module.exports = {
|
85
95
|
getArgValue,
|
86
96
|
getEnvValue,
|
87
97
|
getFlag,
|
88
98
|
joinArgs,
|
99
|
+
getCurrentCommand,
|
89
100
|
};
|
package/src/utils/logger.js
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
3
|
+
function toSimplePath(filePath, cwd = process.cwd()) {
|
4
|
+
const relativePath = path.relative(cwd, filePath);
|
5
|
+
const isOutsideCwd = relativePath.split(path.sep, 1)[0] === '..';
|
6
|
+
return isOutsideCwd ? filePath : relativePath;
|
7
|
+
}
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
toSimplePath,
|
11
|
+
};
|
package/src/utils/shellUtils.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
const SPACE = ' ';
|
2
2
|
const BACK_SLASH = '\\';
|
3
|
+
const FORWARD_SLASH = '/';
|
3
4
|
const SINGLE_QUOTE = "'";
|
4
5
|
const DOUBLE_QUOTE = '"';
|
5
6
|
|
@@ -64,6 +65,14 @@ function autoEscapeCmd(str) {
|
|
64
65
|
return escapeWithDoubleQuotedString(str);
|
65
66
|
}
|
66
67
|
|
68
|
+
function useForwardSlashesCMD(str) {
|
69
|
+
return str.split(BACK_SLASH).join(FORWARD_SLASH);
|
70
|
+
}
|
71
|
+
|
72
|
+
function useForwardSlashesShell(str) {
|
73
|
+
return str; // already POSIX, so no-op
|
74
|
+
}
|
75
|
+
|
67
76
|
const hasUnsafeChars = isRunningInCMDEXE()
|
68
77
|
/* istanbul ignore next */ ? hasUnsafeCMDChars
|
69
78
|
/* istanbul ignore next */ : hasUnsafeShellChars;
|
@@ -76,6 +85,10 @@ const escapeSpaces = isRunningInCMDEXE()
|
|
76
85
|
/* istanbul ignore next */ ? escapeSpacesCMD
|
77
86
|
/* istanbul ignore next */ : escapeSpacesShell;
|
78
87
|
|
88
|
+
const usePosixSlashes = isRunningInCMDEXE()
|
89
|
+
/* istanbul ignore next */ ? useForwardSlashesCMD
|
90
|
+
/* istanbul ignore next */ : useForwardSlashesShell;
|
91
|
+
|
79
92
|
module.exports = {
|
80
93
|
escapeInDoubleQuotedString,
|
81
94
|
escapeInDoubleQuotedRegexp,
|
@@ -94,4 +107,8 @@ module.exports = {
|
|
94
107
|
cmd: autoEscapeCmd,
|
95
108
|
shell: autoEscapeShell,
|
96
109
|
}),
|
110
|
+
useForwardSlashes: Object.assign(usePosixSlashes, {
|
111
|
+
cmd: useForwardSlashesCMD,
|
112
|
+
shell: useForwardSlashesShell,
|
113
|
+
}),
|
97
114
|
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
function _getCallStackTrace() {
|
2
|
+
return new Error().stack
|
3
|
+
.split('\n')
|
4
|
+
.slice(1) // Ignore Error message
|
5
|
+
.map(line => line
|
6
|
+
.replace(/^\s*at\s+/, '')
|
7
|
+
.replace(process.cwd(), '')
|
8
|
+
)
|
9
|
+
.filter(line => !line.includes('/detox/src')) // Ignore detox internal calls
|
10
|
+
.join('\n');
|
11
|
+
}
|
12
|
+
|
13
|
+
function invocationCall(logger, sectionName, invocation, action) {
|
14
|
+
return logger.trace.complete({
|
15
|
+
cat: 'ws-client,ws-client-invocation',
|
16
|
+
data: invocation,
|
17
|
+
stack: _getCallStackTrace(),
|
18
|
+
}, sectionName, action);
|
19
|
+
}
|
20
|
+
|
21
|
+
module.exports = invocationCall;
|
@@ -1 +0,0 @@
|
|
1
|
-
3f9aa853e15bb15aa9558ac3d2b7252f
|
@@ -1 +0,0 @@
|
|
1
|
-
f1dd211a2bbbe503be2e90573c9aa465d39f029e
|
@@ -1 +0,0 @@
|
|
1
|
-
251b43c4d9cac5fbae87a75c015c577257212beb1c9a0ab294981f8d12310019
|
@@ -1 +0,0 @@
|
|
1
|
-
08cc04feb00bd8b233b990b7127b42af544865adf28b2cb57601c791d313672f0dbe20c5673d393395edeb970d8d11127c7eb098add143b13b044a62999d60a9
|
@@ -1 +0,0 @@
|
|
1
|
-
24df5a9831b657b7ebb686b3677bdd78
|
@@ -1 +0,0 @@
|
|
1
|
-
996291301615fc1a37a2a3cea94459b0d315864f
|
@@ -1 +0,0 @@
|
|
1
|
-
ebd8dbf8bb38883b6988fd82932ce0a09f287e13501ec31d80677abe8c077589
|
@@ -1 +0,0 @@
|
|
1
|
-
35852565ad133c30234f00c3e518761068bf749a47e7c600e768b6b9756e76ed5fe40bfb139d5cdce27f30b9b76792c8cc2218f7086b39e68ac4658609eb75a5
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
3bdd1b42fa0f182255a47fcdda8f544c
|
@@ -1 +0,0 @@
|
|
1
|
-
457ae10d202b196ea92bade4a33ce2dbc2f8bb3f
|
@@ -1 +0,0 @@
|
|
1
|
-
52342d1b0d1fae681b2ea1e6f9ac6f6278299ed70d7867fd60b95d63eb7a9ec3
|
@@ -1 +0,0 @@
|
|
1
|
-
5dfa73d84d647fd870a2e915d9943c9502c967abfd89a834ef7dee50a2a77d5a8b0be7b13407a34a6b97cbc10e9ed6f5e608fe7366d5a3041e462e3322d5b10d
|
@@ -1 +0,0 @@
|
|
1
|
-
185b91e2be7cfaeaf995b7ca85cefe7b
|
@@ -1 +0,0 @@
|
|
1
|
-
e4cd532fd4f1339057ffe02814349398e9dc1a49
|
@@ -1 +0,0 @@
|
|
1
|
-
76bdd7d38a6da78a81a590e378879fcb0f66c432af1bd280e0fdb60b37da7d79
|
@@ -1 +0,0 @@
|
|
1
|
-
5a16f5124aec001470b9a4f9458674a477f8e844866ed2858bf096f0e27936d52b5e31c41d317e83d06ee200d5e9c5a2c302488e0d37eb7264fc5a55ffb03bb7
|
@@ -1,24 +0,0 @@
|
|
1
|
-
package com.wix.detox.espresso.registry
|
2
|
-
|
3
|
-
import androidx.test.espresso.Espresso
|
4
|
-
import androidx.test.espresso.IdlingResource
|
5
|
-
import androidx.test.espresso.base.IdlingResourceRegistry
|
6
|
-
import com.wix.detox.common.UIThread
|
7
|
-
import org.joor.Reflect
|
8
|
-
import java.util.concurrent.Callable
|
9
|
-
|
10
|
-
class IRStatusInquirer(private val registry: IdlingResourceRegistry) {
|
11
|
-
fun getAllBusyResources(): List<IdlingResource> {
|
12
|
-
return UIThread.postFirstSync(Callable<List<IdlingResource>> {
|
13
|
-
registry.resources.filter { resource ->
|
14
|
-
!resource.isIdleNow
|
15
|
-
}
|
16
|
-
})
|
17
|
-
}
|
18
|
-
|
19
|
-
companion object {
|
20
|
-
val INSTANCE = IRStatusInquirer(getRegistryDefault())
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
private fun getRegistryDefault() = Reflect.on(Espresso::class.java).get<IdlingResourceRegistry>("baseRegistry")
|
@@ -1,10 +0,0 @@
|
|
1
|
-
package com.wix.detox.reactnative.idlingresources
|
2
|
-
|
3
|
-
import androidx.test.espresso.IdlingResource
|
4
|
-
|
5
|
-
interface DescriptiveIdlingResource: IdlingResource {
|
6
|
-
/**
|
7
|
-
* Returns a descriptive representation of the resource.
|
8
|
-
*/
|
9
|
-
fun getDescription(): IdlingResourceDescription
|
10
|
-
}
|
package/local-cli/build.test.js
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
const tempfile = require('tempfile');
|
2
|
-
|
3
|
-
describe('build', () => {
|
4
|
-
let execSync, detox, callCli;
|
5
|
-
|
6
|
-
beforeEach(() => {
|
7
|
-
// @ts-ignore
|
8
|
-
callCli = global.callCli;
|
9
|
-
jest.mock('child_process');
|
10
|
-
execSync = require('child_process').execSync;
|
11
|
-
|
12
|
-
jest.mock('../src/utils/logger');
|
13
|
-
jest.mock('../internals', () => {
|
14
|
-
const DetoxConfigErrorComposer = require('../src/errors/DetoxConfigErrorComposer');
|
15
|
-
|
16
|
-
const config = {
|
17
|
-
apps: {},
|
18
|
-
artifacts: {},
|
19
|
-
behavior: {},
|
20
|
-
errorComposer: new DetoxConfigErrorComposer(),
|
21
|
-
device: {},
|
22
|
-
session: {}
|
23
|
-
};
|
24
|
-
|
25
|
-
return ({
|
26
|
-
config,
|
27
|
-
resolveConfig: jest.fn().mockResolvedValue(config),
|
28
|
-
log: require('../src/utils/logger')
|
29
|
-
});
|
30
|
-
});
|
31
|
-
|
32
|
-
detox = require('../internals');
|
33
|
-
});
|
34
|
-
|
35
|
-
it('passes argv to resolveConfig', async () => {
|
36
|
-
await callCli('./build', 'build -C /etc/.detoxrc.js -c myconf').catch(() => {});
|
37
|
-
|
38
|
-
expect(detox.resolveConfig).toHaveBeenCalledWith({
|
39
|
-
argv: expect.objectContaining({
|
40
|
-
'C': '/etc/.detoxrc.js',
|
41
|
-
'c': 'myconf',
|
42
|
-
}),
|
43
|
-
});
|
44
|
-
});
|
45
|
-
|
46
|
-
it('runs the build script from the composed device config', async () => {
|
47
|
-
detox.config.apps.default = { build: 'yet another command' };
|
48
|
-
|
49
|
-
await callCli('./build', 'build');
|
50
|
-
expect(execSync).toHaveBeenCalledWith('yet another command', expect.anything());
|
51
|
-
});
|
52
|
-
|
53
|
-
it('skips building the app if the binary exists and --if-missing flag is set', async () => {
|
54
|
-
detox.config.apps.default = { build: 'yet another command', binaryPath: __filename };
|
55
|
-
|
56
|
-
await callCli('./build', 'build -i');
|
57
|
-
expect(execSync).not.toHaveBeenCalled();
|
58
|
-
|
59
|
-
await callCli('./build', 'build --if-missing');
|
60
|
-
expect(execSync).not.toHaveBeenCalled();
|
61
|
-
|
62
|
-
expect(detox.log.info).toHaveBeenCalledWith('Skipping build for "default" app...');
|
63
|
-
});
|
64
|
-
|
65
|
-
it('fails with an error if a build script has not been found', async () => {
|
66
|
-
detox.config.apps.default = {};
|
67
|
-
await expect(callCli('./build', 'build')).rejects.toThrowError(/Failed to build/);
|
68
|
-
});
|
69
|
-
|
70
|
-
it('should ignore missing build command with -s, --silent flag', async () => {
|
71
|
-
detox.config.apps.default = {};
|
72
|
-
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
73
|
-
expect(detox.log.warn).not.toHaveBeenCalled();
|
74
|
-
});
|
75
|
-
|
76
|
-
it('should print a warning upon user build script failure', async () => {
|
77
|
-
detox.config.apps.default = { build: 'a command' };
|
78
|
-
execSync.mockImplementation(() => { throw new Error('Build failure'); });
|
79
|
-
await expect(callCli('./build', 'build')).rejects.toThrowError(/Build failure/);
|
80
|
-
expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('You are responsible'));
|
81
|
-
});
|
82
|
-
|
83
|
-
it('should print a warning if app is not found at binary path', async () => {
|
84
|
-
detox.config.apps.default = { binaryPath: tempfile() };
|
85
|
-
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
86
|
-
expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('could not find your app at the given binary path'));
|
87
|
-
});
|
88
|
-
|
89
|
-
it('should print extra message with the app name before building (in a multi-app configuration)', async () => {
|
90
|
-
detox.config.apps.app1 = { binaryPath: tempfile(), build: ':' };
|
91
|
-
detox.config.apps.app2 = { binaryPath: tempfile(), build: ':' };
|
92
|
-
|
93
|
-
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
94
|
-
expect(detox.log.info).toHaveBeenCalledWith(expect.stringContaining('app1'));
|
95
|
-
expect(detox.log.info).toHaveBeenCalledWith(expect.stringContaining('app2'));
|
96
|
-
});
|
97
|
-
|
98
|
-
it('should not print that extra message when the app is single', async () => {
|
99
|
-
detox.config.apps.default = { binaryPath: tempfile(), build: ':' };
|
100
|
-
|
101
|
-
await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
|
102
|
-
expect(detox.log.info).not.toHaveBeenCalledWith(expect.stringContaining('default'));
|
103
|
-
});
|
104
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
jest.mock('../src/utils/logger');
|
3
|
-
|
4
|
-
describe('run-server', () => {
|
5
|
-
it('starts the server', async () => {
|
6
|
-
jest.mock('../src/server/DetoxServer');
|
7
|
-
const DetoxServer = require('../src/server/DetoxServer');
|
8
|
-
await callCli('./run-server', 'run-server');
|
9
|
-
|
10
|
-
expect(DetoxServer).toHaveBeenCalledWith(expect.objectContaining({ port: 8099 }));
|
11
|
-
});
|
12
|
-
|
13
|
-
it('throws if the port number is out of range', async () => {
|
14
|
-
jest.spyOn(process, 'exit'); // otherwise tests are aborted
|
15
|
-
jest.mock('../src/server/DetoxServer');
|
16
|
-
const DetoxServer = require('../src/server/DetoxServer');
|
17
|
-
|
18
|
-
await expect(callCli('./run-server', 'run-server -p PORT')).rejects.toThrowErrorMatchingSnapshot();
|
19
|
-
await expect(callCli('./run-server', 'run-server -p 0')).rejects.toThrowErrorMatchingSnapshot();
|
20
|
-
await expect(callCli('./run-server', 'run-server -p 100000')).rejects.toThrowErrorMatchingSnapshot();
|
21
|
-
expect(DetoxServer).not.toHaveBeenCalled();
|
22
|
-
});
|
23
|
-
});
|