Skip to content

Commit feb53d2

Browse files
committed
fix-tests
1 parent 7b4af61 commit feb53d2

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/_internal/resource-path.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { join, dirname } from "node:path"
22
import { readFileSync, existsSync } from "node:fs"
3+
import { fileURLToPath } from "node:url"
34

45
const DIST_RESOURCES_DIR = "resources"
56

@@ -21,7 +22,7 @@ function findProjectRoot(startDir: string): string {
2122
}
2223

2324
function getResourcesRoot(): string {
24-
const currentDir = __dirname
25+
const currentDir = dirname(fileURLToPath(import.meta.url))
2526

2627
if (currentDir.includes("/dist/")) {
2728
const distIndex = currentDir.lastIndexOf("/dist/")

test/e2e/mcp-registration.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ vi.setConfig({ testTimeout: 600000, hookTimeout: 60000 })
99

1010
const __filename = fileURLToPath(import.meta.url)
1111
const __dirname = dirname(__filename)
12-
const REPO_ROOT = join(__dirname, "../..")
13-
const MCP_SERVER_PATH = join(REPO_ROOT, "dist/stdio.js")
12+
const REPO_ROOT = join(__dirname, '../..')
13+
const MCP_SERVER_PATH = join(REPO_ROOT, 'dist/index.js')
1414

1515
interface MCPRequest {
1616
jsonrpc: "2.0"
@@ -295,8 +295,8 @@ describe("MCP Server Registration", () => {
295295
id: 2,
296296
method: "tools/call",
297297
params: {
298-
name: "nextjs_docs",
299-
arguments: { query: "cache" },
298+
name: 'nextjs_docs',
299+
arguments: { action: 'search', query: 'cache' },
300300
},
301301
})
302302

test/e2e/upgrade.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { execSync } from 'child_process'
66
import { fileURLToPath } from 'url'
77
import { query } from '@anthropic-ai/claude-agent-sdk'
88
import { config } from 'dotenv'
9-
import upgradeNextjs16Prompt from '../../src/prompts/upgrade-nextjs-16'
9+
import { handler as upgradeNextjs16Prompt } from '../../src/prompts/upgrade-nextjs-16.js'
1010

1111
config({ path: join(dirname(fileURLToPath(import.meta.url)), '.env') })
1212

test/prompts/prompts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, it, expect } from 'vitest'
22
import { execSync } from 'child_process'
33
import { join } from 'path'
4-
import getEnableCacheComponentsPrompt from '../../src/prompts/enable-cache-components'
5-
import getUpgradeNextjs16Prompt from '../../src/prompts/upgrade-nextjs-16'
4+
import { handler as getEnableCacheComponentsPrompt } from '../../src/prompts/enable-cache-components.js'
5+
import { handler as getUpgradeNextjs16Prompt } from '../../src/prompts/upgrade-nextjs-16.js'
66

77
const REPO_ROOT = join(__dirname, '../..')
88
const CHARS_PER_TOKEN = 4

0 commit comments

Comments
 (0)