-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.mjs
More file actions
33 lines (25 loc) · 771 Bytes
/
run-tests.mjs
File metadata and controls
33 lines (25 loc) · 771 Bytes
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
// SPDX-License-Identifier: PMPL-1.0-or-later
// Test runner for UbiCity
import { run } from 'node:test';
import { spec as specReporter } from 'node:test/reporters';
import { glob } from 'glob';
async function runTests() {
// Find all test files
const testFiles = await glob('test/**/*.test.mjs');
console.log(`\n🧪 Running ${testFiles.length} test files...\n`);
// Run tests with spec reporter
const stream = run({
files: testFiles,
concurrency: true,
});
stream.compose(specReporter).pipe(process.stdout);
// Wait for completion and exit with appropriate code
let failed = false;
for await (const event of stream) {
if (event.type === 'test:fail') {
failed = true;
}
}
process.exit(failed ? 1 : 0);
}
runTests();