-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-tests.mjs
116 lines (95 loc) · 2.94 KB
/
run-tests.mjs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import path from 'path';
import { resultsAsHTML } from "./lib/results-as-html.mjs";
import { testCommunityCSSSources } from './lib/test-community-css-sources.mjs';
import { testFeatures } from "./lib/test-feature.mjs";
import { traverseDir } from "./lib/traverse-dir.mjs";
{
const testGroups = new Map();
const tests = new Set();
const testFiles = new Set(await traverseDir('./tests'));
for (const testFile of testFiles) {
const testFileParsed = path.parse(testFile);
const testDirParsed = path.parse(testFileParsed.dir);
const testGroupName = path.parse(testDirParsed.dir).base;
const test = path.join(testGroupName, testDirParsed.base);
{
if (tests.has(test)) {
continue;
}
tests.add(test);
}
if (
testFiles.has(path.join(testFileParsed.dir, 'source.css')) &&
testFiles.has(path.join(testFileParsed.dir, 'tokens.json'))
) {
const testGroup = testGroups.get(testGroupName) ?? {
name: testGroupName,
tests: []
};
testGroup.tests.push(test);
testGroups.set(testGroupName, testGroup);
}
}
const results = await testFeatures(Array.from(testGroups.values()));
await resultsAsHTML(results, 'index.html');
}
{
const testGroups = new Map();
const tests = new Set();
const testFiles = new Set(await traverseDir('./tests'));
for (const testFile of testFiles) {
const testFileParsed = path.parse(testFile);
const testDirParsed = path.parse(testFileParsed.dir);
const testGroupName = path.parse(testDirParsed.dir).base;
const test = path.join(testGroupName, testDirParsed.base);
{
if (tests.has(test)) {
continue;
}
tests.add(test);
}
if (
testFiles.has(path.join(testFileParsed.dir, 'source.css')) &&
testFiles.has(path.join(testFileParsed.dir, 'tokens.json'))
) {
const testGroup = testGroups.get(testGroupName) ?? {
name: testGroupName,
tests: []
};
testGroup.tests.push(test);
testGroups.set(testGroupName, testGroup);
}
}
const results = await testFeatures(Array.from(testGroups.values()), true);
await resultsAsHTML(results, 'index-minimal.html');
}
{
const testGroups = new Map();
const tests = new Set();
const testFiles = new Set(await traverseDir('./tests-community'));
for (const testFile of testFiles) {
const testFileParsed = path.parse(testFile);
const testDirParsed = path.parse(testFileParsed.dir);
const testGroupName = path.parse(testDirParsed.dir).base;
const test = path.join(testGroupName, testDirParsed.base);
{
if (tests.has(test)) {
continue;
}
tests.add(test);
}
if (
testFiles.has(path.join(testFileParsed.dir, 'source.css')) &&
testFiles.has(path.join(testFileParsed.dir, 'tokens.json'))
) {
const testGroup = testGroups.get(testGroupName) ?? {
name: testGroupName,
tests: []
};
testGroup.tests.push(test);
testGroups.set(testGroupName, testGroup);
}
}
const results = await testCommunityCSSSources(Array.from(testGroups.values()));
await resultsAsHTML(results, 'community.html');
}