Batch 11 of the ad hoc timeout literal migration (epic #4445). Replaces every bare numeric timeout/timeoutMs object-literal property in tests/state-document.test.cjs, tests/phase.test.cjs, tests/commands.test.cjs, tests/pattern.test.cjs, tests/adr-612-bracket-coherence.test.cjs, tests/adr-612-bracket-read-tolerance.test.cjs, tests/milestone-lock.test.cjs, tests/init.test.cjs, tests/state-todos-render.test.cjs, tests/quick-batch.test.cjs, tests/graphify.test.cjs, and tests/effort-surface-axis.test.cjs with a named constant, per eslint-rules/no-adhoc-timeout-literal.cjs. Removes these 12 files from the rule's allowlist. Ground truth via eslint found 25 sites, not the issue's stated 24 (phase.test.cjs has 5, not 4) -- disclosed in the PR body. Reuses PROBE_TIMEOUT_MS, GIT_TIMEOUT_MS, and LOOP_HOOK_POINT_CLI_TIMEOUT_MS across 8 files. Adds two new shared constants to tests/helpers/timeouts.cjs (each independently arrived at by 2 files in this batch, crossing the promotion bar): PATHOLOGICAL_INPUT_TEST_TIMEOUT_MS (node:test's own per-test timeout option, not a subprocess bound) and GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS (a single gsd-tools.cjs CLI subcommand spawn, distinct tier from PROBE_TIMEOUT_MS/LOOP_HOOK_POINT_CLI_TIMEOUT_MS). Adds 3 file-local constants for values used by only 1 file in this batch. No src/bin file touched, no numeric value changed anywhere. Co-authored-by: sim <sim@local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,15 @@ const fc = require('./helpers/fast-check-setup.cjs');
|
||||
|
||||
const { escapeRegex, literalPattern, compileUserPattern, MAX_USER_PATTERN_LEN } = require('../gsd-core/bin/lib/pattern.cjs');
|
||||
|
||||
/**
|
||||
* A single `node -e` inline probe script testing RegExp.escape fallback
|
||||
* semantics -- one subprocess, no fan-out. Coincides numerically with
|
||||
* tests/helpers/timeouts.cjs's GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS but
|
||||
* describes a different operation (an inline node -e probe, not a
|
||||
* gsd-tools.cjs CLI subcommand spawn) -- kept local.
|
||||
*/
|
||||
const REGEXP_ESCAPE_PROBE_TIMEOUT_MS = 30_000;
|
||||
|
||||
// ─── Section 1: escapeRegex — rows 1-10 ───────────────────────────────────
|
||||
|
||||
describe('escapeRegex', () => {
|
||||
@@ -231,7 +240,7 @@ describe('escapeRegex without RegExp.escape (#3498 Node-22 fallback)', () => {
|
||||
].join('\n');
|
||||
|
||||
test('builds and escapes correctly when RegExp.escape is absent (Node 22 semantics)', () => {
|
||||
const r = runNode(['-e', PROBE], { timeoutMs: 30_000 });
|
||||
const r = runNode(['-e', PROBE], { timeoutMs: REGEXP_ESCAPE_PROBE_TIMEOUT_MS });
|
||||
assert.strictEqual(r.outcome, OUTCOME.EXITED, `probe must run: ${r.stderr}`);
|
||||
assert.strictEqual(r.exitCode, 0, `fallback path failed: ${r.stdout}\n${r.stderr}`);
|
||||
assert.match(r.stdout, /fallback-ok/);
|
||||
@@ -244,7 +253,7 @@ describe('escapeRegex without RegExp.escape (#3498 Node-22 fallback)', () => {
|
||||
"if (!new RegExp(escapeRegex('a.b')).test('a.b')) { console.error('post-load neuter broke escaping'); process.exit(1); }",
|
||||
"console.log('capture-ok');",
|
||||
].join('\n');
|
||||
const r = runNode(['-e', PROBE2], { timeoutMs: 30_000 });
|
||||
const r = runNode(['-e', PROBE2], { timeoutMs: REGEXP_ESCAPE_PROBE_TIMEOUT_MS });
|
||||
assert.strictEqual(r.outcome, OUTCOME.EXITED, `probe must run: ${r.stderr}`);
|
||||
assert.strictEqual(r.exitCode, 0, `post-load capture failed: ${r.stdout}\n${r.stderr}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user