test: await each strict refusal before starting the next (#2374)

The negative control started all three refused calls up front and
awaited them in turn, so the later rejections sat unhandled while the
first was awaited. Vitest reports that as an unhandled error and fails
the run even with every assertion passing — which is how local:gate
went red on a green suite. Start each call only when it is awaited.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RsrgCxVoFPokLB4vAkxi
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-14 09:12:08 -04:00
commit e53f6a1bf0

View file

@ -158,13 +158,16 @@ describe("Skills extension over a real transport (#2234)", () => {
},
}
: { code: -32601 };
// Thunks, not promises: starting all three up front leaves the later
// rejections unhandled while the first is awaited, which fails the
// run even though every assertion passes.
const refusals = [
connected.listSkills(),
connected.getSkill("skill://data-analysis/SKILL.md"),
connected.readResourceDirectory("skill://data-analysis"),
() => connected.listSkills(),
() => connected.getSkill("skill://data-analysis/SKILL.md"),
() => connected.readResourceDirectory("skill://data-analysis"),
];
for (const refusal of refusals) {
await expect(refusal).rejects.toMatchObject({
await expect(refusal()).rejects.toMatchObject({
...expected,
message: expect.stringMatching(
/requires the client to declare io\.modelcontextprotocol\/skills/,