feat: add computer control and managed browser

This commit is contained in:
lofyer
2026-08-05 12:55:24 +08:00
parent 2f549387a6
commit 38ac2206f2
92 changed files with 21028 additions and 766 deletions
+32
View File
@@ -141,4 +141,36 @@ describe('testMcpServer', () => {
)
expect(mocks.client.close).toHaveBeenCalledOnce()
})
it('accepts cancellation, closes the client, and hides abort details', async () => {
mocks.client.connect.mockImplementation(
async (
_transport: unknown,
options: { signal: AbortSignal }
) =>
new Promise((_resolve, reject) => {
options.signal.addEventListener(
'abort',
() => reject(new Error('sensitive abort reason')),
{ once: true }
)
})
)
const controller = new AbortController()
const pending = testMcpServer(
{
...common,
transport: 'stdio',
command: 'node',
args: ['server.js']
} satisfies ResolvedMcpServer,
controller.signal
)
controller.abort(new Error('caller private context'))
await expect(pending).rejects.toThrow('MCP 连接测试已取消')
expect(mocks.client.listTools).not.toHaveBeenCalled()
expect(mocks.client.close).toHaveBeenCalledOnce()
})
})