Files
get-shit-done/tests/methodology-artifact.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

138 lines
5.6 KiB
JavaScript

'use strict';
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const ROOT = path.join(__dirname, '..');
const REFERENCES_DIR = path.join(ROOT, 'get-shit-done', 'references');
const WORKFLOWS_DIR = path.join(ROOT, 'get-shit-done', 'workflows');
describe('methodology artifact type (#1488)', () => {
// -------------------------------------------------------------------------
// artifact-types.md existence and structure
// -------------------------------------------------------------------------
let artifactTypesContent;
test('artifact-types.md exists in get-shit-done/references/', () => {
const p = path.join(REFERENCES_DIR, 'artifact-types.md');
assert.ok(fs.existsSync(p), 'get-shit-done/references/artifact-types.md must exist');
artifactTypesContent = fs.readFileSync(p, 'utf-8');
});
test('artifact-types.md documents the methodology artifact type', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('methodology') || artifactTypesContent.includes('Methodology'),
'artifact-types.md must document the methodology artifact type'
);
});
test('methodology artifact has shape documented (standing reference)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('Standing reference') ||
artifactTypesContent.includes('standing reference') ||
artifactTypesContent.includes('reusable interpretive') ||
artifactTypesContent.includes('interpretive framework'),
'methodology artifact must have shape documented as standing reference / interpretive framework'
);
});
test('methodology artifact has lifecycle documented (Created → Active → Superseded)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('Superseded') || artifactTypesContent.includes('superseded'),
'methodology artifact lifecycle must include Superseded state'
);
assert.ok(
artifactTypesContent.includes('Active') || artifactTypesContent.includes('active'),
'methodology artifact lifecycle must include Active state'
);
});
test('methodology artifact has location documented (.planning/METHODOLOGY.md)', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.includes('METHODOLOGY.md'),
'artifact-types.md must document .planning/METHODOLOGY.md as the location'
);
});
test('methodology artifact documents what it is consumed by', () => {
artifactTypesContent = artifactTypesContent || fs.readFileSync(
path.join(REFERENCES_DIR, 'artifact-types.md'), 'utf-8'
);
assert.ok(
artifactTypesContent.toLowerCase().includes('consumed by') ||
artifactTypesContent.toLowerCase().includes('consumption'),
'methodology artifact must document its consumption mechanism'
);
});
// -------------------------------------------------------------------------
// Consumption in discuss-phase-assumptions.md
// -------------------------------------------------------------------------
let discussContent;
test('discuss-phase-assumptions.md exists', () => {
const p = path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md');
assert.ok(fs.existsSync(p), 'discuss-phase-assumptions.md must exist');
discussContent = fs.readFileSync(p, 'utf-8');
});
test('discuss-phase-assumptions.md references METHODOLOGY.md as consumable artifact', () => {
discussContent = discussContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md'), 'utf-8'
);
assert.ok(
discussContent.includes('METHODOLOGY.md'),
'discuss-phase-assumptions.md must reference METHODOLOGY.md as a consumable artifact'
);
});
test('discuss-phase-assumptions.md reads METHODOLOGY.md when it exists', () => {
discussContent = discussContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'discuss-phase-assumptions.md'), 'utf-8'
);
assert.ok(
discussContent.includes('METHODOLOGY.md') &&
(discussContent.includes('if it exists') ||
discussContent.includes('2>/dev/null') ||
discussContent.includes('cat .planning/METHODOLOGY') ||
discussContent.includes('exists') ||
discussContent.includes('lenses')),
'discuss-phase-assumptions.md must conditionally read METHODOLOGY.md and apply lenses'
);
});
// -------------------------------------------------------------------------
// Consumption in pause-work.md Required Reading section
// -------------------------------------------------------------------------
let pauseContent;
test('pause-work.md exists', () => {
const p = path.join(WORKFLOWS_DIR, 'pause-work.md');
assert.ok(fs.existsSync(p), 'pause-work.md must exist');
pauseContent = fs.readFileSync(p, 'utf-8');
});
test('pause-work.md Required Reading template includes METHODOLOGY.md', () => {
pauseContent = pauseContent || fs.readFileSync(
path.join(WORKFLOWS_DIR, 'pause-work.md'), 'utf-8'
);
assert.ok(
pauseContent.includes('METHODOLOGY.md'),
'pause-work.md Required Reading template must include METHODOLOGY.md so new sessions inherit the methodology'
);
});
});