File tree Expand file tree Collapse file tree 6 files changed +60
-0
lines changed
03.problem.completion/src
03.solution.completion/src Expand file tree Collapse file tree 6 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
Original file line number Diff line number Diff line change 1+ import fs from 'node:fs/promises'
2+ import path from 'node:path'
13import { invariant } from '@epic-web/invariant'
24import { Client } from '@modelcontextprotocol/sdk/client/index.js'
35import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
46import { test , beforeAll , afterAll , expect } from 'vitest'
57
68let client : Client
9+ const EPIC_ME_DB_PATH = `./test.ignored/db.${ process . env . VITEST_WORKER_ID } .sqlite`
710
811beforeAll ( async ( ) => {
12+ const dir = path . dirname ( EPIC_ME_DB_PATH )
13+ await fs . mkdir ( dir , { recursive : true } )
914 client = new Client ( {
1015 name : 'EpicMeTester' ,
1116 version : '1.0.0' ,
1217 } )
1318 const transport = new StdioClientTransport ( {
1419 command : 'tsx' ,
1520 args : [ 'src/index.ts' ] ,
21+ env : {
22+ ...process . env ,
23+ EPIC_ME_DB_PATH ,
24+ } ,
1625 } )
1726 await client . connect ( transport )
1827} )
1928
2029afterAll ( async ( ) => {
2130 await client . transport ?. close ( )
31+ await fs . unlink ( EPIC_ME_DB_PATH )
2232} )
2333
2434test ( 'Tool Definition' , async ( ) => {
You can’t perform that action at this time.
0 commit comments