Skip to content

Commit d305f7b

Browse files
committed
refactor: simplify test setup by removing lifecycle hooks
1 parent 95261ca commit d305f7b

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

vitest.setup.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
import 'dotenv/config'
2-
import { afterAll, beforeAll } from 'vitest'
32
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
43
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
54

6-
beforeAll(async () => {
7-
const serverParams = new StdioClientTransport({
8-
command: 'c8',
9-
args: ['--reporter=lcov', '--reporter=text', 'tsx', './src/index.ts'],
10-
env: {
11-
...process.env,
12-
NODE_V8_COVERAGE: './coverage/tmp',
13-
},
14-
})
15-
const client = new Client({
16-
name: 'doc-mcp-client',
17-
version: '1.0.0',
18-
})
19-
await client.connect(serverParams)
20-
global.client = client
5+
const serverParams = new StdioClientTransport({
6+
command: 'c8',
7+
args: ['--reporter=lcov', '--reporter=text', 'tsx', './src/index.ts'],
8+
env: {
9+
...process.env,
10+
NODE_V8_COVERAGE: './coverage/tmp',
11+
},
2112
})
22-
23-
afterAll(async () => {
24-
await global.client.close()
13+
const client = new Client({
14+
name: 'doc-mcp-client',
15+
version: '1.0.0',
2516
})
17+
await client.connect(serverParams)
18+
19+
global.client = client

0 commit comments

Comments
 (0)