mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
The run-tests.cjs child process now inherits NODE_V8_COVERAGE from the parent so c8 collects coverage data. Also restores npm scripts to use the cross-platform runner for both test and test:coverage commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
823 B
JavaScript
30 lines
823 B
JavaScript
#!/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);
|
|
}
|
|
|
|
try {
|
|
execFileSync(process.execPath, ['--test', ...files], {
|
|
stdio: 'inherit',
|
|
env: { ...process.env },
|
|
});
|
|
} catch (err) {
|
|
process.exit(err.status || 1);
|
|
}
|