-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathsuite-setup-util.ts
64 lines (56 loc) · 1.88 KB
/
suite-setup-util.ts
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
import { relative, resolve } from 'path';
import execa from 'execa';
function relativeToEmbroiderRoot(absolutePath: string): string {
let embroiderRoot = resolve(__dirname, '../..');
return relative(embroiderRoot, absolutePath);
}
async function githubMatrix() {
let dir = resolve(__dirname, '..', '..', 'tests', 'scenarios');
let { stdout } = await execa(
'scenario-tester',
['list', '--require', 'ts-node/register', '--files', '*-test.ts', '--matrix', 'pnpm run test --filter "/^%s/"'],
{
cwd: dir,
preferLocal: true,
}
);
let { include: suites } = JSON.parse(stdout) as { include: { name: string; command: string }[]; name: string[] };
let include = [
...suites.map(s => ({
name: `${s.name} ubuntu`,
os: 'ubuntu',
command: s.command,
dir,
})),
...suites
.filter(s => s.name !== 'jest-suites') // TODO: jest tests do not work under windows yet
.filter(s => !s.name.includes('watch-mode')) // TODO: watch tests are far too slow on windows right now
.filter(s => !s.name.endsWith('compat-addon-classic-features-virtual-scripts')) // TODO: these tests are too slow on windows right now
.filter(s => !s.name.endsWith('vite-dep-optimizer')) // these tests are absurdly slow on windows
.filter(s => !s.name.endsWith('vite-internals')) // these tests are absurdly slow on windows
.map(s => ({
name: `${s.name} windows`,
os: 'windows',
command: s.command,
dir: relativeToEmbroiderRoot(dir),
})),
];
return {
name: include.map(s => s.name),
include,
};
}
async function main() {
try {
if (process.argv.includes('--matrix')) {
const result = await githubMatrix();
process.stdout.write(JSON.stringify(result));
}
} catch (error) {
console.error(error);
process.exitCode = -1;
}
}
if (require.main === module) {
main();
}