修复原生壳 CI 格式化兼容
Project CI / Frontend tests (push) Successful in 3m44s
Project CI / Repository checks (push) Successful in 3m1s
Project CI / Backend tests (push) Successful in 7m54s
Project CI / Native shell tests (push) Failing after 17m32s

放宽移动壳能力数组导出解析的空白匹配

兼容格式化后的移动壳源码断言换行

放宽桌面壳能力数组导出解析的空白匹配
This commit is contained in:
2026-09-01 17:00:44 +08:00
parent 669405c8b8
commit b489244e03
2 changed files with 21 additions and 7 deletions
+1 -1
View File
@@ -1005,7 +1005,7 @@ function extractStringArrayExport(source, exportName, seen = new Set()) {
}
const match = source.match(
new RegExp(`export const ${exportName}[^=]*= \\[([\\s\\S]*?)\\][^;]*;`),
new RegExp(`export const ${exportName}[^=]*=\\s*\\[([\\s\\S]*?)\\][^;]*;`),
);
if (!match) {
throw new Error(`unable to read ${exportName}`);
+20 -6
View File
@@ -479,7 +479,7 @@ function extractStringArrayExport(source, exportName, seen = new Set()) {
}
const match = source.match(
new RegExp(`export const ${exportName}[^=]*= \\[([\\s\\S]*?)\\][^;]*;`),
new RegExp(`export const ${exportName}[^=]*=\\s*\\[([\\s\\S]*?)\\][^;]*;`),
);
if (!match) {
throw new Error(`unable to read ${exportName}`);
@@ -499,6 +499,18 @@ function extractStringArrayExport(source, exportName, seen = new Set()) {
return entries;
}
function sourceIncludes(source, snippet) {
if (source.includes(snippet)) {
return true;
}
const compact = (value) =>
value
.replace(/\s+/g, ' ')
.replace(/\s*([()[\]{}])\s*/g, '$1')
.replace(/,\)/g, ')');
return compact(source).includes(compact(snippet));
}
function extractStringConstExport(source, exportName) {
const match = source.match(
new RegExp(`export const ${exportName}\\s*=\\s*'([^']+)';`),
@@ -1844,7 +1856,8 @@ for (const snippet of [
'thirdPartyCookiesEnabled={false}',
'sharedCookiesEnabled={false}',
'webviewDebuggingEnabled={false}',
'injectedJavaScriptBeforeContentLoaded={MOBILE_WEBVIEW_BEFORE_CONTENT_SCRIPT}',
'injectedJavaScriptBeforeContentLoaded={',
'MOBILE_WEBVIEW_BEFORE_CONTENT_SCRIPT',
'handleBlockedFileDownload',
'logMobileShellDownloadBlocked(event)',
'onFileDownload={handleBlockedFileDownload}',
@@ -1853,7 +1866,7 @@ for (const snippet of [
'mobile shell navigation failed for',
'external_navigation.open',
]) {
if (!shellAppSource.includes(snippet)) {
if (!sourceIncludes(shellAppSource, snippet)) {
throw new Error(`mobile shell ShellApp missing ${snippet}`);
}
}
@@ -3056,7 +3069,8 @@ if (
!hapticsSource.includes(
'(request.payload as HapticsImpactPayload | undefined)?.style',
) ||
!hapticsSource.includes(
!sourceIncludes(
hapticsSource,
"invalidRequest('haptics impact style must be light, medium, or heavy')",
) ||
!hapticsSource.includes('Haptics.ImpactFeedbackStyle.Heavy') ||
@@ -3317,7 +3331,7 @@ for (const snippet of [
"not.toContain('app.setBadgeCount')",
"expect(getMobileRuntimePlatform()).toBe('android')",
]) {
if (!hostBridgeRuntimeTestSource.includes(snippet)) {
if (!sourceIncludes(hostBridgeRuntimeTestSource, snippet)) {
throw new Error(`mobile shell runtime tests missing ${snippet}`);
}
}
@@ -3423,7 +3437,7 @@ for (const snippet of [
"not.toContain('auth.requestLogin')",
"not.toContain('payment.request')",
]) {
if (!capabilitiesTestSource.includes(snippet)) {
if (!sourceIncludes(capabilitiesTestSource, snippet)) {
throw new Error(`mobile shell capability profile test missing ${snippet}`);
}
}