Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit b7941aa

Browse files
committed
mobile: patch detox to not crash on attached Android device
See issue wix/Detox#4396 for more info PR of this patch available at wix/Detox#4421 Remove this patch once the PR is merged or an alternative fix is applied!
1 parent abea88d commit b7941aa

File tree

3 files changed

+318
-0
lines changed

3 files changed

+318
-0
lines changed

mobile/package-lock.json

Lines changed: 303 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mobile/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.0",
44
"main": "node_modules/expo/AppEntry.js",
55
"scripts": {
6+
"postinstall": "patch-package",
67
"start": "expo start",
78
"android": "expo run:android",
89
"ios": "expo run:ios",
@@ -54,6 +55,7 @@
5455
"eslint": "^8.57.0",
5556
"eslint-config-universe": "^12.0.0",
5657
"jest": "^29.7.0",
58+
"patch-package": "^8.0.0",
5759
"prettier": "^3.2.5",
5860
"typescript": "^5.4.3",
5961
"typescript-eslint": "^7.4.0"

mobile/patches/detox+20.19.4.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/detox/src/devices/common/drivers/android/exec/ADB.js b/node_modules/detox/src/devices/common/drivers/android/exec/ADB.js
2+
index 3600972..28b03e1 100644
3+
--- a/node_modules/detox/src/devices/common/drivers/android/exec/ADB.js
4+
+++ b/node_modules/detox/src/devices/common/drivers/android/exec/ADB.js
5+
@@ -96,7 +96,7 @@ class ADB {
6+
}
7+
8+
async isPackageInstalled(deviceId, packageId) {
9+
- const output = await this.shell(deviceId, `pm list packages ${packageId}`);
10+
+ const output = await this.shell(deviceId, `pm list packages --user 0 ${packageId}`);
11+
const packageRegexp = new RegExp(`^package:${escape.inQuotedRegexp(packageId)}$`, 'm');
12+
const isInstalled = packageRegexp.test(output);
13+

0 commit comments

Comments
 (0)