diff options
| author | Gaurav Dubey <gauravdubey0107@gmail.com> | 2026-07-14 17:36:57 +0530 |
|---|---|---|
| committer | Drew Ritter <drew@ritter.dev> | 2026-07-23 17:27:16 -0700 |
| commit | a60dc2ffe5c5c4b0a833f52cdc8d531f8d09bedc (patch) | |
| tree | 3307758ebaa84aa47122f147ad9db8ecc6b9af9c | |
| parent | a80b7b63865a084f229e71be5239bfc57982401d (diff) | |
test(pi): scope mapping assertions to the table, not whole file
The pi tokens (subagent, pi-subagents, Task, TODO.md) also appear in the
surrounding prose, so matching the whole file passed even with the mapping
table deleted — the exact regression this test exists to catch. Filter to
table rows (lines starting with '|') so the assertion fails when the table
is gone and passes on dev.
Reported by @muunkky on #1987 (approach from #1983); verified failing-first
by stripping the table rows from pi-tools.md.
| -rw-r--r-- | tests/pi/test-pi-extension.mjs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/pi/test-pi-extension.mjs b/tests/pi/test-pi-extension.mjs index 14380e4..d7af9cb 100644 --- a/tests/pi/test-pi-extension.mjs +++ b/tests/pi/test-pi-extension.mjs @@ -122,7 +122,16 @@ test('pi tools reference documents pi-specific mappings', async () => { assert.equal(existsSync(piToolsPath), true, 'pi-tools.md should exist'); const text = await readFile(piToolsPath, 'utf8'); - for (const expected of ['subagent', 'pi-subagents', 'Task', 'TODO.md']) { - assert.match(text, new RegExp(expected)); - } + // Assert against the mapping-table rows only. The surrounding prose mentions + // these same tokens, so matching the whole file would still pass if the table + // were deleted — the exact regression this test exists to catch. + const rows = text.split('\n').filter((line) => line.startsWith('|')); + assert.ok( + rows.some((row) => /subagent/i.test(row)), + 'mapping table documents subagent dispatch', + ); + assert.ok( + rows.some((row) => /todo|task/i.test(row)), + 'mapping table documents task tracking', + ); }); |
