test(#4513): migrate git plumbing batch to named timeout constants
Batch 2 of the ad hoc timeout literal migration (epic #4445). Replaces every bare numeric timeout/timeoutMs object-literal property in tests/git-base-branch.test.cjs, tests/commit-files-pathspec.test.cjs, and tests/git-fixture.test.cjs with a named constant, per eslint-rules/no-adhoc-timeout-literal.cjs. Removes the 3 files from the rule's allowlist. This batch introduces a violation shape not seen in Batch 1: several sites are pinned-value test assertions verifying the EXACT timeout production code hardcodes (not bounds on this suite's own subprocess calls). Named as four separate constants even where values coincide, so the tests keep catching independent production drift instead of silently tolerating it. No src/bin file touched, no numeric value changed anywhere -- verified site-by-site by two independent isolated review passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,15 @@ const runGitSpy = mock.method(processSeam, 'runGit');
|
||||
after(() => mock.restoreAll());
|
||||
|
||||
const { gitOrThrow, throwIfFailed, toLegacyResult, DEFAULT_GIT_TIMEOUT_MS } = require('./helpers/git-fixture.cjs');
|
||||
|
||||
/**
|
||||
* Deliberately NOT DEFAULT_GIT_TIMEOUT_MS or any real class norm — chosen
|
||||
* specifically to differ from it, to prove gitOrThrow's timeoutMs override
|
||||
* plumbing actually threads a caller-supplied value through rather than
|
||||
* silently keeping the default. See the E11 test's own
|
||||
* assert.notEqual(..., DEFAULT_GIT_TIMEOUT_MS) a few lines below.
|
||||
*/
|
||||
const ARBITRARY_OVERRIDE_TIMEOUT_MS = 12345;
|
||||
const { createTempDir, cleanup } = require('./helpers.cjs');
|
||||
|
||||
/**
|
||||
@@ -161,10 +170,10 @@ describe('git-fixture: E — gitOrThrow', () => {
|
||||
|
||||
test('E11: explicit timeoutMs overrides the default', () => {
|
||||
runGitSpy.mock.resetCalls();
|
||||
gitOrThrow(['--version'], { cwd: dir, timeoutMs: 12345 });
|
||||
gitOrThrow(['--version'], { cwd: dir, timeoutMs: ARBITRARY_OVERRIDE_TIMEOUT_MS });
|
||||
assert.equal(runGitSpy.mock.calls.length, 1);
|
||||
assert.equal(runGitSpy.mock.calls[0].arguments[1].timeoutMs, 12345);
|
||||
assert.notEqual(12345, DEFAULT_GIT_TIMEOUT_MS);
|
||||
assert.equal(runGitSpy.mock.calls[0].arguments[1].timeoutMs, ARBITRARY_OVERRIDE_TIMEOUT_MS);
|
||||
assert.notEqual(ARBITRARY_OVERRIDE_TIMEOUT_MS, DEFAULT_GIT_TIMEOUT_MS);
|
||||
});
|
||||
|
||||
test('E12: shell-string args are rejected', () => {
|
||||
|
||||
Reference in New Issue
Block a user