-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-basic.js
More file actions
67 lines (52 loc) · 1.87 KB
/
Copy pathtest-basic.js
File metadata and controls
67 lines (52 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env node
// Basic syntax test for the compiled server
// This will check if the JavaScript is valid without actually starting the server
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
console.log("🧪 Testing compiled JavaScript syntax...");
const distDir = path.join(__dirname, "dist");
const indexFile = path.join(distDir, "index.js");
// Check if dist directory exists
if (!fs.existsSync(distDir)) {
console.error("❌ dist directory does not exist");
process.exit(1);
}
// Check if index.js exists
if (!fs.existsSync(indexFile)) {
console.error("❌ dist/index.js does not exist");
process.exit(1);
}
console.log("✅ dist directory and index.js found");
// Try to require the compiled modules (syntax check)
try {
// Check if the file can be read
const content = fs.readFileSync(indexFile, "utf8");
if (content.length < 100) {
console.error("❌ index.js appears to be empty or too small");
process.exit(1);
}
console.log("✅ index.js has content (" + content.length + " characters)");
// Check for expected imports
const hasServerImport = content.includes("@modelcontextprotocol/sdk");
const hasGrokClient = content.includes("GrokClient");
if (!hasServerImport) {
console.error("❌ Missing MCP SDK import");
process.exit(1);
}
if (!hasGrokClient) {
console.error("❌ Missing GrokClient import");
process.exit(1);
}
console.log("✅ Required imports found");
console.log("✅ Compiled JavaScript appears valid");
} catch (error) {
console.error("❌ Error reading compiled file:", error.message);
process.exit(1);
}
console.log("");
console.log("🎯 Basic tests passed!");
console.log(" The compiled server appears to be valid.");
console.log(" Ready for environment testing.");