@@ -17,11 +17,11 @@ import { device } from 'detox';
1717// 压缩存储,AssetManager 读出的解压字节必须等于 CLI 解包提取的条目字节。
1818const IOS_APP_PATH = path . resolve (
1919 __dirname ,
20- '../ios/build/Build/Products/Release-iphonesimulator/AwesomeProject.app' ,
20+ '../ios/build/Build/Products/Release-iphonesimulator/AwesomeProject.app'
2121) ;
2222const ANDROID_APK_PATH = path . resolve (
2323 __dirname ,
24- '../android/app/build/outputs/apk/release/app-release.apk' ,
24+ '../android/app/build/outputs/apk/release/app-release.apk'
2525) ;
2626const IOS_DEFAULTS_KEY = 'REACTNATIVECN_PUSHY_BUNDLEHASH_KEY' ;
2727const ANDROID_PREFS_KEY = 'bundleHashCache' ;
@@ -40,20 +40,20 @@ function extractHash(raw: string): string | null {
4040
4141function readIosCachedBundleHash (
4242 udid : string ,
43- bundleId : string ,
43+ bundleId : string
4444) : string | null {
4545 try {
4646 // app 容器的 NSUserDefaults 对 `simctl spawn defaults read` 不可见,
4747 // 必须定位容器后直接读 plist。
4848 const container = execSync (
4949 `xcrun simctl get_app_container ${ udid } ${ bundleId } data` ,
50- { stdio : [ 'ignore' , 'pipe' , 'ignore' ] } ,
50+ { stdio : [ 'ignore' , 'pipe' , 'ignore' ] }
5151 )
5252 . toString ( )
5353 . trim ( ) ;
5454 const raw = execSync (
5555 `plutil -extract ${ IOS_DEFAULTS_KEY } raw -o - "${ container } /Library/Preferences/${ bundleId } .plist"` ,
56- { stdio : [ 'ignore' , 'pipe' , 'ignore' ] } ,
56+ { stdio : [ 'ignore' , 'pipe' , 'ignore' ] }
5757 )
5858 . toString ( )
5959 . trim ( ) ;
@@ -68,7 +68,7 @@ let adbRooted = false;
6868
6969function readAndroidCachedBundleHash (
7070 adbName : string ,
71- packageName : string ,
71+ packageName : string
7272) : string | null {
7373 // release 包不可 run-as;模拟器(AOSP/Google APIs 镜像)上 adb root 后可
7474 // 直读 SharedPreferences xml。root 一次即可,幂等;Google Play 镜像会拒绝,
@@ -96,7 +96,7 @@ function readAndroidCachedBundleHash(
9696 stdio : [ 'ignore' , 'pipe' , 'ignore' ] ,
9797 } ) . toString ( ) ;
9898 const match = xml . match (
99- new RegExp ( `name="${ ANDROID_PREFS_KEY } "[^>]*>([^<]+)<` ) ,
99+ new RegExp ( `name="${ ANDROID_PREFS_KEY } "[^>]*>([^<]+)<` )
100100 ) ;
101101 if ( match ) {
102102 return extractHash ( match [ 1 ] ) ;
@@ -126,7 +126,7 @@ describe('bundleHash content identity', () => {
126126 }
127127 expected = sha256Hex ( readFileSync ( bundlePath ) ) ;
128128 const bundleId = execSync (
129- `/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${ IOS_APP_PATH } /Info.plist"` ,
129+ `/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${ IOS_APP_PATH } /Info.plist"`
130130 )
131131 . toString ( )
132132 . trim ( ) ;
@@ -140,7 +140,7 @@ describe('bundleHash content identity', () => {
140140 expected = sha256Hex (
141141 execSync ( `unzip -p "${ ANDROID_APK_PATH } " assets/index.android.bundle` , {
142142 maxBuffer : 256 * 1024 * 1024 ,
143- } ) ,
143+ } )
144144 ) ;
145145 // applicationId 固定(android/app/build.gradle),无需解析二进制 manifest
146146 readActual = ( ) =>
@@ -157,7 +157,7 @@ describe('bundleHash content identity', () => {
157157 // 进程即可;数据被 init 重装清空,恰好覆盖"全新安装首次计算"路径。
158158 execSync (
159159 `adb -s ${ device . id } shell monkey -p com.awesomeproject -c android.intent.category.LAUNCHER 1` ,
160- { stdio : [ 'ignore' , 'ignore' , 'ignore' ] } ,
160+ { stdio : [ 'ignore' , 'ignore' , 'ignore' ] }
161161 ) ;
162162 } else {
163163 await device . launchApp ( { newInstance : true } ) ;
@@ -177,15 +177,15 @@ describe('bundleHash content identity', () => {
177177 if ( ! actual ) {
178178 throw new Error (
179179 `native bundleHash was not cached within ${ POLL_TIMEOUT_MS } ms — ` +
180- 'is the JS prefetch (core.ts) running and the native method present?' ,
180+ 'is the JS prefetch (core.ts) running and the native method present?'
181181 ) ;
182182 }
183183 // 显式比较:detox 的 jest 环境把全局 expect 换成了元素断言版,不能对普通
184184 // 值用 .toBe。
185185 if ( actual !== expected ) {
186186 throw new Error (
187187 `bundleHash mismatch — native computed ${ actual } , ` +
188- `sha256 of the embedded bundle is ${ expected } ` ,
188+ `sha256 of the embedded bundle is ${ expected } `
189189 ) ;
190190 }
191191 } ) ;
0 commit comments