Skip to content

Commit a9df97e

Browse files
jqnatividadclaude
andcommitted
fix(mcp): deterministic test coverage for enableMcpApps, restore .pqt extension
Split the conditional enableMcpApps test into two explicit tests that override the config value, ensuring both branches are exercised regardless of CI environment. Restore .pqt to TABULAR_EXTS alongside .pq to avoid silently dropping files for users with pandas-generated Parquet files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8bd116e commit a9df97e

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

.claude/skills/src/browse-directory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { readdir, stat as fsStat } from "node:fs/promises";
1010

1111
/** Tabular file extensions recognised by the directory scanner. */
1212
export const TABULAR_EXTS = new Set([
13-
".csv", ".tsv", ".tab", ".ssv", ".parquet", ".pq",
13+
".csv", ".tsv", ".tab", ".ssv", ".parquet", ".pq", ".pqt",
1414
".jsonl", ".ndjson", ".json", ".xlsx", ".xls",
1515
".xlsm", ".xlsb", ".ods",
1616
]);

.claude/skills/tests/mcp-app.test.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,34 @@ import { join } from "node:path";
1515
import { createTestDir, cleanupTestDir } from "./test-helpers.js";
1616

1717
describe("MCP App tool definitions", () => {
18-
test("qsv_set_working_dir _meta.ui.resourceUri depends on enableMcpApps config", async () => {
18+
test("qsv_set_working_dir includes _meta.ui when enableMcpApps is true", async () => {
1919
const { createSetWorkingDirTool } = await import("../src/mcp-tools.js");
2020
const { config } = await import("../src/config.js");
21-
const tool = createSetWorkingDirTool();
22-
23-
if (config.enableMcpApps) {
21+
const mutableConfig = config as { -readonly [K in keyof typeof config]: (typeof config)[K] };
22+
const original = mutableConfig.enableMcpApps;
23+
try {
24+
mutableConfig.enableMcpApps = true;
25+
const tool = createSetWorkingDirTool();
2426
assert.ok(tool._meta, "tool should have _meta when apps enabled");
2527
const ui = tool._meta!.ui as Record<string, unknown>;
2628
assert.ok(ui, "tool._meta should have ui");
2729
assert.strictEqual(ui.resourceUri, "ui://qsv/directory-picker");
28-
} else {
30+
} finally {
31+
mutableConfig.enableMcpApps = original;
32+
}
33+
});
34+
35+
test("qsv_set_working_dir omits _meta when enableMcpApps is false", async () => {
36+
const { createSetWorkingDirTool } = await import("../src/mcp-tools.js");
37+
const { config } = await import("../src/config.js");
38+
const mutableConfig = config as { -readonly [K in keyof typeof config]: (typeof config)[K] };
39+
const original = mutableConfig.enableMcpApps;
40+
try {
41+
mutableConfig.enableMcpApps = false;
42+
const tool = createSetWorkingDirTool();
2943
assert.strictEqual(tool._meta, undefined, "tool should not have _meta when apps disabled");
44+
} finally {
45+
mutableConfig.enableMcpApps = original;
3046
}
3147
});
3248

@@ -244,7 +260,7 @@ describe("scanDirectory (extracted from qsv_browse_directory handler)", () => {
244260

245261
test("TABULAR_EXTS covers expected extensions", async () => {
246262
const { TABULAR_EXTS } = await import("../src/browse-directory.js");
247-
for (const ext of [".csv", ".tsv", ".tab", ".ssv", ".parquet", ".pq", ".jsonl", ".ndjson", ".json", ".xlsx", ".xls", ".xlsm", ".xlsb", ".ods"]) {
263+
for (const ext of [".csv", ".tsv", ".tab", ".ssv", ".parquet", ".pq", ".pqt", ".jsonl", ".ndjson", ".json", ".xlsx", ".xls", ".xlsm", ".xlsb", ".ods"]) {
248264
assert.ok(TABULAR_EXTS.has(ext), `should include ${ext}`);
249265
}
250266
assert.ok(!TABULAR_EXTS.has(".txt"), "should not include .txt");

0 commit comments

Comments
 (0)