-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathcollector.ts
More file actions
19 lines (14 loc) · 692 Bytes
/
collector.ts
File metadata and controls
19 lines (14 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/** @file This needs to be in a separate file so it can bee tree-shaken before being published, while still being importable by tests */
export const testableUrls = new Map<string, string[]>();
export function addTests(test: string, urls: string[]): void {
TEST: testableUrls.set(test, urls);
}
export function getTests(detectName: string): string[] {
if (detectName === 'combinedTestOnly') {
return ['combinedTestOnly'];
}
return testableUrls.get(detectName)?.flatMap(url => url.startsWith('http') ? url : getTests(url) ?? []) ?? [];
}
export function getAllUrls(): Set<string> {
return new Set<string>([...testableUrls.values()].flat().filter(url => url.startsWith('http')));
}