@frontmcp/testing 0.12.2 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assertions/mcp-assertions.d.ts +1 -1
- package/assertions/mcp-assertions.d.ts.map +1 -1
- package/client/mcp-test-client.builder.d.ts +1 -1
- package/client/mcp-test-client.d.ts.map +1 -1
- package/client/mcp-test-client.types.d.ts +3 -3
- package/client/mcp-test-client.types.d.ts.map +1 -1
- package/errors/index.d.ts.map +1 -1
- package/esm/fixtures/index.mjs +255 -36
- package/esm/index.mjs +291 -122
- package/esm/matchers/index.mjs +8 -32
- package/esm/package.json +6 -6
- package/esm/perf/index.mjs +239 -36
- package/esm/setup.mjs +8 -32
- package/example-tools/index.d.ts +1 -1
- package/example-tools/index.d.ts.map +1 -1
- package/example-tools/tool-configs.d.ts +4 -10
- package/example-tools/tool-configs.d.ts.map +1 -1
- package/fixtures/index.js +241 -36
- package/fixtures/test-fixture.d.ts.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +283 -126
- package/matchers/index.js +8 -32
- package/package.json +6 -6
- package/perf/index.js +232 -36
- package/platform/platform-client-info.d.ts +2 -1
- package/platform/platform-client-info.d.ts.map +1 -1
- package/platform/platform-types.d.ts +11 -16
- package/platform/platform-types.d.ts.map +1 -1
- package/playwright/index.d.ts +1 -1
- package/raw-client/index.d.ts +7 -0
- package/raw-client/index.d.ts.map +1 -0
- package/server/index.d.ts +1 -1
- package/server/index.d.ts.map +1 -1
- package/server/port-registry.d.ts +24 -6
- package/server/port-registry.d.ts.map +1 -1
- package/server/test-server.d.ts +1 -1
- package/server/test-server.d.ts.map +1 -1
- package/setup.js +8 -32
- package/ui/ui-assertions.d.ts +3 -4
- package/ui/ui-assertions.d.ts.map +1 -1
- package/ui/ui-matchers.d.ts +1 -2
- package/ui/ui-matchers.d.ts.map +1 -1
package/fixtures/index.js
CHANGED
|
@@ -28,6 +28,9 @@ __export(fixtures_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(fixtures_exports);
|
|
30
30
|
|
|
31
|
+
// libs/testing/src/fixtures/test-fixture.ts
|
|
32
|
+
var import_globals = require("@jest/globals");
|
|
33
|
+
|
|
31
34
|
// libs/testing/src/platform/platform-client-info.ts
|
|
32
35
|
var MCP_APPS_EXTENSION_KEY = "io.modelcontextprotocol/ui";
|
|
33
36
|
function getPlatformClientInfo(platform) {
|
|
@@ -94,7 +97,7 @@ function getPlatformCapabilities(platform) {
|
|
|
94
97
|
...baseCapabilities,
|
|
95
98
|
experimental: {
|
|
96
99
|
[MCP_APPS_EXTENSION_KEY]: {
|
|
97
|
-
mimeTypes: ["text/html
|
|
100
|
+
mimeTypes: ["text/html;profile=mcp-app"]
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
};
|
|
@@ -215,7 +218,7 @@ var McpTestClientBuilder = class {
|
|
|
215
218
|
* .withCapabilities({
|
|
216
219
|
* sampling: {},
|
|
217
220
|
* experimental: {
|
|
218
|
-
* 'io.modelcontextprotocol/ui': { mimeTypes: ['text/html
|
|
221
|
+
* 'io.modelcontextprotocol/ui': { mimeTypes: ['text/html;profile=mcp-app'] }
|
|
219
222
|
* }
|
|
220
223
|
* })
|
|
221
224
|
* .buildAndConnect();
|
|
@@ -1197,11 +1200,24 @@ var McpTestClient = class {
|
|
|
1197
1200
|
this.log("debug", `Connecting to ${this.config.baseUrl}...`);
|
|
1198
1201
|
this.transport = this.createTransport();
|
|
1199
1202
|
await this.transport.connect();
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
+
const maxRetries = 3;
|
|
1204
|
+
const retryDelayMs = 500;
|
|
1205
|
+
let lastError;
|
|
1206
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
1207
|
+
const initResponse = await this.initialize();
|
|
1208
|
+
if (initResponse.success && initResponse.data) {
|
|
1209
|
+
this.initResult = initResponse.data;
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
lastError = initResponse.error?.message ?? "Unknown error";
|
|
1213
|
+
if (attempt < maxRetries) {
|
|
1214
|
+
this.log("debug", `MCP init attempt ${attempt} failed (${lastError}), retrying in ${retryDelayMs}ms...`);
|
|
1215
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
if (!this.initResult) {
|
|
1219
|
+
throw new Error(`Failed to initialize MCP connection after ${maxRetries} attempts: ${lastError}`);
|
|
1203
1220
|
}
|
|
1204
|
-
this.initResult = initResponse.data;
|
|
1205
1221
|
this._sessionId = this.transport.getSessionId();
|
|
1206
1222
|
this._sessionInfo = {
|
|
1207
1223
|
id: this._sessionId ?? `session-${Date.now()}`,
|
|
@@ -1892,7 +1908,7 @@ var McpTestClient = class {
|
|
|
1892
1908
|
const raw = response.data ?? { content: [] };
|
|
1893
1909
|
const isError = !response.success || raw.isError === true;
|
|
1894
1910
|
const meta = raw._meta;
|
|
1895
|
-
const hasUI = meta?.["ui/html"] !== void 0 || meta?.["ui/component"] !== void 0
|
|
1911
|
+
const hasUI = meta?.["ui/html"] !== void 0 || meta?.["ui/component"] !== void 0;
|
|
1896
1912
|
const structuredContent = raw["structuredContent"];
|
|
1897
1913
|
return {
|
|
1898
1914
|
raw,
|
|
@@ -2244,6 +2260,7 @@ var TestTokenFactory = class {
|
|
|
2244
2260
|
|
|
2245
2261
|
// libs/testing/src/server/test-server.ts
|
|
2246
2262
|
var import_child_process = require("child_process");
|
|
2263
|
+
var import_utils = require("@frontmcp/utils");
|
|
2247
2264
|
|
|
2248
2265
|
// libs/testing/src/errors/index.ts
|
|
2249
2266
|
var TestClientError = class extends Error {
|
|
@@ -2291,9 +2308,16 @@ var E2E_PORT_RANGES = {
|
|
|
2291
2308
|
"demo-e2e-agents": { start: 50270, size: 10 },
|
|
2292
2309
|
"demo-e2e-transport-recreation": { start: 50280, size: 10 },
|
|
2293
2310
|
"demo-e2e-jobs": { start: 50290, size: 10 },
|
|
2294
|
-
// Infrastructure E2E tests (50300-
|
|
2311
|
+
// Infrastructure E2E tests (50300-50409)
|
|
2295
2312
|
"demo-e2e-redis": { start: 50300, size: 10 },
|
|
2296
2313
|
"demo-e2e-serverless": { start: 50310, size: 10 },
|
|
2314
|
+
"demo-e2e-uipack": { start: 50320, size: 10 },
|
|
2315
|
+
"demo-e2e-agent-adapters": { start: 50330, size: 10 },
|
|
2316
|
+
"demo-e2e-guard": { start: 50340, size: 10 },
|
|
2317
|
+
// ESM E2E tests (50400-50449)
|
|
2318
|
+
"esm-package-server": { start: 50400, size: 10 },
|
|
2319
|
+
"esm-package-server-hot-reload": { start: 50410, size: 10 },
|
|
2320
|
+
"esm-package-server-cli": { start: 50420, size: 10 },
|
|
2297
2321
|
// Mock servers and utilities (50900-50999)
|
|
2298
2322
|
"mock-oauth": { start: 50900, size: 10 },
|
|
2299
2323
|
"mock-api": { start: 50910, size: 10 },
|
|
@@ -2365,7 +2389,7 @@ async function tryReservePort(port, project) {
|
|
|
2365
2389
|
server.once("error", () => {
|
|
2366
2390
|
resolve(false);
|
|
2367
2391
|
});
|
|
2368
|
-
server.listen(port,
|
|
2392
|
+
server.listen(port, () => {
|
|
2369
2393
|
reservedPorts.set(port, {
|
|
2370
2394
|
port,
|
|
2371
2395
|
project,
|
|
@@ -2406,7 +2430,7 @@ async function isPortAvailable(port) {
|
|
|
2406
2430
|
server.once("error", () => {
|
|
2407
2431
|
resolve(false);
|
|
2408
2432
|
});
|
|
2409
|
-
server.listen(port,
|
|
2433
|
+
server.listen(port, () => {
|
|
2410
2434
|
server.close(() => {
|
|
2411
2435
|
resolve(true);
|
|
2412
2436
|
});
|
|
@@ -2444,15 +2468,37 @@ var TestServer = class _TestServer {
|
|
|
2444
2468
|
*/
|
|
2445
2469
|
static async start(options) {
|
|
2446
2470
|
const project = options.project ?? "default";
|
|
2447
|
-
const
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2471
|
+
const maxAttempts = 3;
|
|
2472
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
2473
|
+
const { port, release } = await reservePort(project, options.port);
|
|
2474
|
+
const server = new _TestServer(options, port, release);
|
|
2475
|
+
try {
|
|
2476
|
+
await server.startProcess();
|
|
2477
|
+
return server;
|
|
2478
|
+
} catch (error) {
|
|
2479
|
+
try {
|
|
2480
|
+
await server.stop();
|
|
2481
|
+
} catch (cleanupError) {
|
|
2482
|
+
if (options.debug || DEBUG_SERVER) {
|
|
2483
|
+
const msg = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
2484
|
+
console.warn(`[TestServer] Cleanup failed after startup error: ${msg}`);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
const isEADDRINUSE = error instanceof Error && (error.message.includes("EADDRINUSE") || server.getLogs().some((l) => l.includes("EADDRINUSE")));
|
|
2488
|
+
if (isEADDRINUSE && attempt < maxAttempts) {
|
|
2489
|
+
const delayMs = attempt * 500;
|
|
2490
|
+
if (options.debug || DEBUG_SERVER) {
|
|
2491
|
+
console.warn(
|
|
2492
|
+
`[TestServer] EADDRINUSE on port ${port}, retrying in ${delayMs}ms (attempt ${attempt}/${maxAttempts})`
|
|
2493
|
+
);
|
|
2494
|
+
}
|
|
2495
|
+
await sleep2(delayMs);
|
|
2496
|
+
continue;
|
|
2497
|
+
}
|
|
2498
|
+
throw error;
|
|
2499
|
+
}
|
|
2454
2500
|
}
|
|
2455
|
-
|
|
2501
|
+
throw new Error(`[TestServer] Failed to start after ${maxAttempts} attempts`);
|
|
2456
2502
|
}
|
|
2457
2503
|
/**
|
|
2458
2504
|
* Start an Nx project as test server
|
|
@@ -2463,22 +2509,44 @@ var TestServer = class _TestServer {
|
|
|
2463
2509
|
`Invalid project name: ${project}. Must contain only alphanumeric, underscore, and hyphen characters.`
|
|
2464
2510
|
);
|
|
2465
2511
|
}
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2512
|
+
const maxAttempts = 3;
|
|
2513
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
2514
|
+
const { port, release } = await reservePort(project, options.port);
|
|
2515
|
+
const serverOptions = {
|
|
2516
|
+
...options,
|
|
2517
|
+
port,
|
|
2518
|
+
project,
|
|
2519
|
+
command: `npx nx serve ${project} --port ${port}`,
|
|
2520
|
+
cwd: options.cwd ?? process.cwd()
|
|
2521
|
+
};
|
|
2522
|
+
const server = new _TestServer(serverOptions, port, release);
|
|
2523
|
+
try {
|
|
2524
|
+
await server.startProcess();
|
|
2525
|
+
return server;
|
|
2526
|
+
} catch (error) {
|
|
2527
|
+
try {
|
|
2528
|
+
await server.stop();
|
|
2529
|
+
} catch (cleanupError) {
|
|
2530
|
+
if (options.debug || DEBUG_SERVER) {
|
|
2531
|
+
const msg = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
2532
|
+
console.warn(`[TestServer] Cleanup failed after startup error: ${msg}`);
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
const isEADDRINUSE = error instanceof Error && (error.message.includes("EADDRINUSE") || server.getLogs().some((l) => l.includes("EADDRINUSE")));
|
|
2536
|
+
if (isEADDRINUSE && attempt < maxAttempts) {
|
|
2537
|
+
const delayMs = attempt * 500;
|
|
2538
|
+
if (options.debug || DEBUG_SERVER) {
|
|
2539
|
+
console.warn(
|
|
2540
|
+
`[TestServer] EADDRINUSE on port ${port}, retrying in ${delayMs}ms (attempt ${attempt}/${maxAttempts})`
|
|
2541
|
+
);
|
|
2542
|
+
}
|
|
2543
|
+
await sleep2(delayMs);
|
|
2544
|
+
continue;
|
|
2545
|
+
}
|
|
2546
|
+
throw error;
|
|
2547
|
+
}
|
|
2480
2548
|
}
|
|
2481
|
-
|
|
2549
|
+
throw new Error(`[TestServer] Failed to start after ${maxAttempts} attempts`);
|
|
2482
2550
|
}
|
|
2483
2551
|
/**
|
|
2484
2552
|
* Create a test server connected to an already running server
|
|
@@ -2515,7 +2583,21 @@ var TestServer = class _TestServer {
|
|
|
2515
2583
|
}
|
|
2516
2584
|
if (this.process) {
|
|
2517
2585
|
this.log("Stopping server...");
|
|
2518
|
-
this.process.
|
|
2586
|
+
if (this.process.exitCode !== null || this.process.signalCode !== null) {
|
|
2587
|
+
this.log(`Server already exited (code: ${this.process.exitCode}, signal: ${this.process.signalCode})`);
|
|
2588
|
+
this.process = null;
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
const pid = this.process.pid;
|
|
2592
|
+
try {
|
|
2593
|
+
if (pid !== void 0) {
|
|
2594
|
+
process.kill(-pid, "SIGTERM");
|
|
2595
|
+
} else {
|
|
2596
|
+
this.process.kill("SIGTERM");
|
|
2597
|
+
}
|
|
2598
|
+
} catch {
|
|
2599
|
+
this.process.kill("SIGTERM");
|
|
2600
|
+
}
|
|
2519
2601
|
const exitPromise = new Promise((resolve) => {
|
|
2520
2602
|
if (this.process) {
|
|
2521
2603
|
this.process.once("exit", () => resolve());
|
|
@@ -2526,7 +2608,16 @@ var TestServer = class _TestServer {
|
|
|
2526
2608
|
const killTimeout = setTimeout(() => {
|
|
2527
2609
|
if (this.process) {
|
|
2528
2610
|
this.log("Force killing server after timeout...");
|
|
2529
|
-
this.process.
|
|
2611
|
+
const killPid = this.process.pid;
|
|
2612
|
+
try {
|
|
2613
|
+
if (killPid !== void 0) {
|
|
2614
|
+
process.kill(-killPid, "SIGKILL");
|
|
2615
|
+
} else {
|
|
2616
|
+
this.process.kill("SIGKILL");
|
|
2617
|
+
}
|
|
2618
|
+
} catch {
|
|
2619
|
+
this.process.kill("SIGKILL");
|
|
2620
|
+
}
|
|
2530
2621
|
}
|
|
2531
2622
|
}, 5e3);
|
|
2532
2623
|
await exitPromise;
|
|
@@ -2591,14 +2682,17 @@ var TestServer = class _TestServer {
|
|
|
2591
2682
|
...this.options.env,
|
|
2592
2683
|
PORT: String(this.options.port)
|
|
2593
2684
|
};
|
|
2685
|
+
const runtimeEnv = withWorkspaceProtocolFallback(env, this.options.cwd);
|
|
2594
2686
|
if (this.portRelease) {
|
|
2595
2687
|
await this.portRelease();
|
|
2596
2688
|
this.portRelease = null;
|
|
2689
|
+
await sleep2(300);
|
|
2597
2690
|
}
|
|
2598
2691
|
this.process = (0, import_child_process.spawn)(this.options.command, [], {
|
|
2599
2692
|
cwd: this.options.cwd,
|
|
2600
|
-
env,
|
|
2693
|
+
env: runtimeEnv,
|
|
2601
2694
|
shell: true,
|
|
2695
|
+
detached: true,
|
|
2602
2696
|
stdio: ["pipe", "pipe", "pipe"]
|
|
2603
2697
|
});
|
|
2604
2698
|
if (this.process.pid !== void 0) {
|
|
@@ -2750,8 +2844,119 @@ TIP: Set DEBUG_SERVER=1 or DEBUG=1 environment variable for verbose output`
|
|
|
2750
2844
|
function sleep2(ms) {
|
|
2751
2845
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2752
2846
|
}
|
|
2847
|
+
function withWorkspaceProtocolFallback(env, cwd) {
|
|
2848
|
+
if (findInstalledProtocolPackageDir(cwd)) {
|
|
2849
|
+
return env;
|
|
2850
|
+
}
|
|
2851
|
+
try {
|
|
2852
|
+
const workspacePackageDir = findWorkspaceProtocolDir(cwd);
|
|
2853
|
+
if (!workspacePackageDir) {
|
|
2854
|
+
return env;
|
|
2855
|
+
}
|
|
2856
|
+
ensureWorkspaceProtocolLink(cwd, workspacePackageDir);
|
|
2857
|
+
if (findInstalledProtocolPackageDir(cwd)) {
|
|
2858
|
+
return env;
|
|
2859
|
+
}
|
|
2860
|
+
return withProtocolNodePathAlias(env, cwd, workspacePackageDir);
|
|
2861
|
+
} catch (err) {
|
|
2862
|
+
if (DEBUG_SERVER) {
|
|
2863
|
+
console.error(
|
|
2864
|
+
`[TestServer] Workspace protocol fallback failed: ${err instanceof Error ? err.message : String(err)}`
|
|
2865
|
+
);
|
|
2866
|
+
}
|
|
2867
|
+
return env;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
function ensureWorkspaceProtocolLink(cwd, workspacePackageDir) {
|
|
2871
|
+
const fs = require("node:fs");
|
|
2872
|
+
const path = require("node:path");
|
|
2873
|
+
const nodeModulesDir = findWorkspaceNodeModulesDir(cwd);
|
|
2874
|
+
if (!nodeModulesDir) {
|
|
2875
|
+
return;
|
|
2876
|
+
}
|
|
2877
|
+
const scopeDir = path.join(nodeModulesDir, "@frontmcp");
|
|
2878
|
+
const aliasPackageDir = path.join(scopeDir, "protocol");
|
|
2879
|
+
if (fs.existsSync(aliasPackageDir)) {
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
fs.mkdirSync(scopeDir, { recursive: true });
|
|
2883
|
+
try {
|
|
2884
|
+
fs.symlinkSync(workspacePackageDir, aliasPackageDir, process.platform === "win32" ? "junction" : "dir");
|
|
2885
|
+
} catch (error) {
|
|
2886
|
+
const err = error;
|
|
2887
|
+
if (err.code !== "EEXIST") {
|
|
2888
|
+
throw error;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
function withProtocolNodePathAlias(env, cwd, workspacePackageDir) {
|
|
2893
|
+
const fs = require("node:fs");
|
|
2894
|
+
const os = require("node:os");
|
|
2895
|
+
const path = require("node:path");
|
|
2896
|
+
const aliasRoot = path.join(os.tmpdir(), "frontmcp-test-node-path", (0, import_utils.sha256Hex)(cwd).slice(0, 12));
|
|
2897
|
+
const scopeDir = path.join(aliasRoot, "@frontmcp");
|
|
2898
|
+
const aliasPackageDir = path.join(scopeDir, "protocol");
|
|
2899
|
+
fs.mkdirSync(scopeDir, { recursive: true });
|
|
2900
|
+
try {
|
|
2901
|
+
if (!fs.existsSync(aliasPackageDir)) {
|
|
2902
|
+
fs.symlinkSync(workspacePackageDir, aliasPackageDir, process.platform === "win32" ? "junction" : "dir");
|
|
2903
|
+
}
|
|
2904
|
+
} catch (error) {
|
|
2905
|
+
const err = error;
|
|
2906
|
+
if (err.code !== "EEXIST") throw error;
|
|
2907
|
+
}
|
|
2908
|
+
const existingNodePath = env["NODE_PATH"];
|
|
2909
|
+
const nodePathEntries = [aliasRoot, ...existingNodePath ? existingNodePath.split(path.delimiter) : []].filter(
|
|
2910
|
+
Boolean
|
|
2911
|
+
);
|
|
2912
|
+
return {
|
|
2913
|
+
...env,
|
|
2914
|
+
NODE_PATH: [...new Set(nodePathEntries)].join(path.delimiter)
|
|
2915
|
+
};
|
|
2916
|
+
}
|
|
2917
|
+
function findUp(startDir, testFn) {
|
|
2918
|
+
const path = require("node:path");
|
|
2919
|
+
let currentDir = startDir;
|
|
2920
|
+
while (true) {
|
|
2921
|
+
const result = testFn(currentDir);
|
|
2922
|
+
if (result !== void 0) return result;
|
|
2923
|
+
const parentDir = path.dirname(currentDir);
|
|
2924
|
+
if (parentDir === currentDir) return void 0;
|
|
2925
|
+
currentDir = parentDir;
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
function findWorkspaceProtocolDir(startDir) {
|
|
2929
|
+
const fs = require("node:fs");
|
|
2930
|
+
const path = require("node:path");
|
|
2931
|
+
return findUp(startDir, (dir) => {
|
|
2932
|
+
const candidate = path.join(dir, "libs", "protocol");
|
|
2933
|
+
return fs.existsSync(path.join(candidate, "dist", "index.js")) ? candidate : void 0;
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
function findInstalledProtocolPackageDir(startDir) {
|
|
2937
|
+
const fs = require("node:fs");
|
|
2938
|
+
const path = require("node:path");
|
|
2939
|
+
return findUp(startDir, (dir) => {
|
|
2940
|
+
const candidate = path.join(dir, "node_modules", "@frontmcp", "protocol");
|
|
2941
|
+
return fs.existsSync(path.join(candidate, "package.json")) ? candidate : void 0;
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
function findWorkspaceNodeModulesDir(startDir) {
|
|
2945
|
+
const fs = require("node:fs");
|
|
2946
|
+
const path = require("node:path");
|
|
2947
|
+
return findUp(startDir, (dir) => {
|
|
2948
|
+
const candidate = path.join(dir, "node_modules");
|
|
2949
|
+
return fs.existsSync(candidate) ? candidate : void 0;
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2753
2952
|
|
|
2754
2953
|
// libs/testing/src/fixtures/test-fixture.ts
|
|
2954
|
+
var describe = import_globals.describe;
|
|
2955
|
+
var beforeAll = import_globals.beforeAll;
|
|
2956
|
+
var beforeEach = import_globals.beforeEach;
|
|
2957
|
+
var afterEach = import_globals.afterEach;
|
|
2958
|
+
var afterAll = import_globals.afterAll;
|
|
2959
|
+
var it = import_globals.it;
|
|
2755
2960
|
var currentConfig = {};
|
|
2756
2961
|
var serverInstance = null;
|
|
2757
2962
|
var tokenFactory = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-fixture.d.ts","sourceRoot":"","sources":["../../src/fixtures/test-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"test-fixture.d.ts","sourceRoot":"","sources":["../../src/fixtures/test-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAwBH,OAAO,KAAK,EAEV,YAAY,EAIZ,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAsBzB;;GAEG;AACH,iBAAe,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqDxD;AAED;;GAEG;AACH,iBAAe,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CA6BzD;AAED;;;;GAIG;AACH,iBAAe,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB5F;AAED;;GAEG;AACH,iBAAe,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQrD;AAmMD,QAAA,MAAM,IAAI,EAAuB,gBAAgB,CAAC;AAqBlD,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -71,7 +71,8 @@ export type { HttpMethod, HttpRequestMatcher, HttpMockResponse, HttpMockDefiniti
|
|
|
71
71
|
export { uiMatchers, UIAssertions } from './ui';
|
|
72
72
|
export type { TestPlatformType, PlatformMetaNamespace, TestClientInfo } from './platform';
|
|
73
73
|
export { getPlatformMetaNamespace, getPlatformMimeType, isOpenAIPlatform, isExtAppsPlatform, isUiPlatform, getToolsListMetaPrefixes, getToolCallMetaPrefixes, getForbiddenMetaPrefixes, getPlatformClientInfo, buildUserAgent, getPlatformUserAgent, PLATFORM_DETECTION_PATTERNS, } from './platform';
|
|
74
|
-
export { BASIC_UI_TOOL_CONFIG, FULL_UI_TOOL_CONFIG, basicUIToolInputSchema, basicUIToolOutputSchema, fullUIToolInputSchema, fullUIToolOutputSchema, generateBasicUIToolOutput, generateFullUIToolOutput, EXPECTED_OPENAI_TOOLS_LIST_META_KEYS, EXPECTED_OPENAI_TOOL_CALL_META_KEYS, EXPECTED_EXTAPPS_TOOLS_LIST_META_KEYS, EXPECTED_EXTAPPS_TOOL_CALL_META_KEYS,
|
|
74
|
+
export { BASIC_UI_TOOL_CONFIG, FULL_UI_TOOL_CONFIG, basicUIToolInputSchema, basicUIToolOutputSchema, fullUIToolInputSchema, fullUIToolOutputSchema, generateBasicUIToolOutput, generateFullUIToolOutput, EXPECTED_OPENAI_TOOLS_LIST_META_KEYS, EXPECTED_OPENAI_TOOL_CALL_META_KEYS, EXPECTED_EXTAPPS_TOOLS_LIST_META_KEYS, EXPECTED_EXTAPPS_TOOL_CALL_META_KEYS, EXPECTED_GENERIC_TOOLS_LIST_META_KEYS, EXPECTED_GENERIC_TOOL_CALL_META_KEYS, } from './example-tools';
|
|
75
75
|
export { perfTest, MetricsCollector, isGcAvailable, forceGc, forceFullGc, formatBytes, formatMicroseconds, formatDuration, LeakDetector, assertNoLeak, createLeakDetector, createPerfFixtures, PerfFixturesImpl, getGlobalMeasurements, clearGlobalMeasurements, BaselineStore, parseBaselineFromComment, formatBaselineAsComment, getBaselineStore, RegressionDetector, summarizeRegressions, getRegressionDetector, ReportGenerator, saveReports, createReportGenerator, } from './perf';
|
|
76
|
+
export { McpClient, McpStdioClientTransport } from './raw-client';
|
|
76
77
|
export type { MemoryMetrics, CpuMetrics, PerfSnapshot, PerfMeasurement, PerfIssue, PerfThresholds, LeakDetectionOptions, LeakDetectionResult, MetricBaseline, TestBaseline, PerfBaseline, RegressionConfig, MetricRegression, RegressionResult, PerfTestSummary, ProjectSummary, PerfReport, PerfFixtures, PerfTestFixtures, PerfTestConfig, PerfTestFn, PerfTestWithFixtures, } from './perf';
|
|
77
78
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,SAAS,GACV,MAAM,gCAAgC,CAAC;AAMxC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAAE,uBAA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