#!/usr/bin/env node // Cross-platform test runner — resolves test file globs via Node // instead of relying on shell expansion (which fails on Windows PowerShell/cmd). // Propagates NODE_V8_COVERAGE so c8 collects coverage from the child process. 'use strict'; const { readdirSync } = require('fs'); const { join } = require('path'); const { execFileSync } = require('child_process'); const testDir = join(__dirname, '..', 'tests'); const files = readdirSync(testDir) .filter(f => f.endsWith('.test.cjs')) .sort() .map(f => join('tests', f)); if (files.length === 0) { console.error('No test files found in tests/'); process.exit(1); } const concurrency = process.env.TEST_CONCURRENCY ? `--test-concurrency=${process.env.TEST_CONCURRENCY}` : '--test-concurrency=4'; try { execFileSync(process.execPath, ['--test', concurrency, ...files], { stdio: 'inherit', env: { ...process.env }, }); } catch (err) { process.exit(err.status || 1); }