Files
get-shit-done/tests/quick-commit-boundary.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

54 lines
1.7 KiB
JavaScript

/**
* GSD Quick Workflow — Commit Boundary Tests (#1503)
*
* Validates that the quick workflow correctly separates executor
* responsibilities (code commits) from orchestrator responsibilities
* (docs artifact commit), preventing PLAN.md from being left untracked
* when the executor runs without worktree isolation.
*/
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('quick workflow commit boundary (#1503)', () => {
const quickPath = path.join(WORKFLOWS_DIR, 'quick.md');
let content;
test('quick.md exists', () => {
assert.ok(fs.existsSync(quickPath), 'workflows/quick.md should exist');
content = fs.readFileSync(quickPath, 'utf-8');
});
test('executor constraints prohibit committing docs artifacts', () => {
assert.ok(
content.includes('Do NOT commit docs artifacts'),
'executor constraints should prohibit committing SUMMARY.md, STATE.md, PLAN.md'
);
});
test('Step 8 explicitly stages artifacts with git add before commit', () => {
assert.ok(
content.includes('git add ${file_list}'),
'Step 8 should explicitly git add the file list before gsd-tools commit'
);
});
test('Step 8 includes PLAN.md in file list', () => {
assert.ok(
content.includes('${QUICK_DIR}/${quick_id}-PLAN.md'),
'Step 8 file list must include PLAN.md'
);
});
test('Step 8 runs unconditionally', () => {
assert.ok(
content.includes('MUST always run'),
'Step 8 should state it must always run regardless of executor commits'
);
});
});