Skip to content

Commit f305beb

Browse files
test: mock process.emitWarning to prevent output disruption (#19687)
* test: mock `process.emitWarning` to prevent output disruption * remove unnecessary `async` Co-authored-by: Milos Djermanovic <[email protected]> * add `callThrough()` and `returns()` --------- Co-authored-by: Milos Djermanovic <[email protected]>
1 parent eb316a8 commit f305beb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/lib/mcp/mcp-server.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const assert = require("chai").assert;
1414
const path = require("node:path");
1515
const { Client } = require("@modelcontextprotocol/sdk/client/index.js");
1616
const { InMemoryTransport } = require("@modelcontextprotocol/sdk/inMemory.js");
17+
const sinon = require("sinon");
1718

1819
//-----------------------------------------------------------------------------
1920
// Helpers
@@ -55,6 +56,16 @@ describe("MCP Server", () => {
5556
// Note: must connect server first or else client hangs
5657
await mcpServer.connect(serverTransport);
5758
await client.connect(clientTransport);
59+
60+
sinon
61+
.stub(process, "emitWarning")
62+
.callThrough()
63+
.withArgs(sinon.match.any, "ESLintIgnoreWarning")
64+
.returns();
65+
});
66+
67+
afterEach(() => {
68+
sinon.restore();
5869
});
5970

6071
describe("Tools", () => {

0 commit comments

Comments
 (0)