@frontmcp/testing 0.7.2 → 0.8.1
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/auth/index.d.ts +2 -0
- package/auth/index.d.ts.map +1 -1
- package/auth/mock-cimd-server.d.ts +174 -0
- package/auth/mock-cimd-server.d.ts.map +1 -0
- package/auth/mock-oauth-server.d.ts +136 -6
- package/auth/mock-oauth-server.d.ts.map +1 -1
- package/auth/token-factory.d.ts.map +1 -1
- package/client/index.d.ts +1 -1
- package/client/index.d.ts.map +1 -1
- package/client/mcp-test-client.builder.d.ts +12 -0
- package/client/mcp-test-client.builder.d.ts.map +1 -1
- package/client/mcp-test-client.d.ts +48 -2
- package/client/mcp-test-client.d.ts.map +1 -1
- package/client/mcp-test-client.types.d.ts +60 -0
- package/client/mcp-test-client.types.d.ts.map +1 -1
- package/esm/fixtures/index.mjs +661 -83
- package/esm/index.mjs +3245 -219
- package/esm/package.json +5 -4
- package/esm/perf/index.mjs +4334 -0
- package/esm/perf/perf-setup.mjs +31 -0
- package/fixtures/fixture-types.d.ts +10 -1
- package/fixtures/fixture-types.d.ts.map +1 -1
- package/fixtures/index.js +661 -93
- package/fixtures/test-fixture.d.ts +1 -1
- package/fixtures/test-fixture.d.ts.map +1 -1
- package/index.d.ts +5 -1
- package/index.d.ts.map +1 -1
- package/index.js +3271 -219
- package/interceptor/interceptor-chain.d.ts +1 -0
- package/interceptor/interceptor-chain.d.ts.map +1 -1
- package/package.json +5 -4
- package/perf/baseline-store.d.ts +67 -0
- package/perf/baseline-store.d.ts.map +1 -0
- package/perf/index.d.ts +44 -0
- package/perf/index.d.ts.map +1 -0
- package/perf/index.js +4404 -0
- package/perf/jest-perf-reporter.d.ts +6 -0
- package/perf/jest-perf-reporter.d.ts.map +1 -0
- package/perf/leak-detector.d.ts +81 -0
- package/perf/leak-detector.d.ts.map +1 -0
- package/perf/metrics-collector.d.ts +83 -0
- package/perf/metrics-collector.d.ts.map +1 -0
- package/perf/perf-fixtures.d.ts +107 -0
- package/perf/perf-fixtures.d.ts.map +1 -0
- package/perf/perf-setup.d.ts +9 -0
- package/perf/perf-setup.d.ts.map +1 -0
- package/perf/perf-setup.js +50 -0
- package/perf/perf-test.d.ts +69 -0
- package/perf/perf-test.d.ts.map +1 -0
- package/perf/regression-detector.d.ts +55 -0
- package/perf/regression-detector.d.ts.map +1 -0
- package/perf/report-generator.d.ts +66 -0
- package/perf/report-generator.d.ts.map +1 -0
- package/perf/types.d.ts +439 -0
- package/perf/types.d.ts.map +1 -0
- package/platform/platform-client-info.d.ts +18 -0
- package/platform/platform-client-info.d.ts.map +1 -1
- package/server/index.d.ts +2 -0
- package/server/index.d.ts.map +1 -1
- package/server/port-registry.d.ts +179 -0
- package/server/port-registry.d.ts.map +1 -0
- package/server/test-server.d.ts +9 -5
- package/server/test-server.d.ts.map +1 -1
- package/transport/streamable-http.transport.d.ts +26 -0
- package/transport/streamable-http.transport.d.ts.map +1 -1
- package/transport/transport.interface.d.ts +9 -1
- package/transport/transport.interface.d.ts.map +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { JsonRpcRequest, JsonRpcResponse } from '../transport/transport.interface';
|
|
6
6
|
import type { InterceptorChain, RequestInterceptor, ResponseInterceptor, InterceptorContext, MockRegistry } from './interceptor.types';
|
|
7
|
+
export type { InterceptorResult, ResponseInterceptorResult } from './interceptor.types';
|
|
7
8
|
/**
|
|
8
9
|
* Default implementation of InterceptorChain
|
|
9
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor-chain.d.ts","sourceRoot":"","sources":["../../src/interceptor/interceptor-chain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,
|
|
1
|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E,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,GAAiB,kBAAkB;IAO1F;;OAEG;cACO,MAAM,GAAG,kBAAkB;IAOrC;;OAEG;wBACiB,CAAC,GAAG,EAAE,kBAAkB,KAAK,OAAO,SAAS,KAAK,GAAG,MAAM,GAAG,kBAAkB;IAUpG;;OAEG;yBACkB,MAAM,YAAY,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,GAAG,kBAAkB;IASvG;;OAEG;2BACmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,GAAiB,mBAAmB;IAQnG;;OAEG;2BACoB,MAAM,YAAY,CAAC,QAAQ,EAAE,eAAe,KAAK,eAAe,GAAG,mBAAmB;CAQ9G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "E2E testing framework for FrontMCP servers - MCP client, auth mocks, Playwright integration",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"./esm": null
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@frontmcp/sdk": "0.
|
|
91
|
-
"@frontmcp/ui": "0.
|
|
90
|
+
"@frontmcp/sdk": "0.8.1",
|
|
91
|
+
"@frontmcp/ui": "0.8.1",
|
|
92
92
|
"@playwright/test": "^1.40.0",
|
|
93
93
|
"jest": "^29.0.0",
|
|
94
94
|
"@jest/globals": "^29.0.0"
|
|
@@ -111,7 +111,8 @@
|
|
|
111
111
|
"node": ">=22.0.0"
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@
|
|
114
|
+
"@frontmcp/utils": "0.8.1",
|
|
115
|
+
"@modelcontextprotocol/sdk": "1.25.3",
|
|
115
116
|
"jose": "^6.0.11",
|
|
116
117
|
"tslib": "^2.3.0"
|
|
117
118
|
},
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file baseline-store.ts
|
|
3
|
+
* @description Baseline storage for performance regression testing
|
|
4
|
+
*
|
|
5
|
+
* Baselines are stored as GitHub release comments and local JSON files.
|
|
6
|
+
* The storage format uses special markers for parsing:
|
|
7
|
+
*
|
|
8
|
+
* <!-- PERF_BASELINE_START -->
|
|
9
|
+
* ```json
|
|
10
|
+
* { ... baseline data ... }
|
|
11
|
+
* ```
|
|
12
|
+
* <!-- PERF_BASELINE_END -->
|
|
13
|
+
*/
|
|
14
|
+
import type { PerfBaseline, TestBaseline, PerfMeasurement } from './types';
|
|
15
|
+
/**
|
|
16
|
+
* Manages performance baselines stored in local files or GitHub releases.
|
|
17
|
+
*/
|
|
18
|
+
export declare class BaselineStore {
|
|
19
|
+
private baseline;
|
|
20
|
+
private readonly baselinePath;
|
|
21
|
+
constructor(baselinePath?: string);
|
|
22
|
+
/**
|
|
23
|
+
* Load baseline from local file.
|
|
24
|
+
*/
|
|
25
|
+
load(): Promise<PerfBaseline | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Save baseline to local file.
|
|
28
|
+
*/
|
|
29
|
+
save(baseline: PerfBaseline): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a test baseline by ID.
|
|
32
|
+
*/
|
|
33
|
+
getTestBaseline(testId: string): TestBaseline | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if baseline is loaded.
|
|
36
|
+
*/
|
|
37
|
+
isLoaded(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get the loaded baseline.
|
|
40
|
+
*/
|
|
41
|
+
getBaseline(): PerfBaseline | null;
|
|
42
|
+
/**
|
|
43
|
+
* Create a baseline from measurements.
|
|
44
|
+
*/
|
|
45
|
+
static createFromMeasurements(measurements: PerfMeasurement[], release: string, commitHash?: string): PerfBaseline;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse baseline JSON from a release comment body.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseBaselineFromComment(commentBody: string): PerfBaseline | null;
|
|
51
|
+
/**
|
|
52
|
+
* Format baseline as a GitHub release comment.
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatBaselineAsComment(baseline: PerfBaseline): string;
|
|
55
|
+
/**
|
|
56
|
+
* Build the GitHub API URL for release comments.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildReleaseCommentsUrl(owner: string, repo: string, releaseId: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* Get the global baseline store instance.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getBaselineStore(baselinePath?: string): BaselineStore;
|
|
63
|
+
/**
|
|
64
|
+
* Reset the global baseline store.
|
|
65
|
+
*/
|
|
66
|
+
export declare function resetBaselineStore(): void;
|
|
67
|
+
//# sourceMappingURL=baseline-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-store.d.ts","sourceRoot":"","sources":["../../src/perf/baseline-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAc3F;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,YAAY,GAAE,MAA8B;IAIxD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAc1C;;OAEG;IACG,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAOpD;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,WAAW,IAAI,YAAY,GAAG,IAAI;IAIlC;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,YAAY,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY;CA0CnH;AAMD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAqBjF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAetE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9F;AAyDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,CAKrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
package/perf/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Barrel exports for performance testing module
|
|
4
|
+
*
|
|
5
|
+
* @example Basic Usage
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { perfTest, expect } from '@frontmcp/testing';
|
|
8
|
+
*
|
|
9
|
+
* perfTest.describe('Cache Performance', () => {
|
|
10
|
+
* perfTest.use({
|
|
11
|
+
* server: 'apps/e2e/demo-e2e-cache/src/main.ts',
|
|
12
|
+
* project: 'demo-e2e-cache',
|
|
13
|
+
* publicMode: true,
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* perfTest('cache operations memory overhead', async ({ mcp, perf }) => {
|
|
17
|
+
* await perf.baseline();
|
|
18
|
+
*
|
|
19
|
+
* for (let i = 0; i < 100; i++) {
|
|
20
|
+
* await mcp.tools.call('expensive-operation', { operationId: `test-${i}` });
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* perf.assertThresholds({ maxHeapDelta: 10 * 1024 * 1024 }); // 10MB
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* perfTest('no memory leak on repeated cache hits', async ({ mcp, perf }) => {
|
|
27
|
+
* const result = await perf.checkLeak(
|
|
28
|
+
* () => mcp.tools.call('expensive-operation', { operationId: 'leak-test' }),
|
|
29
|
+
* { iterations: 50, threshold: 5 * 1024 * 1024 }
|
|
30
|
+
* );
|
|
31
|
+
* expect(result.hasLeak).toBe(false);
|
|
32
|
+
* });
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export type { MemoryMetrics, CpuMetrics, PerfSnapshot, PerfMeasurement, PerfIssue, PerfThresholds, LeakDetectionOptions, LeakDetectionResult, IntervalMeasurement, MemoryGraphPoint, ParallelTestClient, WorkerStats, ParallelLeakDetectionOptions, ParallelLeakDetectionResult, MetricBaseline, TestBaseline, PerfBaseline, RegressionConfig, MetricRegression, RegressionResult, PerfTestSummary, ProjectSummary, PerfReport, PerfFixtures, PerfTestFixtures, PerfTestConfig, } from './types';
|
|
37
|
+
export { MetricsCollector, isGcAvailable, forceGc, forceFullGc, formatBytes, formatMicroseconds, formatDuration, getGlobalCollector, resetGlobalCollector, } from './metrics-collector';
|
|
38
|
+
export { LeakDetector, assertNoLeak, createLeakDetector } from './leak-detector';
|
|
39
|
+
export { createPerfFixtures, PerfFixturesImpl, addGlobalMeasurement, getGlobalMeasurements, clearGlobalMeasurements, getMeasurementsForProject, } from './perf-fixtures';
|
|
40
|
+
export { perfTest, type PerfTestFn, type PerfTestWithFixtures } from './perf-test';
|
|
41
|
+
export { BaselineStore, parseBaselineFromComment, formatBaselineAsComment, buildReleaseCommentsUrl, getBaselineStore, resetBaselineStore, } from './baseline-store';
|
|
42
|
+
export { RegressionDetector, summarizeRegressions, filterByStatus, getMostSevereMetric, getRegressionDetector, resetRegressionDetector, } from './regression-detector';
|
|
43
|
+
export { ReportGenerator, saveReports, createReportGenerator } from './report-generator';
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/perf/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,YAAY,EAEV,aAAa,EACb,UAAU,EACV,YAAY,EAGZ,eAAe,EACf,SAAS,EACT,cAAc,EAGd,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAGhB,kBAAkB,EAClB,WAAW,EACX,4BAA4B,EAC5B,2BAA2B,EAG3B,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAGhB,eAAe,EACf,cAAc,EACd,UAAU,EAGV,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC;AAMjB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAMjF,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMnF,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,mBAAmB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