-
Notifications
You must be signed in to change notification settings - Fork 54
/
loader.js
50 lines (36 loc) · 1.25 KB
/
loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { loadFilter } from './test_filter/index.js';
function* concat(lists) {
for (const specs of lists) {
yield* specs;
}
}
class DefaultTestFileLoader {
async listing(suite) {
return (await import(`../suites/${suite}/index.js`)).listing;
}
import(path) {
return import('../suites/' + path);
}
}
export class TestLoader {
constructor(fileLoader = new DefaultTestFileLoader()) {
_defineProperty(this, "fileLoader", void 0);
this.fileLoader = fileLoader;
} // TODO: Test
async loadTestsFromQuery(query) {
return this.loadTests(new URLSearchParams(query).getAll('q'));
} // TODO: Test
// TODO: Probably should actually not exist at all, just use queries on cmd line too.
async loadTestsFromCmdLine(filters) {
return this.loadTests(filters);
}
async loadTests(filters) {
const loads = filters.map(f => loadFilter(this.fileLoader, f));
return concat((await Promise.all(loads)));
}
}
//# sourceMappingURL=loader.js.map