Skip to content

Commit 97815ec

Browse files
sunnylqmclaude
andcommitted
style(e2e): apply biome formatting to the e2e sources
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 7afc62e commit 97815ec

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

‎Example/e2etest/e2e/bundle-hash.test.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import { device } from 'detox';
1717
// 压缩存储,AssetManager 读出的解压字节必须等于 CLI 解包提取的条目字节。
1818
const 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
);
2222
const 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
);
2626
const IOS_DEFAULTS_KEY = 'REACTNATIVECN_PUSHY_BUNDLEHASH_KEY';
2727
const ANDROID_PREFS_KEY = 'bundleHashCache';
@@ -40,20 +40,20 @@ function extractHash(raw: string): string | null {
4040

4141
function 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

6969
function 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
});

‎Example/e2etest/scripts/ios-rescue-server.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ const server = Bun.serve({
7272
} else {
7373
response = { upToDate: true };
7474
}
75-
served.push(`${currentHash || '(base)'} -> ${JSON.stringify(response.hash ?? 'upToDate')}`);
76-
console.log(`[checkUpdate] hash=${currentHash || '(base)'} ->`, response.hash ?? 'upToDate');
75+
served.push(
76+
`${currentHash || '(base)'} -> ${JSON.stringify(response.hash ?? 'upToDate')}`
77+
);
78+
console.log(
79+
`[checkUpdate] hash=${currentHash || '(base)'} ->`,
80+
response.hash ?? 'upToDate'
81+
);
7782
return json(response);
7883
}
7984

‎Example/harmony_use_pushy/e2e/entry.diag.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ console.error(
1111
`keys=${JSON.stringify(Object.keys(mod)).slice(0, 300)}`
1212
);
1313
Promise.resolve()
14-
.then(() => (mod.syncNativeConfig as (c: string) => Promise<void>)('{"probe":true}'))
14+
.then(() =>
15+
(mod.syncNativeConfig as (c: string) => Promise<void>)('{"probe":true}')
16+
)
1517
.then(() => console.error('RNU_DIAG direct syncNativeConfig call OK'))
16-
.catch((e: Error) => console.error(`RNU_DIAG direct call failed: ${e.message}`));
18+
.catch((e: Error) =>
19+
console.error(`RNU_DIAG direct call failed: ${e.message}`)
20+
);
1721

1822
AppRegistry.registerComponent(appName, () => App);

0 commit comments

Comments
 (0)