Files
get-shit-done/tests/analyze-dependencies.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

52 lines
2.2 KiB
JavaScript

const { test, describe, beforeEach, afterEach } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
describe('analyze-dependencies command', () => {
test('command file exists', () => {
const p = path.join(__dirname, '..', 'commands', 'gsd', 'analyze-dependencies.md');
assert.ok(fs.existsSync(p), 'commands/gsd/analyze-dependencies.md should exist');
});
test('command file has description frontmatter', () => {
const p = path.join(__dirname, '..', 'commands', 'gsd', 'analyze-dependencies.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('description:'), 'Command file must have description frontmatter');
});
test('workflow file exists', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'analyze-dependencies.md');
assert.ok(fs.existsSync(p), 'workflows/analyze-dependencies.md should exist');
});
test('workflow describes dependency analysis approach', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'analyze-dependencies.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('ROADMAP') || content.includes('phase'),
'workflow should reference ROADMAP.md/phases');
assert.ok(
content.includes('depends') || content.includes('Depends') || content.includes('dependency'),
'workflow should reference dependency detection'
);
});
test('workflow mentions file overlap detection', () => {
const p = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'analyze-dependencies.md');
const content = fs.readFileSync(p, 'utf-8');
assert.ok(
content.includes('file') && (content.includes('overlap') || content.includes('conflict')),
'workflow should mention file overlap/conflict detection'
);
});
test('docs/COMMANDS.md references analyze-dependencies', () => {
const p = path.join(__dirname, '..', 'docs', 'COMMANDS.md');
if (fs.existsSync(p)) {
const content = fs.readFileSync(p, 'utf-8');
assert.ok(content.includes('analyze-dependencies'),
'COMMANDS.md should document the new command');
}
});
});