fix: catch system signals for clean v8 exit (#366)

This commit is contained in:
Gil Megidish
2026-07-02 13:40:37 +02:00
committed by GitHub
parent aedb84b91d
commit d647ed00ba
3 changed files with 30 additions and 11 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
{
"all": true,
"src": ["src"],
"include": ["src/**/*.ts"],
"reporter": ["text", "html"]
"include": ["lib/**/*.js"],
"exclude": ["node_modules/**", "lib/**/*.js.map"],
"reporter": ["html", "text"],
"temp-directory": "./coverage/tmp"
}
+11
View File
@@ -76,6 +76,17 @@ const startStdioServer = async () => {
const server = createMcpServer();
await server.connect(transport);
// Exit cleanly on termination signals so node flushes pending work
// (including NODE_V8_COVERAGE output). Node's default SIGINT/SIGTERM
// handling terminates the process without writing the coverage file,
// which makes the `test:mcp` report come back all zeros.
const shutdown = () => {
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
error("mobile-mcp server running on stdio");
} catch (err: any) {
console.error("Fatal error in main():", err);
+15 -7
View File
@@ -34,16 +34,24 @@ export interface MobilecliDevicesOptions {
type?: "real" | "emulator" | "simulator";
}
export interface MobilecliDeviceProvider {
type: string; // e.g. "mobilefleet" for remote devices
allocationId?: string;
}
export interface MobilecliDevice {
id: string;
name: string;
platform: "android" | "ios";
type: "real" | "emulator" | "simulator";
version: string;
provider?: MobilecliDeviceProvider;
}
export interface MobilecliDevicesResponse {
status: "ok";
data: {
devices: Array<{
id: string;
name: string;
platform: "android" | "ios";
type: "real" | "emulator" | "simulator";
version: string;
}>;
devices: MobilecliDevice[];
};
}