Skip to content

Commit 26ed6bc

Browse files
chore: address copilot suggestions
1 parent 5765a42 commit 26ed6bc

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/transports/dryModeRunner.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ export class DryRunModeRunner extends TransportRunnerBase {
3939
}
4040

4141
private dumpTools(): void {
42-
const tools = this.server?.tools
43-
.filter((tool) => tool.isEnabled())
44-
.map((tool) => ({
45-
name: tool.name,
46-
category: tool.category,
47-
}));
42+
const tools =
43+
this.server?.tools
44+
.filter((tool) => tool.isEnabled())
45+
.map((tool) => ({
46+
name: tool.name,
47+
category: tool.category,
48+
})) ?? [];
4849
this.consoleLogger.log("Enabled tools:");
4950
this.consoleLogger.log(JSON.stringify(tools, null, 2));
5051
}

tests/e2e/cli.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import path from "path";
2-
import { exec } from "child_process";
2+
import { execFile } from "child_process";
33
import { promisify } from "util";
44
import { describe, expect, it } from "vitest";
55
import packageJson from "../../package.json" with { type: "json" };
66

7-
const execAsync = promisify(exec);
7+
const execFileAsync = promisify(execFile);
88
const CLI_PATH = path.join(import.meta.dirname, "..", "..", "dist", "index.js");
99

1010
describe("CLI entrypoint", () => {
1111
it("should handle version request", async () => {
12-
const { stdout, stderr } = await execAsync(`${process.execPath} ${CLI_PATH} --version`);
12+
const { stdout, stderr } = await execFileAsync(process.execPath, [CLI_PATH, "--version"]);
1313
expect(stdout).toContain(packageJson.version);
1414
expect(stderr).toEqual("");
1515
});
1616

1717
it("should handle help request", async () => {
18-
const { stdout, stderr } = await execAsync(`${process.execPath} ${CLI_PATH} --help`);
18+
const { stdout, stderr } = await execFileAsync(process.execPath, [CLI_PATH, "--help"]);
1919
expect(stdout).toContain("For usage information refer to the README.md");
2020
expect(stderr).toEqual("");
2121
});
2222

2323
it("should handle dry run request", async () => {
24-
const { stdout, stderr } = await execAsync(`${process.execPath} ${CLI_PATH} --dryRun`);
24+
const { stdout, stderr } = await execFileAsync(process.execPath, [CLI_PATH, "--dryRun"]);
2525
expect(stdout).toContain("Configuration:");
2626
expect(stdout).toContain("Enabled tools:");
2727
expect(stderr).toEqual("");

0 commit comments

Comments
 (0)