mirror of
https://github.com/cfal/shoes.git
synced 2026-11-06 16:14:11 +00:00
Add advisory selector/reload performance reports, optional Linux unit/process coverage with changed-line summaries, and bounded rule-parser property tests to make regressions and verification gaps easier to spot. Reports reject invalid measurements and account for timing noise without introducing hard performance gates; existing tests and production behavior remain unchanged.
24 lines
1006 B
JavaScript
24 lines
1006 B
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
import test from 'node:test';
|
|
|
|
test('shell guard requires a successful command and nonzero executed tests', t => {
|
|
fs.mkdirSync('.workstream-evidence', { recursive: true });
|
|
const tmp = fs.mkdtempSync(path.resolve('.workstream-evidence/test-guard-'));
|
|
t.after(() => fs.rmSync(tmp, { recursive: true, force: true }));
|
|
for (const [summary, code, expected] of [
|
|
['test result: ok. 1 passed; 0 failed;', 0, 0],
|
|
['test result: ok. 0 passed; 0 failed;', 0, 1],
|
|
['compiled only', 0, 1],
|
|
['test result: ok. 1 passed; 0 failed;', 9, 9],
|
|
]) {
|
|
const result = spawnSync('bash', ['.github/require-tests.sh', process.execPath, '-e',
|
|
`console.log(${JSON.stringify(summary)}); process.exit(${code});`], {
|
|
env: { ...process.env, TMPDIR: tmp }, encoding: 'utf8',
|
|
});
|
|
assert.equal(result.status, expected, result.stderr);
|
|
}
|
|
});
|