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.
Files changed (144) hide show
  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 → 20.1.0/detox-20.1.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-javadoc.jar.sha512 +1 -0
  6. 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
  7. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar +0 -0
  12. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.aar.sha512 +1 -0
  16. 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
  17. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/20.1.0/detox-20.1.0.pom.sha512 +1 -0
  21. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  22. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  23. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  24. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  25. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  26. package/Detox-ios-src.tbz +0 -0
  27. package/Detox-ios.tbz +0 -0
  28. package/android/build.gradle +0 -1
  29. package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +3 -3
  30. package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
  31. package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
  32. package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
  33. package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
  34. package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
  35. package/android/detox/src/full/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescription.kt → inquiry/DetoxBusyResourceDescription.kt} +6 -6
  36. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
  37. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +2 -4
  38. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
  39. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
  40. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +14 -8
  41. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +1 -6
  42. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
  43. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
  44. package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
  45. package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
  46. package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
  47. package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
  48. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
  49. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +5 -5
  50. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
  51. package/index.d.ts +102 -18
  52. package/internals.d.ts +34 -9
  53. package/local-cli/cli.js +6 -3
  54. package/local-cli/init.js +1 -1
  55. package/local-cli/test.js +6 -6
  56. package/local-cli/testCommand/TestRunnerCommand.js +97 -94
  57. package/local-cli/testCommand/TestRunnerError.js +17 -0
  58. package/local-cli/testCommand/builder.js +0 -1
  59. package/local-cli/testCommand/middlewares.js +4 -13
  60. package/local-cli/testCommand/warnings.js +0 -3
  61. package/package.json +18 -15
  62. package/runners/deprecation.js +42 -44
  63. package/runners/jest/index.d.ts +60 -0
  64. package/runners/jest/index.js +3 -8
  65. package/runners/jest/reporters/DetoxReporter.js +21 -10
  66. package/runners/jest/testEnvironment/index.js +57 -41
  67. package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +62 -35
  68. package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
  69. package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
  70. package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
  71. package/src/DetoxWorker.js +95 -49
  72. package/src/android/interactions/native.js +3 -2
  73. package/src/artifacts/ArtifactsManager.js +6 -6
  74. package/src/artifacts/utils/temporaryPath.js +32 -2
  75. package/src/client/actions/SyncStatusSchema.json +21 -0
  76. package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
  77. package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
  78. package/src/configuration/collectCliConfig.js +1 -12
  79. package/src/configuration/composeRunnerConfig.js +5 -4
  80. package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -3
  81. package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -16
  82. package/src/devices/common/drivers/android/exec/ADB.js +4 -0
  83. package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
  84. package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +4 -0
  85. package/src/devices/runtime/RuntimeDevice.js +3 -3
  86. package/src/errors/DetoxConfigErrorComposer.js +6 -1
  87. package/src/errors/DetoxError.js +5 -1
  88. package/src/ios/expectTwo.js +3 -2
  89. package/src/ipc/IPCClient.js +26 -17
  90. package/src/ipc/IPCServer.js +11 -3
  91. package/src/ipc/SessionState.js +11 -11
  92. package/src/logger/DetoxLogger.js +63 -43
  93. package/src/logger/index.js +1 -0
  94. package/src/logger/utils/BunyanLogger.js +50 -7
  95. package/src/logger/utils/CategoryThreadDispatcher.js +8 -29
  96. package/src/logger/utils/DetoxLogFinalizer.js +166 -0
  97. package/src/logger/utils/MessageStack.js +17 -6
  98. package/src/logger/utils/ThreadDispatcher.js +5 -25
  99. package/src/logger/utils/customConsoleLogger.js +22 -5
  100. package/src/logger/utils/getMainCategory.js +5 -0
  101. package/src/logger/utils/sanitizeBunyanContext.js +3 -1
  102. package/src/logger/utils/streams/BunyanTransformer.js +72 -0
  103. package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
  104. package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
  105. package/src/logger/utils/streams/JSONLStringer.js +55 -0
  106. package/src/logger/utils/streams/index.js +7 -0
  107. package/src/logger/utils/streams/transformers.js +39 -0
  108. package/src/logger/utils/tracerLegacy.js +14 -25
  109. package/src/realms/DetoxContext.js +11 -7
  110. package/src/realms/DetoxInternalsFacade.js +0 -6
  111. package/src/realms/DetoxPrimaryContext.js +42 -87
  112. package/src/realms/DetoxSecondaryContext.js +8 -12
  113. package/src/utils/argparse.js +11 -0
  114. package/src/utils/logger.js +1 -1
  115. package/src/utils/pathUtils.js +11 -0
  116. package/src/utils/shellUtils.js +17 -0
  117. package/src/utils/traceInvocationCall.js +21 -0
  118. 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
  119. 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
  120. 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
  121. 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
  122. 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
  123. 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
  124. 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
  125. 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
  126. 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
  127. 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
  128. 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
  129. 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
  130. 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
  131. 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
  132. 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
  133. 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
  134. 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
  135. package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
  136. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
  137. package/local-cli/build.test.js +0 -104
  138. package/local-cli/run-server.test.js +0 -23
  139. package/local-cli/test.test.js +0 -569
  140. package/runners/jest/deprecation.js +0 -25
  141. package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
  142. package/src/configuration/utils/warnings.js +0 -12
  143. package/src/logger/utils/streamUtils.js +0 -240
  144. package/src/utils/trace.js +0 -3
@@ -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
  };
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * @type {Detox.Logger}
3
3
  */
4
- module.exports = require('../..').log;
4
+ module.exports = require('../../internals').log;
@@ -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
+ };
@@ -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
- 251b43c4d9cac5fbae87a75c015c577257212beb1c9a0ab294981f8d12310019
@@ -1 +0,0 @@
1
- 08cc04feb00bd8b233b990b7127b42af544865adf28b2cb57601c791d313672f0dbe20c5673d393395edeb970d8d11127c7eb098add143b13b044a62999d60a9
@@ -1 +0,0 @@
1
- ebd8dbf8bb38883b6988fd82932ce0a09f287e13501ec31d80677abe8c077589
@@ -1 +0,0 @@
1
- 35852565ad133c30234f00c3e518761068bf749a47e7c600e768b6b9756e76ed5fe40bfb139d5cdce27f30b9b76792c8cc2218f7086b39e68ac4658609eb75a5
@@ -1 +0,0 @@
1
- 52342d1b0d1fae681b2ea1e6f9ac6f6278299ed70d7867fd60b95d63eb7a9ec3
@@ -1 +0,0 @@
1
- 5dfa73d84d647fd870a2e915d9943c9502c967abfd89a834ef7dee50a2a77d5a8b0be7b13407a34a6b97cbc10e9ed6f5e608fe7366d5a3041e462e3322d5b10d
@@ -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
- }
@@ -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
- });