收口原生壳未声明能力覆盖

移动壳测试从共享 HostBridge method 和 iOS capability profile 派生未声明 method 覆盖

原生壳门禁反查 H5 native request 能力统一 helper 门控和移动壳派生测试

架构文档补齐移动端和桌面端 file.importText 能力清单与未声明 method 规则
This commit is contained in:
2026-06-20 03:43:04 +08:00
parent 74567e8bb3
commit 79708e69b2
6 changed files with 39 additions and 12 deletions
@@ -14,6 +14,8 @@ const appearancePath = new URL('../src/host-bridge/appearance.ts', import.meta.u
const appearanceSource = fs.readFileSync(appearancePath, 'utf8');
const bridgePath = new URL('../src/host-bridge/bridge.ts', import.meta.url);
const bridgeSource = fs.readFileSync(bridgePath, 'utf8');
const bridgeTestPath = new URL('../src/host-bridge/bridge.test.ts', import.meta.url);
const bridgeTestSource = fs.readFileSync(bridgeTestPath, 'utf8');
const badgePath = new URL('../src/host-bridge/badge.ts', import.meta.url);
const badgeSource = fs.readFileSync(badgePath, 'utf8');
const clipboardPath = new URL('../src/host-bridge/clipboard.ts', import.meta.url);
@@ -817,6 +819,21 @@ if (
throw new Error('mobile shell must not redeclare HostBridge capability profiles');
}
for (const snippet of [
'HOST_BRIDGE_METHODS',
'HOST_BRIDGE_EXPO_MOBILE_IOS_CAPABILITIES',
'const IOS_UNDECLARED_HOST_BRIDGE_METHODS = HOST_BRIDGE_METHODS.filter(',
'(method) => !HOST_BRIDGE_EXPO_MOBILE_IOS_CAPABILITIES.includes(method)',
'test.each(IOS_UNDECLARED_HOST_BRIDGE_METHODS)',
"expect(failedResponse.error.code).toBe('unsupported_method')",
]) {
if (!bridgeTestSource.includes(snippet)) {
throw new Error(
`mobile shell bridge tests must derive unsupported method coverage from shared profiles: ${snippet}`,
);
}
}
const unknownSharedEvents = sharedEvents.filter(
(eventName) => !sharedCapabilities.includes(eventName),
);