|
1 | 1 | #!/usr/bin/env node |
2 | | -// The full gate: web tests, build, server tests, fixture and asset checks. |
| 2 | +// The full gate: web tests and build (which type-checks web), the server and scripts type-check, |
| 3 | +// server tests, fixture and asset checks. Any non-zero exit fails it (tsrs exits 2 on type errors). |
3 | 4 | import { spawnSync } from 'node:child_process'; |
4 | 5 | import { readdirSync } from 'node:fs'; |
5 | 6 | import { fileURLToPath } from 'node:url'; |
6 | 7 | import path from 'node:path'; |
7 | 8 |
|
8 | 9 | const root = fileURLToPath(new URL('../', import.meta.url)); |
9 | | -const run = (command, args, cwd = root) => { const { status } = spawnSync(command, args, { cwd, stdio: 'inherit' }); if (status !== 0) process.exit(status ?? 1); }; |
| 10 | +const run = (command: string, args: string[], cwd = root) => { const { status } = spawnSync(command, args, { cwd, stdio: 'inherit' }); if (status !== 0) process.exit(status ?? 1); }; |
10 | 11 | run('npm', ['test'], path.join(root, 'web')); |
11 | 12 | run('npm', ['run', 'build'], path.join(root, 'web')); |
| 13 | +run('npm', ['run', 'typecheck'], path.join(root, 'server')); |
| 14 | +// Guard: stable tsc (7.0) too. tsrs follows TypeScript 7.1, which infers destructured parameters with a |
| 15 | +// `= {}` default differently (https://github.com/microsoft/TypeScript/issues/64431) and so misses some |
| 16 | +// errors 7.0 reports. Remove this line once that is fixed upstream and tsrs picks it up. |
| 17 | +run('npm', ['run', 'typecheck:stable'], path.join(root, 'server')); |
12 | 18 | run('node', ['--test', ...readdirSync(path.join(root, 'server')).filter((name) => name.endsWith('.test.mts'))], path.join(root, 'server')); |
13 | 19 | run('node', ['--test', 'scripts/fixture.test.mts']); |
14 | 20 | run('node', ['--test', 'scripts/verify-assets.test.mts']); |
|
0 commit comments