Files
get-shit-done/tests/worktree-stagger.test.cjs
Tom Boucher 2703422be8 refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md (#1675)
* 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>
2026-04-04 14:29:03 -04:00

50 lines
1.7 KiB
JavaScript

/**
* GSD Worktree Sequential Dispatch Tests
*
* Validates that execute-phase workflow includes sequential dispatch
* instructions to prevent git config.lock contention when multiple
* agents create worktrees in parallel within the same wave.
*
* See: https://github.com/gsd-build/get-shit-done/issues/1511
*/
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const WORKFLOWS_DIR = path.join(__dirname, '..', 'get-shit-done', 'workflows');
describe('worktree sequential dispatch', () => {
const executePhasePath = path.join(WORKFLOWS_DIR, 'execute-phase.md');
let content;
test('execute-phase.md exists', () => {
assert.ok(fs.existsSync(executePhasePath), 'execute-phase.md should exist');
});
test('execute-phase explains git config.lock contention', () => {
content = fs.readFileSync(executePhasePath, 'utf-8');
assert.ok(
content.includes('config.lock'),
'execute-phase.md should explain the git config.lock race condition'
);
});
test('execute-phase requires sequential dispatch with run_in_background', () => {
content = content || fs.readFileSync(executePhasePath, 'utf-8');
assert.ok(
content.includes('run_in_background'),
'execute-phase.md should instruct one-at-a-time dispatch with run_in_background'
);
});
test('execute-phase warns against multiple Task calls in single message', () => {
content = content || fs.readFileSync(executePhasePath, 'utf-8');
assert.ok(
content.includes('WRONG') && content.includes('single message'),
'execute-phase.md should warn against sending multiple Task() calls simultaneously'
);
});
});