@frontmcp/testing 1.7.2 → 1.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/client/index.d.ts +1 -1
- package/client/index.d.ts.map +1 -1
- package/client/mcp-test-client.builder.d.ts +2 -1
- package/client/mcp-test-client.builder.d.ts.map +1 -1
- package/client/mcp-test-client.d.ts +11 -3
- package/client/mcp-test-client.d.ts.map +1 -1
- package/client/mcp-test-client.types.d.ts +17 -3
- package/client/mcp-test-client.types.d.ts.map +1 -1
- package/esm/fixtures/index.mjs +670 -458
- package/esm/index.mjs +780 -569
- package/esm/matchers/index.mjs +5 -6
- package/esm/package.json +6 -6
- package/esm/perf/index.mjs +600 -426
- package/esm/setup.mjs +5 -6
- package/fixtures/fixture-types.d.ts +34 -3
- package/fixtures/fixture-types.d.ts.map +1 -1
- package/fixtures/index.js +670 -458
- package/fixtures/test-fixture.d.ts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +780 -569
- package/matchers/index.js +5 -6
- package/matchers/matcher-types.d.ts +3 -2
- package/matchers/matcher-types.d.ts.map +1 -1
- package/matchers/mcp-matchers.d.ts +1 -1
- package/matchers/mcp-matchers.d.ts.map +1 -1
- package/package.json +6 -6
- package/perf/index.js +600 -426
- package/setup.js +5 -6
- package/transport/index.d.ts +1 -1
- package/transport/index.d.ts.map +1 -1
- package/transport/streamable-http.transport.d.ts +18 -2
- package/transport/streamable-http.transport.d.ts.map +1 -1
- package/transport/transport.interface.d.ts +17 -1
- package/transport/transport.interface.d.ts.map +1 -1
package/matchers/index.js
CHANGED
|
@@ -389,18 +389,17 @@ var toBeError = function(received, expectedCode) {
|
|
|
389
389
|
message: () => `Expected a result wrapper object with isError property`
|
|
390
390
|
};
|
|
391
391
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
392
|
+
const receivedCode = typeof expectedCode === "string" ? result.raw?._meta?.["code"] : result.error?.code;
|
|
393
|
+
const codeMatches = expectedCode === void 0 || receivedCode === expectedCode;
|
|
394
|
+
const pass = result.isError && codeMatches;
|
|
396
395
|
return {
|
|
397
396
|
pass,
|
|
398
397
|
message: () => {
|
|
399
398
|
if (!result.isError) {
|
|
400
399
|
return "Expected result to be an error, but it was successful";
|
|
401
400
|
}
|
|
402
|
-
if (
|
|
403
|
-
return `Expected error code ${expectedCode}, but got ${
|
|
401
|
+
if (!codeMatches) {
|
|
402
|
+
return `Expected error code ${expectedCode}, but got ${String(receivedCode)}`;
|
|
404
403
|
}
|
|
405
404
|
return "Expected result not to be an error";
|
|
406
405
|
}
|
|
@@ -32,16 +32,17 @@ export interface McpMatchers<R = unknown> {
|
|
|
32
32
|
toBeSuccessful(): R;
|
|
33
33
|
/**
|
|
34
34
|
* Check if result is an error, optionally with a specific error code
|
|
35
|
-
* @param expectedCode -
|
|
35
|
+
* @param expectedCode - A JSON-RPC error code (number), or a tool error code (string) matched against `_meta.code`
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```typescript
|
|
39
39
|
* const result = await mcp.tools.call('unknown-tool', {});
|
|
40
40
|
* expect(result).toBeError();
|
|
41
41
|
* expect(result).toBeError(-32601); // Method not found
|
|
42
|
+
* expect(await mcp.tools.call('add', { a: 5 })).toBeError('INVALID_INPUT');
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
|
-
toBeError(expectedCode?: number): R;
|
|
45
|
+
toBeError(expectedCode?: number | string): R;
|
|
45
46
|
/**
|
|
46
47
|
* Check if tool result has text content, optionally containing specific text
|
|
47
48
|
* @param expectedText - Optional text that should be contained in the result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher-types.d.ts","sourceRoot":"","sources":["../../src/matchers/matcher-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IAKtC;;;;;;;;;OASG;IACH,aA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G;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC;IAMjC;;;;;;;;;OASG;IACH,kBAAkB,IAAI,CAAC,CAAC;IAExB;;;;;;;;;OASG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAErC;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;IAE/C;;;;;;;OAOG;IACH,WAAW,IAAI,CAAC,CAAC;IAEjB;;;;;;;OAOG;IACH,oBAAoB,IAAI,CAAC,CAAC;IAE1B;;;;;;;;OAQG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC;IAErC;;;;;;;;;OASG;IACH,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,yBAAyB,IAAI,CAAC,CAAC;CAChC;AAQD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QAEb,UAAU,QAAQ,CAAC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;SAAG;QAG/C,UAAU,MAAO,SAAQ,WAAW,CAAC,IAAI,CAAC;SAAG;QAG7C,UAAU,yBAA0B,SAAQ,WAAW,CAAC,IAAI,CAAC;SAAG;KACjE;CACF;AAID,OAAO,EAAE,CAAC"}
|
|
@@ -38,7 +38,7 @@ export declare const mcpMatchers: {
|
|
|
38
38
|
toHavePlatformHtml: MatcherFunction<[platform: import("..").TestPlatformType]>;
|
|
39
39
|
toContainTool: MatcherFunction<[toolName: string]>;
|
|
40
40
|
toBeSuccessful: MatcherFunction<[]>;
|
|
41
|
-
toBeError: MatcherFunction<[expectedCode?: number | undefined]>;
|
|
41
|
+
toBeError: MatcherFunction<[expectedCode?: string | number | undefined]>;
|
|
42
42
|
toHaveTextContent: MatcherFunction<[expectedText?: string | undefined]>;
|
|
43
43
|
toHaveImageContent: MatcherFunction<[]>;
|
|
44
44
|
toHaveResourceContent: MatcherFunction<[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-matchers.d.ts","sourceRoot":"","sources":["../../src/matchers/mcp-matchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-matchers.d.ts","sourceRoot":"","sources":["../../src/matchers/mcp-matchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AA6a9C;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/testing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.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,9 +87,9 @@
|
|
|
87
87
|
"./esm": null
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@frontmcp/lazy-zod": "1.
|
|
91
|
-
"@frontmcp/sdk": "1.
|
|
92
|
-
"@frontmcp/ui": "1.
|
|
90
|
+
"@frontmcp/lazy-zod": "1.8.1",
|
|
91
|
+
"@frontmcp/sdk": "1.8.1",
|
|
92
|
+
"@frontmcp/ui": "1.8.1",
|
|
93
93
|
"@jest/globals": "^29.0.0 || ^30.0.0",
|
|
94
94
|
"@playwright/test": "^1.40.0",
|
|
95
95
|
"jest": "^29.0.0 || ^30.0.0"
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"node": ">=24.0.0"
|
|
113
113
|
},
|
|
114
114
|
"dependencies": {
|
|
115
|
-
"@frontmcp/protocol": "1.
|
|
116
|
-
"@frontmcp/utils": "1.
|
|
115
|
+
"@frontmcp/protocol": "1.8.1",
|
|
116
|
+
"@frontmcp/utils": "1.8.1",
|
|
117
117
|
"jose": "^6.0.11",
|
|
118
118
|
"tslib": "^2.3.0"
|
|
119
119
|
},
|