mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
* refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md
- Replace require('node:assert') with require('node:assert/strict') across
all 73 test files to enforce strict equality (no type coercion)
- Replace try/finally cleanup blocks with t.after() hooks in core.test.cjs
and hooks-opt-in.test.cjs per the test lifecycle standards
- Utility functions in codex-config and security-scan retain try/finally
as that is appropriate for per-function resource guards, not lifecycle hooks
Closes #1674
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* perf(tests): add --test-concurrency=4 to test runner for parallel file execution
Node.js --test-concurrency controls how many test files run as parallel child
processes. Set to 4 by default, configurable via TEST_CONCURRENCY env var.
Fixes tests at a known level rather than inheriting os.availableParallelism()
which varies across CI environments.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): allowlist verify.test.cjs in prompt-injection scanner
tests/verify.test.cjs uses <human>...</human> as GSD phase task-type
XML (meaning "a human should verify this step"), which matches the
scanner's fake-message-boundary pattern for LLM APIs. This is a
false positive — add it to the allowlist alongside the other test files
that legitimately contain injection-adjacent patterns.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
971 B
JavaScript
34 lines
971 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);
|
|
}
|
|
|
|
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);
|
|
}
|