mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
fix(ci): cross-platform test runner for Windows glob expansion
npm scripts pass `tests/*.test.cjs` to node/c8 as a literal string on Windows (PowerShell/cmd don't expand globs). Adding `shell: bash` to CI steps doesn't help because c8 spawns node as a child process using the system shell. Use a Node script to enumerate test files cross-platform. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
25
scripts/run-tests.cjs
Normal file
25
scripts/run-tests.cjs
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/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).
|
||||
'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' });
|
||||
} catch (err) {
|
||||
process.exit(err.status || 1);
|
||||
}
|
||||
Reference in New Issue
Block a user