File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 66 type BatchMockResponseMessage ,
77 type MockRequestDescriptor ,
88} from "../types.js" ;
9+ import { isEnabled } from "./util.js" ;
910
1011type Logger = Pick < Console , "log" | "warn" | "error" > & {
1112 debug ?: ( ...args : unknown [ ] ) => void ;
@@ -171,6 +172,9 @@ export class BatchMockCollector {
171172 * created after this method is called are not included.
172173 */
173174 async waitForPendingRequests ( ) : Promise < void > {
175+ if ( ! isEnabled ( ) ) {
176+ return ;
177+ }
174178 const pendingCompletions = Array . from ( this . pendingRequests . values ( ) ) . map (
175179 ( pending ) => pending . completion
176180 ) ;
Original file line number Diff line number Diff line change 11import { BatchMockCollector } from "./batch-mock-collector.js" ;
22import type { BatchMockCollectorOptions } from "./batch-mock-collector.js" ;
3+ import { isEnabled } from "./util.js" ;
34
45export type ConnectOptions = number | BatchMockCollectorOptions | undefined ;
56
@@ -10,10 +11,7 @@ export type ConnectOptions = number | BatchMockCollectorOptions | undefined;
1011export const connect = async (
1112 options ?: ConnectOptions
1213) : Promise < BatchMockCollector | void > => {
13- const isEnabled =
14- process . env . MOCK_MCP !== undefined && process . env . MOCK_MCP !== "0" ;
15-
16- if ( ! isEnabled ) {
14+ if ( ! isEnabled ( ) ) {
1715 console . log ( "[mock-mcp] Skipping (set MOCK_MCP=1 to enable)" ) ;
1816 return ;
1917 }
Original file line number Diff line number Diff line change 1+ export const isEnabled = ( ) => {
2+ return process . env . MOCK_MCP !== undefined && process . env . MOCK_MCP !== "0" ;
3+ } ;
You can’t perform that action at this time.
0 commit comments