tina4-nodejs 3.13.161 → 3.13.163
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/CLAUDE.md +2 -2
- package/package.json +1 -1
- package/packages/cli/dist/bin.js +265 -135
- package/packages/cli/src/commands/test.ts +2 -2
- package/packages/core/dist/index.js +264 -133
- package/packages/core/src/index.ts +1 -1
- package/packages/core/src/mcp.ts +10 -4
- package/packages/core/src/queueBackends/kafkaBackend.ts +56 -10
- package/packages/core/src/server.ts +71 -15
- package/packages/core/src/testing.ts +181 -69
- package/packages/orm/dist/index.js +263 -133
- package/types/core/src/index.d.ts +1 -1
- package/types/core/src/mcp.d.ts +2 -2
- package/types/core/src/testing.d.ts +27 -4
|
@@ -80,7 +80,7 @@ export { MongoSessionHandler } from "./sessionHandlers/mongoHandler.js";
|
|
|
80
80
|
export type { MongoSessionConfig } from "./sessionHandlers/mongoHandler.js";
|
|
81
81
|
export { ValkeySessionHandler } from "./sessionHandlers/valkeyHandler.js";
|
|
82
82
|
export type { ValkeySessionConfig } from "./sessionHandlers/valkeyHandler.js";
|
|
83
|
-
export { tests, expectEqual, expectRaises, expectTrue, expectFalse, runAll, reset } from "./testing.js";
|
|
83
|
+
export { tests, expectEqual, expectRaises, expectTrue, expectFalse, runAll, runAllAsync, reset } from "./testing.js";
|
|
84
84
|
export { TestClient, TestResponse } from "./testClient.js";
|
|
85
85
|
export { Tina4Test, AssertionError as Tina4AssertionError } from "./test.js";
|
|
86
86
|
export type { TestRunResults } from "./test.js";
|
package/types/core/src/mcp.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface McpResourceDefinition {
|
|
|
21
21
|
name: string;
|
|
22
22
|
description: string;
|
|
23
23
|
mimeType: string;
|
|
24
|
-
handler: () => unknown
|
|
24
|
+
handler: () => unknown | Promise<unknown>;
|
|
25
25
|
}
|
|
26
26
|
export interface JsonSchema {
|
|
27
27
|
type: string;
|
|
@@ -179,7 +179,7 @@ export declare class McpServer {
|
|
|
179
179
|
*/
|
|
180
180
|
sseStream(sessionId: string, endpointUrl: string, keepaliveMs?: number): AsyncGenerator<string>;
|
|
181
181
|
registerTool(name: string, handler: (args: Record<string, unknown>) => unknown, description?: string, schema?: JsonSchema): void;
|
|
182
|
-
registerResource(uri: string, handler: () => unknown
|
|
182
|
+
registerResource(uri: string, handler: () => unknown | Promise<unknown>, description?: string, mimeType?: string): void;
|
|
183
183
|
handleMessage(rawData: string | Record<string, unknown>): Promise<string>;
|
|
184
184
|
private _handleInitialize;
|
|
185
185
|
private _handleInitialized;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* return a + b;
|
|
14
14
|
* });
|
|
15
15
|
*
|
|
16
|
-
* runAll();
|
|
16
|
+
* runAll(); // synchronous test functions
|
|
17
|
+
* await runAllAsync(); // async test functions (awaited, with a timeout)
|
|
17
18
|
*
|
|
18
19
|
* The builders are named expect* — DESCRIPTORS that record an expectation for the
|
|
19
20
|
* runner — deliberately distinct from the xUnit assert* on Tina4Test (test.ts),
|
|
@@ -52,11 +53,33 @@ export declare function expectFalse(args: unknown[]): Assertion;
|
|
|
52
53
|
* const myFn = tests(assertEqual([1,2], 3))(function myFn(a,b) { return a+b; });
|
|
53
54
|
*/
|
|
54
55
|
export declare function tests(...assertions: Assertion[]): <T extends (...args: unknown[]) => unknown>(fn: T) => T;
|
|
55
|
-
|
|
56
|
-
export declare function runAll(options?: {
|
|
56
|
+
interface RunOptions {
|
|
57
57
|
quiet?: boolean;
|
|
58
58
|
failfast?: boolean;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
|
+
interface AsyncRunOptions extends RunOptions {
|
|
61
|
+
/** Per-call limit in milliseconds for an async test function (default 30000). */
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Run all registered tests synchronously. Returns the results summary.
|
|
66
|
+
*
|
|
67
|
+
* A test function that returns a Promise (an async function) cannot be judged
|
|
68
|
+
* here: its result is not known yet. It is reported as an ERROR naming
|
|
69
|
+
* `runAllAsync()`, never as a pass. Use `await runAllAsync()` for async tests.
|
|
70
|
+
*/
|
|
71
|
+
export declare function runAll(options?: RunOptions): TestResults;
|
|
72
|
+
/**
|
|
73
|
+
* Run all registered tests, awaiting each test function. Resolves to the
|
|
74
|
+
* results summary.
|
|
75
|
+
*
|
|
76
|
+
* An async function is judged on what it resolves to or rejects with. A call
|
|
77
|
+
* that has not settled after `timeoutMs` (default 30000) is reported as an
|
|
78
|
+
* error, so one stuck test cannot hang the run. `timeoutMs: Infinity` turns the
|
|
79
|
+
* timeout off; any other value must be a positive number of milliseconds no
|
|
80
|
+
* larger than 2147483647 (the largest delay a Node timer accepts).
|
|
81
|
+
*/
|
|
82
|
+
export declare function runAllAsync(options?: AsyncRunOptions): Promise<TestResults>;
|
|
60
83
|
/** Reset the test registry (useful between test runs). */
|
|
61
84
|
export declare function reset(): void;
|
|
62
85
|
export {};
|