@jterrazz/test 3.3.1 → 3.5.0

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.d.cts CHANGED
@@ -79,7 +79,8 @@ declare class Orchestrator {
79
79
  constructor(options: OrchestratorOptions);
80
80
  /**
81
81
  * Start declared services via testcontainers (integration mode).
82
- * Reads image/env config from docker-compose.test.yaml if a service has compose: "name".
82
+ * Phase 1: start all containers in parallel (the slow part).
83
+ * Phase 2: wire connections, healthcheck, and init sequentially (fast).
83
84
  */
84
85
  start(): Promise<void>;
85
86
  /**
@@ -118,6 +119,15 @@ interface CommandResult {
118
119
  stdout: string;
119
120
  stderr: string;
120
121
  }
122
+ /**
123
+ * Options for spawning a long-running process.
124
+ */
125
+ interface SpawnOptions {
126
+ /** Resolve when stdout/stderr contains this string. */
127
+ waitFor: string;
128
+ /** Kill the process after this many milliseconds. */
129
+ timeout: number;
130
+ }
121
131
  /**
122
132
  * Abstract CLI interface for specification runners.
123
133
  * Implement this to plug in your command execution strategy.
@@ -125,6 +135,8 @@ interface CommandResult {
125
135
  interface CommandPort {
126
136
  /** Execute a CLI command with the given arguments in the given working directory. */
127
137
  exec(args: string, cwd: string): Promise<CommandResult>;
138
+ /** Spawn a long-running process and wait for a pattern or timeout. */
139
+ spawn(args: string, cwd: string, options: SpawnOptions): Promise<CommandResult>;
128
140
  }
129
141
  //#endregion
130
142
  //#region src/specification/ports/server.port.d.ts
@@ -200,6 +212,7 @@ declare class SpecificationBuilder {
200
212
  private projectName;
201
213
  private request;
202
214
  private seeds;
215
+ private spawnConfig;
203
216
  private testDir;
204
217
  constructor(config: SpecificationConfig, testDir: string, label: string);
205
218
  seed(file: string, options?: {
@@ -212,7 +225,8 @@ declare class SpecificationBuilder {
212
225
  post(path: string, bodyFile?: string): this;
213
226
  put(path: string, bodyFile?: string): this;
214
227
  delete(path: string): this;
215
- exec(args: string): this;
228
+ exec(args: string | string[]): this;
229
+ spawn(args: string, options: SpawnOptions): this;
216
230
  run(): Promise<SpecificationResult>;
217
231
  private prepareWorkDir;
218
232
  private runHttpAction;
@@ -237,6 +251,7 @@ declare class PostgresHandle implements DatabasePort, ServiceHandle {
237
251
  readonly environment: Record<string, string>;
238
252
  connectionString: string;
239
253
  started: boolean;
254
+ private client;
240
255
  constructor(options?: PostgresOptions);
241
256
  buildConnectionString(host: string, port: number): string;
242
257
  createDatabaseAdapter(): DatabasePort;
@@ -289,13 +304,14 @@ declare function redis(options?: RedisOptions): RedisHandle;
289
304
  //#endregion
290
305
  //#region src/specification/adapters/exec.adapter.d.ts
291
306
  /**
292
- * Executes CLI commands via execSync.
307
+ * Executes CLI commands via execSync (blocking) or spawn (long-running).
293
308
  * Used by cli() for local command execution.
294
309
  */
295
310
  declare class ExecAdapter implements CommandPort {
296
311
  private command;
297
312
  constructor(command: string);
298
313
  exec(args: string, cwd: string): Promise<CommandResult>;
314
+ spawn(args: string, cwd: string, options: SpawnOptions): Promise<CommandResult>;
299
315
  }
300
316
  //#endregion
301
317
  //#region src/specification/adapters/fetch.adapter.d.ts
package/dist/index.d.ts CHANGED
@@ -79,7 +79,8 @@ declare class Orchestrator {
79
79
  constructor(options: OrchestratorOptions);
80
80
  /**
81
81
  * Start declared services via testcontainers (integration mode).
82
- * Reads image/env config from docker-compose.test.yaml if a service has compose: "name".
82
+ * Phase 1: start all containers in parallel (the slow part).
83
+ * Phase 2: wire connections, healthcheck, and init sequentially (fast).
83
84
  */
84
85
  start(): Promise<void>;
85
86
  /**
@@ -118,6 +119,15 @@ interface CommandResult {
118
119
  stdout: string;
119
120
  stderr: string;
120
121
  }
122
+ /**
123
+ * Options for spawning a long-running process.
124
+ */
125
+ interface SpawnOptions {
126
+ /** Resolve when stdout/stderr contains this string. */
127
+ waitFor: string;
128
+ /** Kill the process after this many milliseconds. */
129
+ timeout: number;
130
+ }
121
131
  /**
122
132
  * Abstract CLI interface for specification runners.
123
133
  * Implement this to plug in your command execution strategy.
@@ -125,6 +135,8 @@ interface CommandResult {
125
135
  interface CommandPort {
126
136
  /** Execute a CLI command with the given arguments in the given working directory. */
127
137
  exec(args: string, cwd: string): Promise<CommandResult>;
138
+ /** Spawn a long-running process and wait for a pattern or timeout. */
139
+ spawn(args: string, cwd: string, options: SpawnOptions): Promise<CommandResult>;
128
140
  }
129
141
  //#endregion
130
142
  //#region src/specification/ports/server.port.d.ts
@@ -200,6 +212,7 @@ declare class SpecificationBuilder {
200
212
  private projectName;
201
213
  private request;
202
214
  private seeds;
215
+ private spawnConfig;
203
216
  private testDir;
204
217
  constructor(config: SpecificationConfig, testDir: string, label: string);
205
218
  seed(file: string, options?: {
@@ -212,7 +225,8 @@ declare class SpecificationBuilder {
212
225
  post(path: string, bodyFile?: string): this;
213
226
  put(path: string, bodyFile?: string): this;
214
227
  delete(path: string): this;
215
- exec(args: string): this;
228
+ exec(args: string | string[]): this;
229
+ spawn(args: string, options: SpawnOptions): this;
216
230
  run(): Promise<SpecificationResult>;
217
231
  private prepareWorkDir;
218
232
  private runHttpAction;
@@ -237,6 +251,7 @@ declare class PostgresHandle implements DatabasePort, ServiceHandle {
237
251
  readonly environment: Record<string, string>;
238
252
  connectionString: string;
239
253
  started: boolean;
254
+ private client;
240
255
  constructor(options?: PostgresOptions);
241
256
  buildConnectionString(host: string, port: number): string;
242
257
  createDatabaseAdapter(): DatabasePort;
@@ -289,13 +304,14 @@ declare function redis(options?: RedisOptions): RedisHandle;
289
304
  //#endregion
290
305
  //#region src/specification/adapters/exec.adapter.d.ts
291
306
  /**
292
- * Executes CLI commands via execSync.
307
+ * Executes CLI commands via execSync (blocking) or spawn (long-running).
293
308
  * Used by cli() for local command execution.
294
309
  */
295
310
  declare class ExecAdapter implements CommandPort {
296
311
  private command;
297
312
  constructor(command: string);
298
313
  exec(args: string, cwd: string): Promise<CommandResult>;
314
+ spawn(args: string, cwd: string, options: SpawnOptions): Promise<CommandResult>;
299
315
  }
300
316
  //#endregion
301
317
  //#region src/specification/adapters/fetch.adapter.d.ts