mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
* 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>
82 lines
2.3 KiB
JavaScript
82 lines
2.3 KiB
JavaScript
/**
|
|
* Cursor conversion regression tests.
|
|
*
|
|
* Ensures Cursor frontmatter names are emitted as plain identifiers
|
|
* (without surrounding quotes), so Cursor does not treat quotes as
|
|
* literal parts of skill/subagent names.
|
|
*/
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
const {
|
|
convertClaudeCommandToCursorSkill,
|
|
convertClaudeAgentToCursorAgent,
|
|
} = require('../bin/install.js');
|
|
|
|
describe('convertClaudeCommandToCursorSkill', () => {
|
|
test('writes unquoted Cursor skill name in frontmatter', () => {
|
|
const input = `---
|
|
name: quick
|
|
description: Execute a quick task
|
|
---
|
|
|
|
<objective>
|
|
Test body
|
|
</objective>
|
|
`;
|
|
|
|
const result = convertClaudeCommandToCursorSkill(input, 'gsd-quick');
|
|
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
|
|
|
assert.ok(nameMatch, 'frontmatter contains name field');
|
|
assert.strictEqual(nameMatch[1], 'gsd-quick', 'skill name is plain scalar');
|
|
assert.ok(!result.includes('name: "gsd-quick"'), 'quoted skill name is not emitted');
|
|
});
|
|
|
|
test('preserves slash for slash commands in markdown body', () => {
|
|
const input = `---
|
|
name: gsd:plan-phase
|
|
description: Plan a phase
|
|
---
|
|
|
|
Next:
|
|
/gsd:execute-phase 17
|
|
/gsd-help
|
|
gsd:progress
|
|
`;
|
|
|
|
const result = convertClaudeCommandToCursorSkill(input, 'gsd-plan-phase');
|
|
|
|
assert.ok(result.includes('/gsd-execute-phase 17'), 'slash command remains slash-prefixed');
|
|
assert.ok(result.includes('/gsd-help'), 'existing slash command is preserved');
|
|
assert.ok(result.includes('gsd-progress'), 'non-slash gsd: references still normalize');
|
|
assert.ok(!result.includes('/gsd:execute-phase'), 'legacy colon command form is removed');
|
|
});
|
|
});
|
|
|
|
describe('convertClaudeAgentToCursorAgent', () => {
|
|
test('writes unquoted Cursor agent name in frontmatter', () => {
|
|
const input = `---
|
|
name: gsd-planner
|
|
description: Planner agent
|
|
tools: Read, Write
|
|
color: green
|
|
---
|
|
|
|
<role>
|
|
Planner body
|
|
</role>
|
|
`;
|
|
|
|
const result = convertClaudeAgentToCursorAgent(input);
|
|
const nameMatch = result.match(/^name:\s*(.+)$/m);
|
|
|
|
assert.ok(nameMatch, 'frontmatter contains name field');
|
|
assert.strictEqual(nameMatch[1], 'gsd-planner', 'agent name is plain scalar');
|
|
assert.ok(!result.includes('name: "gsd-planner"'), 'quoted agent name is not emitted');
|
|
});
|
|
});
|