mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
117cf4ff68
* test(ios): fix nightly fixture selector drift * test(ios): harden fixture selector coverage
29 lines
873 B
TypeScript
29 lines
873 B
TypeScript
export function findMissingFixtureIdentifiers(
|
|
fixtureSources: readonly string[],
|
|
liveScenarioSources: readonly string[],
|
|
): string[] {
|
|
const fixtureIdentifiers = new Set(
|
|
fixtureSources.flatMap((source) =>
|
|
[...source.matchAll(/\btestID="([^"]+)"/g)].map((match) => match[1]),
|
|
),
|
|
);
|
|
const liveScenarioIdentifiers = new Set(
|
|
liveScenarioSources.flatMap(extractLiteralFixtureIdentifiers),
|
|
);
|
|
|
|
return [...liveScenarioIdentifiers]
|
|
.filter((identifier) => !fixtureIdentifiers.has(identifier))
|
|
.sort();
|
|
}
|
|
|
|
function extractLiteralFixtureIdentifiers(source: string): string[] {
|
|
return [
|
|
...[...source.matchAll(/\bid=(["'])([^"'$]+)\1/g)].flatMap((match) =>
|
|
match[2] ? [match[2]] : [],
|
|
),
|
|
...[...source.matchAll(/\bidentifier\s*===\s*(["'])([^"']+)\1/g)].flatMap((match) =>
|
|
match[2] ? [match[2]] : [],
|
|
),
|
|
];
|
|
}
|