@jterrazz/test 6.3.0 → 6.4.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/dist/index.cjs +75 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -21
- package/dist/index.d.ts +51 -21
- package/dist/index.js +75 -39
- package/dist/index.js.map +1 -1
- package/dist/intercept.cjs +3 -3
- package/dist/intercept.cjs.map +1 -1
- package/dist/intercept.d.cts +3 -3
- package/dist/intercept.d.ts +3 -3
- package/dist/intercept.js +3 -3
- package/dist/intercept.js.map +1 -1
- package/dist/{server.cjs → intercept2.cjs} +2 -2
- package/dist/intercept2.cjs.map +1 -0
- package/dist/{server.js → intercept2.js} +2 -2
- package/dist/intercept2.js.map +1 -0
- package/dist/mock-of.cjs +2 -2
- package/dist/mock-of.cjs.map +1 -1
- package/dist/mock-of.d.cts +2 -2
- package/dist/mock-of.d.ts +2 -2
- package/dist/mock-of.js +2 -2
- package/dist/mock-of.js.map +1 -1
- package/dist/sqlite.adapter.cjs.map +1 -1
- package/dist/sqlite.adapter.d.cts +3 -3
- package/dist/sqlite.adapter.d.ts +3 -3
- package/dist/sqlite.adapter.js.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/server.cjs.map +0 -1
- package/dist/server.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as InterceptResponse, r as InterceptTrigger } from "./types.cjs";
|
|
2
1
|
import { a as PostgresOptions, c as IsolationStrategy, i as redis, l as DatabasePort, n as sqlite, o as postgres, r as RedisOptions, s as ServiceHandle, t as SqliteOptions } from "./sqlite.adapter.cjs";
|
|
2
|
+
import { n as InterceptResponse, r as InterceptTrigger } from "./types.cjs";
|
|
3
3
|
import { i as mockOfDate, n as mockOf, r as MockDatePort, t as MockPort } from "./mock-of.cjs";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/builder/cli/command.port.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Result of executing a CLI command, including exit code and captured output streams.
|
|
8
8
|
*/
|
|
@@ -39,7 +39,7 @@ interface CommandPort {
|
|
|
39
39
|
spawn(args: string, cwd: string, options: SpawnOptions, env?: CommandEnv): Promise<CommandResult>;
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region src/
|
|
42
|
+
//#region src/builder/http/server.port.d.ts
|
|
43
43
|
/**
|
|
44
44
|
* HTTP response returned by a server port, with parsed JSON body.
|
|
45
45
|
*/
|
|
@@ -60,7 +60,7 @@ interface ServerPort {
|
|
|
60
60
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
61
61
|
}
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region src/builder/directory-accessor.d.ts
|
|
63
|
+
//#region src/builder/common/directory-accessor.d.ts
|
|
64
64
|
interface DirectorySnapshotOptions {
|
|
65
65
|
/** Extra path segments to ignore (in addition to default: .git, node_modules, etc.). */
|
|
66
66
|
ignore?: string[];
|
|
@@ -93,7 +93,7 @@ declare class DirectoryAccessor {
|
|
|
93
93
|
}): Promise<string[]>;
|
|
94
94
|
}
|
|
95
95
|
//#endregion
|
|
96
|
-
//#region src/builder/response-accessor.d.ts
|
|
96
|
+
//#region src/builder/common/response-accessor.d.ts
|
|
97
97
|
/** Accessor for an HTTP response body with file-based assertion support. */
|
|
98
98
|
declare class ResponseAccessor {
|
|
99
99
|
readonly body: unknown;
|
|
@@ -108,7 +108,7 @@ declare class ResponseAccessor {
|
|
|
108
108
|
toMatchFile(file: string): void;
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region src/builder/table-assertion.d.ts
|
|
111
|
+
//#region src/builder/common/table-assertion.d.ts
|
|
112
112
|
/** Assertion helper for verifying database table contents after a specification run. */
|
|
113
113
|
declare class TableAssertion {
|
|
114
114
|
private tableName;
|
|
@@ -131,7 +131,7 @@ declare class TableAssertion {
|
|
|
131
131
|
toBeEmpty(): Promise<void>;
|
|
132
132
|
}
|
|
133
133
|
//#endregion
|
|
134
|
-
//#region src/builder/
|
|
134
|
+
//#region src/builder/common/result.d.ts
|
|
135
135
|
/** Read-only handle to a single file produced by a CLI action. */
|
|
136
136
|
interface FileAccessor {
|
|
137
137
|
/** The UTF-8 text content. Throws if the file does not exist. */
|
|
@@ -191,12 +191,18 @@ declare class SpecificationResult {
|
|
|
191
191
|
}
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region src/builder/specification-builder.d.ts
|
|
194
|
+
/** A named job that can be triggered via .job(). */
|
|
195
|
+
interface JobHandle$1 {
|
|
196
|
+
name: string;
|
|
197
|
+
execute: () => Promise<void>;
|
|
198
|
+
}
|
|
194
199
|
/** Adapter configuration passed to the specification runner at setup time. */
|
|
195
200
|
interface SpecificationConfig {
|
|
196
201
|
command?: CommandPort;
|
|
197
202
|
database?: DatabasePort;
|
|
198
203
|
databases?: Map<string, DatabasePort>;
|
|
199
204
|
fixturesRoot?: string;
|
|
205
|
+
jobs?: JobHandle$1[];
|
|
200
206
|
server?: ServerPort;
|
|
201
207
|
}
|
|
202
208
|
/**
|
|
@@ -212,6 +218,7 @@ declare class SpecificationBuilder {
|
|
|
212
218
|
private config;
|
|
213
219
|
private fixtures;
|
|
214
220
|
private intercepts;
|
|
221
|
+
private jobName;
|
|
215
222
|
private label;
|
|
216
223
|
private mocks;
|
|
217
224
|
private projectName;
|
|
@@ -300,6 +307,15 @@ declare class SpecificationBuilder {
|
|
|
300
307
|
exec(args: string | string[]): this;
|
|
301
308
|
/** Spawn a long-running CLI process with custom spawn options (e.g. timeout, signal). */
|
|
302
309
|
spawn(args: string, options: SpawnOptions): this;
|
|
310
|
+
/**
|
|
311
|
+
* Execute a named job registered via the app() factory.
|
|
312
|
+
*
|
|
313
|
+
* @param name - The job name to trigger (must match a registered JobHandle.name).
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* spec('pipeline').intercept(openai.chat(), openai.response({...})).job('report-refresh').run();
|
|
317
|
+
*/
|
|
318
|
+
job(name: string): this;
|
|
303
319
|
/**
|
|
304
320
|
* Execute the specification: run seeds, copy fixtures, then perform the
|
|
305
321
|
* configured action (HTTP or CLI).
|
|
@@ -313,6 +329,7 @@ declare class SpecificationBuilder {
|
|
|
313
329
|
private resolveEnv;
|
|
314
330
|
private prepareWorkDir;
|
|
315
331
|
private runHttpAction;
|
|
332
|
+
private runJobAction;
|
|
316
333
|
private runCliAction;
|
|
317
334
|
}
|
|
318
335
|
/** Factory function returned by `cli()`, `integration()`, or `e2e()` that starts a new spec. */
|
|
@@ -409,7 +426,7 @@ declare class DockerAssertion {
|
|
|
409
426
|
getLogs(tail?: number): Promise<string>;
|
|
410
427
|
}
|
|
411
428
|
//#endregion
|
|
412
|
-
//#region src/
|
|
429
|
+
//#region src/infra/orchestrator.d.ts
|
|
413
430
|
interface OrchestratorOptions {
|
|
414
431
|
services: ServiceHandle[];
|
|
415
432
|
mode: 'e2e' | 'integration';
|
|
@@ -465,17 +482,30 @@ declare class Orchestrator {
|
|
|
465
482
|
getAppUrl(): null | string;
|
|
466
483
|
}
|
|
467
484
|
//#endregion
|
|
468
|
-
//#region src/
|
|
485
|
+
//#region src/spec/targets.d.ts
|
|
469
486
|
/** Any object with a request method compatible with Hono's app.request(). */
|
|
470
487
|
type HonoApp$1 = {
|
|
471
488
|
request: (path: string, init?: RequestInit) => Promise<Response> | Response;
|
|
472
489
|
};
|
|
490
|
+
/** A named job that can be triggered via .job(). */
|
|
491
|
+
interface JobHandle {
|
|
492
|
+
name: string;
|
|
493
|
+
execute: () => Promise<void>;
|
|
494
|
+
}
|
|
473
495
|
/** Services map passed to the app factory after infrastructure starts. */
|
|
474
496
|
type AppServices = Record<string, ServiceHandle>;
|
|
497
|
+
/**
|
|
498
|
+
* Return value from the app() factory. Either a bare server (backward compat)
|
|
499
|
+
* or an object with server + jobs for job-based testing.
|
|
500
|
+
*/
|
|
501
|
+
type AppFactoryResult = HonoApp$1 | {
|
|
502
|
+
server: HonoApp$1;
|
|
503
|
+
jobs: JobHandle[];
|
|
504
|
+
};
|
|
475
505
|
/** In-process Hono app target. Created by {@link app}. */
|
|
476
506
|
interface AppTarget {
|
|
477
507
|
readonly kind: 'app';
|
|
478
|
-
readonly factory: (services: AppServices) =>
|
|
508
|
+
readonly factory: (services: AppServices) => AppFactoryResult;
|
|
479
509
|
}
|
|
480
510
|
/** Docker compose stack target. Created by {@link stack}. */
|
|
481
511
|
interface StackTarget {
|
|
@@ -525,7 +555,7 @@ declare function stack(root: string): StackTarget;
|
|
|
525
555
|
*/
|
|
526
556
|
declare function command(bin: string): CommandTarget;
|
|
527
557
|
//#endregion
|
|
528
|
-
//#region src/
|
|
558
|
+
//#region src/spec/spec.d.ts
|
|
529
559
|
/** Shared options for all spec targets. */
|
|
530
560
|
interface SpecOptions {
|
|
531
561
|
/** Project root for fixture lookup and compose detection (relative paths supported). */
|
|
@@ -567,7 +597,7 @@ interface SpecRunner {
|
|
|
567
597
|
*/
|
|
568
598
|
declare function spec(target: SpecTarget, options?: SpecOptions): Promise<SpecRunner>;
|
|
569
599
|
//#endregion
|
|
570
|
-
//#region src/ports/container.port.d.ts
|
|
600
|
+
//#region src/infra/ports/container.port.d.ts
|
|
571
601
|
/**
|
|
572
602
|
* Abstract container interface.
|
|
573
603
|
* Represents a running service (database, cache, etc.)
|
|
@@ -587,7 +617,7 @@ interface ContainerPort {
|
|
|
587
617
|
getLogs(): Promise<string>;
|
|
588
618
|
}
|
|
589
619
|
//#endregion
|
|
590
|
-
//#region src/adapters/exec.adapter.d.ts
|
|
620
|
+
//#region src/builder/cli/adapters/exec.adapter.d.ts
|
|
591
621
|
/**
|
|
592
622
|
* Executes CLI commands via Node.js child_process.
|
|
593
623
|
* Uses `execSync` for one-shot commands and `spawn` for long-running processes.
|
|
@@ -600,7 +630,7 @@ declare class ExecAdapter implements CommandPort {
|
|
|
600
630
|
spawn(args: string, cwd: string, options: SpawnOptions, extraEnv?: CommandEnv): Promise<CommandResult>;
|
|
601
631
|
}
|
|
602
632
|
//#endregion
|
|
603
|
-
//#region src/adapters/fetch.adapter.d.ts
|
|
633
|
+
//#region src/builder/http/adapters/fetch.adapter.d.ts
|
|
604
634
|
/**
|
|
605
635
|
* Server adapter that sends real HTTP requests via the Fetch API.
|
|
606
636
|
* Used by the `e2e()` specification runner to hit a live server.
|
|
@@ -611,7 +641,7 @@ declare class FetchAdapter implements ServerPort {
|
|
|
611
641
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
612
642
|
}
|
|
613
643
|
//#endregion
|
|
614
|
-
//#region src/adapters/hono.adapter.d.ts
|
|
644
|
+
//#region src/builder/http/adapters/hono.adapter.d.ts
|
|
615
645
|
/**
|
|
616
646
|
* Server adapter that dispatches requests in-process through a Hono app instance.
|
|
617
647
|
* Used by the `integration()` specification runner -- no network overhead.
|
|
@@ -624,7 +654,7 @@ declare class HonoAdapter implements ServerPort {
|
|
|
624
654
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
625
655
|
}
|
|
626
656
|
//#endregion
|
|
627
|
-
//#region src/
|
|
657
|
+
//#region src/spec/legacy-integration.d.ts
|
|
628
658
|
type HonoApp = {
|
|
629
659
|
fetch: (...args: any[]) => any;
|
|
630
660
|
request: (path: string, init?: RequestInit) => Promise<Response> | Response;
|
|
@@ -650,7 +680,7 @@ interface SpecificationRunnerWithCleanup extends SpecificationRunner {
|
|
|
650
680
|
*/
|
|
651
681
|
declare function integration(options: IntegrationOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
652
682
|
//#endregion
|
|
653
|
-
//#region src/
|
|
683
|
+
//#region src/spec/legacy-cli.d.ts
|
|
654
684
|
interface CliOptions {
|
|
655
685
|
/** CLI command to run (resolved from node_modules/.bin or PATH). */
|
|
656
686
|
command: string;
|
|
@@ -665,7 +695,7 @@ interface CliOptions {
|
|
|
665
695
|
*/
|
|
666
696
|
declare function cli(options: CliOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
667
697
|
//#endregion
|
|
668
|
-
//#region src/
|
|
698
|
+
//#region src/spec/legacy-e2e.d.ts
|
|
669
699
|
interface E2eOptions {
|
|
670
700
|
/** Project root — must contain docker/compose.test.yaml. */
|
|
671
701
|
root?: string;
|
|
@@ -676,7 +706,7 @@ interface E2eOptions {
|
|
|
676
706
|
*/
|
|
677
707
|
declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
678
708
|
//#endregion
|
|
679
|
-
//#region src/
|
|
709
|
+
//#region src/builder/common/grep.d.ts
|
|
680
710
|
/**
|
|
681
711
|
* Extract text blocks from output that contain a pattern.
|
|
682
712
|
* Splits by blank lines (how linter/compiler output is structured),
|
|
@@ -688,7 +718,7 @@ declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithClean
|
|
|
688
718
|
*/
|
|
689
719
|
declare function grep(output: string, pattern: string): string;
|
|
690
720
|
//#endregion
|
|
691
|
-
//#region src/
|
|
721
|
+
//#region src/builder/common/reporter.d.ts
|
|
692
722
|
/** Strip ANSI escape codes from a string. */
|
|
693
723
|
declare function stripAnsi(str: string): string;
|
|
694
724
|
/** Strip ANSI codes and replace volatile tokens (ports, durations) with placeholders. */
|
|
@@ -698,5 +728,5 @@ declare function normalizeOutput(str: string): string;
|
|
|
698
728
|
/** Create a {@link DockerContainerPort} bound to an existing container by ID. */
|
|
699
729
|
declare function dockerContainer(containerId: string): DockerContainerPort;
|
|
700
730
|
//#endregion
|
|
701
|
-
export { type AppServices, type AppTarget, type CliOptions, type CommandEnv, type CommandPort, type CommandResult, type CommandTarget, type ContainerPort, type DatabasePort, DirectoryAccessor, type DirectorySnapshotOptions, DockerAssertion, type DockerContainerPort, type DockerInspectResult, type E2eOptions, ExecAdapter, FetchAdapter, type FileAccessor, HonoAdapter, type HttpTarget, type IntegrationOptions, type IsolationStrategy, type MockDatePort, type MockPort, Orchestrator, type PostgresOptions, type RedisOptions, ResponseAccessor, type ServerPort, type ServerResponse, type ServiceHandle, type SpawnOptions, type SpecOptions, type SpecRunner, type SpecTarget, SpecificationBuilder, type SpecificationConfig, SpecificationResult, type SpecificationRunner, type SpecificationRunnerWithCleanup, type SqliteOptions, type StackTarget, TableAssertion, app, cli, command, createSpecificationRunner, dockerContainer, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, spec, sqlite, stack, stripAnsi };
|
|
731
|
+
export { type AppFactoryResult, type AppServices, type AppTarget, type CliOptions, type CommandEnv, type CommandPort, type CommandResult, type CommandTarget, type ContainerPort, type DatabasePort, DirectoryAccessor, type DirectorySnapshotOptions, DockerAssertion, type DockerContainerPort, type DockerInspectResult, type E2eOptions, ExecAdapter, FetchAdapter, type FileAccessor, HonoAdapter, type HttpTarget, type IntegrationOptions, type IsolationStrategy, type JobHandle, type MockDatePort, type MockPort, Orchestrator, type PostgresOptions, type RedisOptions, ResponseAccessor, type ServerPort, type ServerResponse, type ServiceHandle, type SpawnOptions, type SpecOptions, type SpecRunner, type SpecTarget, SpecificationBuilder, type SpecificationConfig, SpecificationResult, type SpecificationRunner, type SpecificationRunnerWithCleanup, type SqliteOptions, type StackTarget, TableAssertion, app, cli, command, createSpecificationRunner, dockerContainer, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, spec, sqlite, stack, stripAnsi };
|
|
702
732
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as InterceptResponse, r as InterceptTrigger } from "./types.js";
|
|
2
1
|
import { a as PostgresOptions, c as IsolationStrategy, i as redis, l as DatabasePort, n as sqlite, o as postgres, r as RedisOptions, s as ServiceHandle, t as SqliteOptions } from "./sqlite.adapter.js";
|
|
2
|
+
import { n as InterceptResponse, r as InterceptTrigger } from "./types.js";
|
|
3
3
|
import { i as mockOfDate, n as mockOf, r as MockDatePort, t as MockPort } from "./mock-of.js";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/builder/cli/command.port.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Result of executing a CLI command, including exit code and captured output streams.
|
|
8
8
|
*/
|
|
@@ -39,7 +39,7 @@ interface CommandPort {
|
|
|
39
39
|
spawn(args: string, cwd: string, options: SpawnOptions, env?: CommandEnv): Promise<CommandResult>;
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region src/
|
|
42
|
+
//#region src/builder/http/server.port.d.ts
|
|
43
43
|
/**
|
|
44
44
|
* HTTP response returned by a server port, with parsed JSON body.
|
|
45
45
|
*/
|
|
@@ -60,7 +60,7 @@ interface ServerPort {
|
|
|
60
60
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
61
61
|
}
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region src/builder/directory-accessor.d.ts
|
|
63
|
+
//#region src/builder/common/directory-accessor.d.ts
|
|
64
64
|
interface DirectorySnapshotOptions {
|
|
65
65
|
/** Extra path segments to ignore (in addition to default: .git, node_modules, etc.). */
|
|
66
66
|
ignore?: string[];
|
|
@@ -93,7 +93,7 @@ declare class DirectoryAccessor {
|
|
|
93
93
|
}): Promise<string[]>;
|
|
94
94
|
}
|
|
95
95
|
//#endregion
|
|
96
|
-
//#region src/builder/response-accessor.d.ts
|
|
96
|
+
//#region src/builder/common/response-accessor.d.ts
|
|
97
97
|
/** Accessor for an HTTP response body with file-based assertion support. */
|
|
98
98
|
declare class ResponseAccessor {
|
|
99
99
|
readonly body: unknown;
|
|
@@ -108,7 +108,7 @@ declare class ResponseAccessor {
|
|
|
108
108
|
toMatchFile(file: string): void;
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region src/builder/table-assertion.d.ts
|
|
111
|
+
//#region src/builder/common/table-assertion.d.ts
|
|
112
112
|
/** Assertion helper for verifying database table contents after a specification run. */
|
|
113
113
|
declare class TableAssertion {
|
|
114
114
|
private tableName;
|
|
@@ -131,7 +131,7 @@ declare class TableAssertion {
|
|
|
131
131
|
toBeEmpty(): Promise<void>;
|
|
132
132
|
}
|
|
133
133
|
//#endregion
|
|
134
|
-
//#region src/builder/
|
|
134
|
+
//#region src/builder/common/result.d.ts
|
|
135
135
|
/** Read-only handle to a single file produced by a CLI action. */
|
|
136
136
|
interface FileAccessor {
|
|
137
137
|
/** The UTF-8 text content. Throws if the file does not exist. */
|
|
@@ -191,12 +191,18 @@ declare class SpecificationResult {
|
|
|
191
191
|
}
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region src/builder/specification-builder.d.ts
|
|
194
|
+
/** A named job that can be triggered via .job(). */
|
|
195
|
+
interface JobHandle$1 {
|
|
196
|
+
name: string;
|
|
197
|
+
execute: () => Promise<void>;
|
|
198
|
+
}
|
|
194
199
|
/** Adapter configuration passed to the specification runner at setup time. */
|
|
195
200
|
interface SpecificationConfig {
|
|
196
201
|
command?: CommandPort;
|
|
197
202
|
database?: DatabasePort;
|
|
198
203
|
databases?: Map<string, DatabasePort>;
|
|
199
204
|
fixturesRoot?: string;
|
|
205
|
+
jobs?: JobHandle$1[];
|
|
200
206
|
server?: ServerPort;
|
|
201
207
|
}
|
|
202
208
|
/**
|
|
@@ -212,6 +218,7 @@ declare class SpecificationBuilder {
|
|
|
212
218
|
private config;
|
|
213
219
|
private fixtures;
|
|
214
220
|
private intercepts;
|
|
221
|
+
private jobName;
|
|
215
222
|
private label;
|
|
216
223
|
private mocks;
|
|
217
224
|
private projectName;
|
|
@@ -300,6 +307,15 @@ declare class SpecificationBuilder {
|
|
|
300
307
|
exec(args: string | string[]): this;
|
|
301
308
|
/** Spawn a long-running CLI process with custom spawn options (e.g. timeout, signal). */
|
|
302
309
|
spawn(args: string, options: SpawnOptions): this;
|
|
310
|
+
/**
|
|
311
|
+
* Execute a named job registered via the app() factory.
|
|
312
|
+
*
|
|
313
|
+
* @param name - The job name to trigger (must match a registered JobHandle.name).
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* spec('pipeline').intercept(openai.chat(), openai.response({...})).job('report-refresh').run();
|
|
317
|
+
*/
|
|
318
|
+
job(name: string): this;
|
|
303
319
|
/**
|
|
304
320
|
* Execute the specification: run seeds, copy fixtures, then perform the
|
|
305
321
|
* configured action (HTTP or CLI).
|
|
@@ -313,6 +329,7 @@ declare class SpecificationBuilder {
|
|
|
313
329
|
private resolveEnv;
|
|
314
330
|
private prepareWorkDir;
|
|
315
331
|
private runHttpAction;
|
|
332
|
+
private runJobAction;
|
|
316
333
|
private runCliAction;
|
|
317
334
|
}
|
|
318
335
|
/** Factory function returned by `cli()`, `integration()`, or `e2e()` that starts a new spec. */
|
|
@@ -409,7 +426,7 @@ declare class DockerAssertion {
|
|
|
409
426
|
getLogs(tail?: number): Promise<string>;
|
|
410
427
|
}
|
|
411
428
|
//#endregion
|
|
412
|
-
//#region src/
|
|
429
|
+
//#region src/infra/orchestrator.d.ts
|
|
413
430
|
interface OrchestratorOptions {
|
|
414
431
|
services: ServiceHandle[];
|
|
415
432
|
mode: 'e2e' | 'integration';
|
|
@@ -465,17 +482,30 @@ declare class Orchestrator {
|
|
|
465
482
|
getAppUrl(): null | string;
|
|
466
483
|
}
|
|
467
484
|
//#endregion
|
|
468
|
-
//#region src/
|
|
485
|
+
//#region src/spec/targets.d.ts
|
|
469
486
|
/** Any object with a request method compatible with Hono's app.request(). */
|
|
470
487
|
type HonoApp$1 = {
|
|
471
488
|
request: (path: string, init?: RequestInit) => Promise<Response> | Response;
|
|
472
489
|
};
|
|
490
|
+
/** A named job that can be triggered via .job(). */
|
|
491
|
+
interface JobHandle {
|
|
492
|
+
name: string;
|
|
493
|
+
execute: () => Promise<void>;
|
|
494
|
+
}
|
|
473
495
|
/** Services map passed to the app factory after infrastructure starts. */
|
|
474
496
|
type AppServices = Record<string, ServiceHandle>;
|
|
497
|
+
/**
|
|
498
|
+
* Return value from the app() factory. Either a bare server (backward compat)
|
|
499
|
+
* or an object with server + jobs for job-based testing.
|
|
500
|
+
*/
|
|
501
|
+
type AppFactoryResult = HonoApp$1 | {
|
|
502
|
+
server: HonoApp$1;
|
|
503
|
+
jobs: JobHandle[];
|
|
504
|
+
};
|
|
475
505
|
/** In-process Hono app target. Created by {@link app}. */
|
|
476
506
|
interface AppTarget {
|
|
477
507
|
readonly kind: 'app';
|
|
478
|
-
readonly factory: (services: AppServices) =>
|
|
508
|
+
readonly factory: (services: AppServices) => AppFactoryResult;
|
|
479
509
|
}
|
|
480
510
|
/** Docker compose stack target. Created by {@link stack}. */
|
|
481
511
|
interface StackTarget {
|
|
@@ -525,7 +555,7 @@ declare function stack(root: string): StackTarget;
|
|
|
525
555
|
*/
|
|
526
556
|
declare function command(bin: string): CommandTarget;
|
|
527
557
|
//#endregion
|
|
528
|
-
//#region src/
|
|
558
|
+
//#region src/spec/spec.d.ts
|
|
529
559
|
/** Shared options for all spec targets. */
|
|
530
560
|
interface SpecOptions {
|
|
531
561
|
/** Project root for fixture lookup and compose detection (relative paths supported). */
|
|
@@ -567,7 +597,7 @@ interface SpecRunner {
|
|
|
567
597
|
*/
|
|
568
598
|
declare function spec(target: SpecTarget, options?: SpecOptions): Promise<SpecRunner>;
|
|
569
599
|
//#endregion
|
|
570
|
-
//#region src/ports/container.port.d.ts
|
|
600
|
+
//#region src/infra/ports/container.port.d.ts
|
|
571
601
|
/**
|
|
572
602
|
* Abstract container interface.
|
|
573
603
|
* Represents a running service (database, cache, etc.)
|
|
@@ -587,7 +617,7 @@ interface ContainerPort {
|
|
|
587
617
|
getLogs(): Promise<string>;
|
|
588
618
|
}
|
|
589
619
|
//#endregion
|
|
590
|
-
//#region src/adapters/exec.adapter.d.ts
|
|
620
|
+
//#region src/builder/cli/adapters/exec.adapter.d.ts
|
|
591
621
|
/**
|
|
592
622
|
* Executes CLI commands via Node.js child_process.
|
|
593
623
|
* Uses `execSync` for one-shot commands and `spawn` for long-running processes.
|
|
@@ -600,7 +630,7 @@ declare class ExecAdapter implements CommandPort {
|
|
|
600
630
|
spawn(args: string, cwd: string, options: SpawnOptions, extraEnv?: CommandEnv): Promise<CommandResult>;
|
|
601
631
|
}
|
|
602
632
|
//#endregion
|
|
603
|
-
//#region src/adapters/fetch.adapter.d.ts
|
|
633
|
+
//#region src/builder/http/adapters/fetch.adapter.d.ts
|
|
604
634
|
/**
|
|
605
635
|
* Server adapter that sends real HTTP requests via the Fetch API.
|
|
606
636
|
* Used by the `e2e()` specification runner to hit a live server.
|
|
@@ -611,7 +641,7 @@ declare class FetchAdapter implements ServerPort {
|
|
|
611
641
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
612
642
|
}
|
|
613
643
|
//#endregion
|
|
614
|
-
//#region src/adapters/hono.adapter.d.ts
|
|
644
|
+
//#region src/builder/http/adapters/hono.adapter.d.ts
|
|
615
645
|
/**
|
|
616
646
|
* Server adapter that dispatches requests in-process through a Hono app instance.
|
|
617
647
|
* Used by the `integration()` specification runner -- no network overhead.
|
|
@@ -624,7 +654,7 @@ declare class HonoAdapter implements ServerPort {
|
|
|
624
654
|
request(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<ServerResponse>;
|
|
625
655
|
}
|
|
626
656
|
//#endregion
|
|
627
|
-
//#region src/
|
|
657
|
+
//#region src/spec/legacy-integration.d.ts
|
|
628
658
|
type HonoApp = {
|
|
629
659
|
fetch: (...args: any[]) => any;
|
|
630
660
|
request: (path: string, init?: RequestInit) => Promise<Response> | Response;
|
|
@@ -650,7 +680,7 @@ interface SpecificationRunnerWithCleanup extends SpecificationRunner {
|
|
|
650
680
|
*/
|
|
651
681
|
declare function integration(options: IntegrationOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
652
682
|
//#endregion
|
|
653
|
-
//#region src/
|
|
683
|
+
//#region src/spec/legacy-cli.d.ts
|
|
654
684
|
interface CliOptions {
|
|
655
685
|
/** CLI command to run (resolved from node_modules/.bin or PATH). */
|
|
656
686
|
command: string;
|
|
@@ -665,7 +695,7 @@ interface CliOptions {
|
|
|
665
695
|
*/
|
|
666
696
|
declare function cli(options: CliOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
667
697
|
//#endregion
|
|
668
|
-
//#region src/
|
|
698
|
+
//#region src/spec/legacy-e2e.d.ts
|
|
669
699
|
interface E2eOptions {
|
|
670
700
|
/** Project root — must contain docker/compose.test.yaml. */
|
|
671
701
|
root?: string;
|
|
@@ -676,7 +706,7 @@ interface E2eOptions {
|
|
|
676
706
|
*/
|
|
677
707
|
declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithCleanup>;
|
|
678
708
|
//#endregion
|
|
679
|
-
//#region src/
|
|
709
|
+
//#region src/builder/common/grep.d.ts
|
|
680
710
|
/**
|
|
681
711
|
* Extract text blocks from output that contain a pattern.
|
|
682
712
|
* Splits by blank lines (how linter/compiler output is structured),
|
|
@@ -688,7 +718,7 @@ declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithClean
|
|
|
688
718
|
*/
|
|
689
719
|
declare function grep(output: string, pattern: string): string;
|
|
690
720
|
//#endregion
|
|
691
|
-
//#region src/
|
|
721
|
+
//#region src/builder/common/reporter.d.ts
|
|
692
722
|
/** Strip ANSI escape codes from a string. */
|
|
693
723
|
declare function stripAnsi(str: string): string;
|
|
694
724
|
/** Strip ANSI codes and replace volatile tokens (ports, durations) with placeholders. */
|
|
@@ -698,5 +728,5 @@ declare function normalizeOutput(str: string): string;
|
|
|
698
728
|
/** Create a {@link DockerContainerPort} bound to an existing container by ID. */
|
|
699
729
|
declare function dockerContainer(containerId: string): DockerContainerPort;
|
|
700
730
|
//#endregion
|
|
701
|
-
export { type AppServices, type AppTarget, type CliOptions, type CommandEnv, type CommandPort, type CommandResult, type CommandTarget, type ContainerPort, type DatabasePort, DirectoryAccessor, type DirectorySnapshotOptions, DockerAssertion, type DockerContainerPort, type DockerInspectResult, type E2eOptions, ExecAdapter, FetchAdapter, type FileAccessor, HonoAdapter, type HttpTarget, type IntegrationOptions, type IsolationStrategy, type MockDatePort, type MockPort, Orchestrator, type PostgresOptions, type RedisOptions, ResponseAccessor, type ServerPort, type ServerResponse, type ServiceHandle, type SpawnOptions, type SpecOptions, type SpecRunner, type SpecTarget, SpecificationBuilder, type SpecificationConfig, SpecificationResult, type SpecificationRunner, type SpecificationRunnerWithCleanup, type SqliteOptions, type StackTarget, TableAssertion, app, cli, command, createSpecificationRunner, dockerContainer, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, spec, sqlite, stack, stripAnsi };
|
|
731
|
+
export { type AppFactoryResult, type AppServices, type AppTarget, type CliOptions, type CommandEnv, type CommandPort, type CommandResult, type CommandTarget, type ContainerPort, type DatabasePort, DirectoryAccessor, type DirectorySnapshotOptions, DockerAssertion, type DockerContainerPort, type DockerInspectResult, type E2eOptions, ExecAdapter, FetchAdapter, type FileAccessor, HonoAdapter, type HttpTarget, type IntegrationOptions, type IsolationStrategy, type JobHandle, type MockDatePort, type MockPort, Orchestrator, type PostgresOptions, type RedisOptions, ResponseAccessor, type ServerPort, type ServerResponse, type ServiceHandle, type SpawnOptions, type SpecOptions, type SpecRunner, type SpecTarget, SpecificationBuilder, type SpecificationConfig, SpecificationResult, type SpecificationRunner, type SpecificationRunnerWithCleanup, type SqliteOptions, type StackTarget, TableAssertion, app, cli, command, createSpecificationRunner, dockerContainer, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, spec, sqlite, stack, stripAnsi };
|
|
702
732
|
//# sourceMappingURL=index.d.ts.map
|