Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cli/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "./helpers/assertions.js";
import {
NO_SERVER_SENTINEL,
TEST_URI_ENV,
createSampleTestConfig,
createTestConfig,
createInvalidConfig,
Expand Down Expand Up @@ -75,7 +76,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(result);
Expand Down Expand Up @@ -114,7 +115,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(result);
Expand All @@ -134,7 +135,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(result);
Expand Down Expand Up @@ -427,7 +428,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(result);
Expand Down Expand Up @@ -522,7 +523,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(envResult);
Expand Down Expand Up @@ -630,7 +631,7 @@ describe("CLI Tests", () => {
"--method",
"resources/read",
"--uri",
"test://env",
TEST_URI_ENV,
]);

expectCliSuccess(envResult);
Expand Down
4 changes: 2 additions & 2 deletions cli/__tests__/helpers/cli-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export async function runCli(
try {
if (process.platform === "win32") {
child.kill("SIGTERM");
} else {
} else if (child.pid) {
// On Unix, kill the process group
process.kill(-child.pid!, "SIGTERM");
process.kill(-child.pid, "SIGTERM");
}
} catch (e) {
// Process might already be dead, try direct kill
Expand Down
6 changes: 6 additions & 0 deletions cli/__tests__/helpers/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import { getTestMcpServerCommand } from "./test-server-stdio.js";
*/
export const NO_SERVER_SENTINEL = "invalid-command-that-does-not-exist";

/**
* Test resource URIs used across test files
*/
export const TEST_URI_ENV = "test://env";
export const TEST_URI_RESOURCE = "test://resource";

/**
* Create a sample test config with test-stdio and test-http servers
* Returns a temporary config file path that should be cleaned up with deleteConfigFile()
Expand Down
10 changes: 5 additions & 5 deletions cli/__tests__/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
createAddTool,
createTestServerInfo,
} from "./helpers/test-fixtures.js";
import { NO_SERVER_SENTINEL } from "./helpers/fixtures.js";
import { NO_SERVER_SENTINEL, TEST_URI_RESOURCE } from "./helpers/fixtures.js";

describe("Metadata Tests", () => {
describe("General Metadata", () => {
Expand Down Expand Up @@ -57,7 +57,7 @@ describe("Metadata Tests", () => {
serverInfo: createTestServerInfo(),
resources: [
{
uri: "test://resource",
uri: TEST_URI_RESOURCE,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit extra but Claude really wanted to make this a constant :)

name: "test-resource",
text: "test content",
},
Expand Down Expand Up @@ -146,7 +146,7 @@ describe("Metadata Tests", () => {
serverInfo: createTestServerInfo(),
resources: [
{
uri: "test://resource",
uri: TEST_URI_RESOURCE,
name: "test-resource",
text: "test content",
},
Expand All @@ -163,7 +163,7 @@ describe("Metadata Tests", () => {
"--method",
"resources/read",
"--uri",
"test://resource",
TEST_URI_RESOURCE,
"--metadata",
"client=test-client",
"--transport",
Expand Down Expand Up @@ -653,7 +653,7 @@ describe("Metadata Tests", () => {
serverInfo: createTestServerInfo(),
resources: [
{
uri: "test://resource",
uri: TEST_URI_RESOURCE,
name: "test-resource",
text: "test content",
},
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
},
"devDependencies": {
"@types/express": "^5.0.6",
"express": "^5.2.1",
"tsx": "^4.7.0",
"vitest": "^4.0.17"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.25.2",
"commander": "^13.1.0",
"express": "^5.2.1",
"spawn-rx": "^5.1.2"
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.