detox.session.stop
Stop the current Detox UI automation testing session for React Native/Expo iOS applications to end test execution and release simulator resources.
Instructions
Stop the current Detox testing session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/detox/runner.ts:275-305 (handler)Core handler function `stopDetoxSession` that cleans up temporary Detox directories and updates the global state to idle.export async function stopDetoxSession(): Promise<void> { logger.info("detox", "Stopping Detox session"); const detoxState = stateManager.getDetox(); if (detoxState.state === "idle") { logger.info("detox", "No active session to stop"); return; } // Cleanup temp directory if (hasConfig()) { const config = getConfig(); const testDir = join(config.projectPath, ".mcp-detox-tmp"); try { const { rm } = await import("fs/promises"); await rm(testDir, { recursive: true, force: true }); } catch { // Ignore cleanup errors } } stateManager.updateDetox({ state: "idle", sessionId: undefined, configuration: undefined, }); logger.info("detox", "Detox session stopped"); }
- src/mcp/server.ts:404-423 (registration)Registers the MCP tool 'detox.session.stop' using server.tool(), providing an inline async handler that calls stopDetoxSession() and formats the MCP response.server.tool( "detox.session.stop", "Stop the current Detox testing session", {}, async () => { try { await stopDetoxSession(); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: "Detox session stopped" }), }, ], }; } catch (error) { return handleToolError(error); } } );