Clean up processes in integration tests (#15102)

This commit is contained in:
Tommaso Sciortino
2025-12-15 11:11:08 -08:00
committed by GitHub
parent 217e2b0eb4
commit ec665ef405
19 changed files with 184 additions and 92 deletions

View File

@@ -10,7 +10,7 @@
* external dependencies, making it compatible with Docker sandbox mode.
*/
import { describe, it, beforeAll, expect } from 'vitest';
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, poll, validateModelOutput } from './test-helper.js';
import { join } from 'node:path';
import { writeFileSync } from 'node:fs';
@@ -165,9 +165,15 @@ rpc.send({
`;
describe('simple-mcp-server', () => {
const rig = new TestRig();
let rig: TestRig;
beforeAll(async () => {
beforeEach(() => {
rig = new TestRig();
});
afterEach(async () => await rig.cleanup());
it('should add two numbers', async () => {
// Setup test directory with MCP server configuration
await rig.setup('simple-mcp-server', {
settings: {
@@ -209,9 +215,7 @@ describe('simple-mcp-server', () => {
if (!isReady) {
throw new Error('MCP server script was not ready in time.');
}
});
it('should add two numbers', async () => {
// Test directory is already set up in before hook
// Just run the command - MCP server config is in settings.json
const output = await rig.run(