* test(#1178): consolidate duplicated agent-roster helper into tests/helpers The "list gsd-*.md agent files, strip .md, sort" derivation was hand-duplicated across the suite (two listAgentFiles(), an identical agentFilesOnDisk(), and inline readdir blocks). Add tests/helpers/agent-roster.cjs exporting listAgentFiles(agentsDir?) and route the genuinely-identical source-roster sites through it. Semantically-different sites (installed-dest dirs, absolute-path returns, .toml-inclusive Codex rosters, full-.md-filename readers, the uniform multi-family inventory table) are left intact, each with a one-line comment. Test-only; no production code touched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(#1178): note AGENTS_DIR export is for future call sites Review nit: clarify that the currently-unused AGENTS_DIR export is intentional — available for future tests needing the canonical source agents path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
committed by
GitHub
parent
9d12725e4e
commit
fc5ca178a2
@@ -25,6 +25,7 @@ const path = require('path');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const { parseFrontmatter, createTempDir, cleanup } = require('./helpers.cjs');
|
||||
const { listAgentFiles } = require('./helpers/agent-roster.cjs');
|
||||
|
||||
const {
|
||||
getDirName,
|
||||
@@ -857,10 +858,11 @@ describe('Copilot agent conversion - real files', () => {
|
||||
});
|
||||
|
||||
test('all 18 agents convert without error', () => {
|
||||
// Not the shared listAgentFiles() helper: this needs full `.md` filenames
|
||||
// (not stripped basenames) to readFileSync each agent below.
|
||||
const agents = fs.readdirSync(agentsSrc)
|
||||
.filter(f => f.startsWith('gsd-') && f.endsWith('.md'));
|
||||
const expectedAgentCount = fs.readdirSync(agentsSrc)
|
||||
.filter(f => f.startsWith('gsd-') && f.endsWith('.md')).length;
|
||||
const expectedAgentCount = listAgentFiles(agentsSrc).length;
|
||||
assert.strictEqual(agents.length, expectedAgentCount, `expected ${expectedAgentCount} agents, got ${agents.length}`);
|
||||
|
||||
for (const agentFile of agents) {
|
||||
@@ -1350,8 +1352,8 @@ const crypto = require('crypto');
|
||||
const INSTALL_PATH = path.join(__dirname, '..', 'bin', 'install.js');
|
||||
const EXPECTED_SKILLS = fs.readdirSync(path.join(__dirname, '..', 'commands', 'gsd'))
|
||||
.filter(f => f.endsWith('.md')).length;
|
||||
const EXPECTED_AGENTS = fs.readdirSync(path.join(__dirname, '..', 'agents'))
|
||||
.filter(f => f.startsWith('gsd-') && f.endsWith('.md')).length;
|
||||
// Source-roster count (gsd-*.md basenames) — shared helper.
|
||||
const EXPECTED_AGENTS = listAgentFiles().length;
|
||||
|
||||
function runCopilotInstall(cwd) {
|
||||
const env = { ...process.env };
|
||||
|
||||
Reference in New Issue
Block a user