@jterrazz/test 4.0.0 → 5.0.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
@@ -110,99 +110,6 @@ declare class Orchestrator {
110
110
  getAppUrl(): null | string;
111
111
  }
112
112
  //#endregion
113
- //#region src/specification/assertions/base.d.ts
114
- /**
115
- * Base assertion that handles .not negation.
116
- * Subclasses call this.assert(condition, message, negatedMessage) for each predicate.
117
- */
118
- declare class BaseAssertion {
119
- protected negated: boolean;
120
- get not(): this;
121
- protected assert(condition: boolean, message: string, negatedMessage: string): void;
122
- }
123
- //#endregion
124
- //#region src/specification/assertions/file.d.ts
125
- /**
126
- * Assertions on a file in the working directory.
127
- * Usage: result.file("dist/index.js").toExist()
128
- */
129
- declare class FileAssertion extends BaseAssertion {
130
- private filePath;
131
- private resolvedPath;
132
- constructor(filePath: string, workDir: string);
133
- toExist(): void;
134
- toContain(expected: string): void;
135
- toMatch(pattern: RegExp): void;
136
- }
137
- //#endregion
138
- //#region src/specification/assertions/response.d.ts
139
- /**
140
- * Assertions on an HTTP response body.
141
- * Usage: result.response.toMatchFile("expected.json")
142
- */
143
- declare class ResponseAssertion extends BaseAssertion {
144
- private body;
145
- private testDir;
146
- constructor(body: unknown, testDir: string);
147
- toMatchFile(file: string): void;
148
- toContain(subset: Record<string, unknown>): void;
149
- }
150
- //#endregion
151
- //#region src/specification/assertions/string.d.ts
152
- /**
153
- * Assertions on a string (stdout, stderr, response body).
154
- * Usage: result.stdout.toContain("hello")
155
- */
156
- declare class StringAssertion extends BaseAssertion {
157
- private actual;
158
- private label;
159
- private testDir?;
160
- constructor(actual: string, label: string, testDir?: string);
161
- toContain(expected: string, options?: {
162
- near?: string;
163
- }): void;
164
- toMatch(pattern: RegExp): void;
165
- toMatchFile(file: string): void;
166
- toBeEmpty(): void;
167
- private containsNear;
168
- private stripAnsi;
169
- private truncate;
170
- }
171
- //#endregion
172
- //#region src/specification/assertions/table.d.ts
173
- /**
174
- * Assertions on a database table.
175
- * Usage: await result.table("users").toMatch({ columns: ["name"], rows: [["Alice"]] })
176
- */
177
- declare class TableAssertion extends BaseAssertion {
178
- private tableName;
179
- private db;
180
- constructor(tableName: string, db: DatabasePort);
181
- toMatch(expected: {
182
- columns: string[];
183
- rows: unknown[][];
184
- }): Promise<void>;
185
- toBeEmpty(): Promise<void>;
186
- }
187
- //#endregion
188
- //#region src/specification/assertions/value.d.ts
189
- /**
190
- * Assertions on a single value (exit code, status code).
191
- * Usage: result.exitCode.toBe(0)
192
- */
193
- declare class ValueAssertion extends BaseAssertion {
194
- private actual;
195
- private label;
196
- private context?;
197
- constructor(actual: number, label: string, context?: {
198
- request?: any;
199
- responseBody?: unknown;
200
- stdout?: string;
201
- stderr?: string;
202
- });
203
- toBe(expected: number): void;
204
- }
205
- //#endregion
206
113
  //#region src/specification/ports/command.port.d.ts
207
114
  /**
208
115
  * Result of executing a CLI command.
@@ -258,10 +165,25 @@ interface SpecificationConfig {
258
165
  fixturesRoot?: string;
259
166
  server?: ServerPort;
260
167
  }
261
- interface RequestInfo {
262
- body?: unknown;
263
- method: string;
264
- path: string;
168
+ interface FileAccessor {
169
+ readonly content: string;
170
+ readonly exists: boolean;
171
+ }
172
+ declare class TableAssertion {
173
+ private tableName;
174
+ private db;
175
+ constructor(tableName: string, db: DatabasePort);
176
+ toMatch(expected: {
177
+ columns: string[];
178
+ rows: unknown[][];
179
+ }): Promise<void>;
180
+ toBeEmpty(): Promise<void>;
181
+ }
182
+ declare class ResponseAccessor {
183
+ readonly body: unknown;
184
+ private testDir;
185
+ constructor(body: unknown, testDir: string);
186
+ toMatchFile(file: string): void;
265
187
  }
266
188
  declare class SpecificationResult {
267
189
  private commandResult?;
@@ -273,17 +195,21 @@ declare class SpecificationResult {
273
195
  constructor(options: {
274
196
  commandResult?: CommandResult;
275
197
  config: SpecificationConfig;
276
- requestInfo?: RequestInfo;
198
+ requestInfo?: {
199
+ body?: unknown;
200
+ method: string;
201
+ path: string;
202
+ };
277
203
  response?: ServerResponse;
278
204
  testDir: string;
279
205
  workDir?: string;
280
206
  });
281
- get exitCode(): ValueAssertion;
282
- get status(): ValueAssertion;
283
- get response(): ResponseAssertion;
284
- get stdout(): StringAssertion;
285
- get stderr(): StringAssertion;
286
- file(path: string): FileAssertion;
207
+ get exitCode(): number;
208
+ get status(): number;
209
+ get stdout(): string;
210
+ get stderr(): string;
211
+ get response(): ResponseAccessor;
212
+ file(path: string): FileAccessor;
287
213
  table(tableName: string, options?: {
288
214
  service?: string;
289
215
  }): TableAssertion;
@@ -424,6 +350,18 @@ declare class HonoAdapter implements ServerPort {
424
350
  request(method: string, path: string, body?: unknown): Promise<ServerResponse>;
425
351
  }
426
352
  //#endregion
353
+ //#region src/specification/grep.d.ts
354
+ /**
355
+ * Extract text blocks from output that contain a pattern.
356
+ * Splits by blank lines (how linter/compiler output is structured),
357
+ * returns only blocks matching the pattern.
358
+ *
359
+ * @example
360
+ * expect(grep(result.stdout, "unused-var.ts")).toContain("no-unused-vars")
361
+ * expect(grep(result.stdout, "valid/sorted.ts")).not.toContain("sort-imports")
362
+ */
363
+ declare function grep(output: string, pattern: string): string;
364
+ //#endregion
427
365
  //#region src/infrastructure/reporter.d.ts
428
366
  declare function stripAnsi(str: string): string;
429
367
  declare function normalizeOutput(str: string): string;
@@ -479,5 +417,5 @@ declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithClean
479
417
  */
480
418
  declare function cli(options: CliOptions): Promise<SpecificationRunnerWithCleanup>;
481
419
  //#endregion
482
- export { type CommandPort, type CommandResult, type DatabasePort, ExecAdapter, FetchAdapter, HonoAdapter, type MockDatePort, type MockPort, Orchestrator, type ServerPort, type ServerResponse, cli, e2e, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, stripAnsi };
420
+ export { type CommandPort, type CommandResult, type DatabasePort, ExecAdapter, FetchAdapter, HonoAdapter, type MockDatePort, type MockPort, Orchestrator, type ServerPort, type ServerResponse, type SpecificationResult, cli, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, stripAnsi };
483
421
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -110,99 +110,6 @@ declare class Orchestrator {
110
110
  getAppUrl(): null | string;
111
111
  }
112
112
  //#endregion
113
- //#region src/specification/assertions/base.d.ts
114
- /**
115
- * Base assertion that handles .not negation.
116
- * Subclasses call this.assert(condition, message, negatedMessage) for each predicate.
117
- */
118
- declare class BaseAssertion {
119
- protected negated: boolean;
120
- get not(): this;
121
- protected assert(condition: boolean, message: string, negatedMessage: string): void;
122
- }
123
- //#endregion
124
- //#region src/specification/assertions/file.d.ts
125
- /**
126
- * Assertions on a file in the working directory.
127
- * Usage: result.file("dist/index.js").toExist()
128
- */
129
- declare class FileAssertion extends BaseAssertion {
130
- private filePath;
131
- private resolvedPath;
132
- constructor(filePath: string, workDir: string);
133
- toExist(): void;
134
- toContain(expected: string): void;
135
- toMatch(pattern: RegExp): void;
136
- }
137
- //#endregion
138
- //#region src/specification/assertions/response.d.ts
139
- /**
140
- * Assertions on an HTTP response body.
141
- * Usage: result.response.toMatchFile("expected.json")
142
- */
143
- declare class ResponseAssertion extends BaseAssertion {
144
- private body;
145
- private testDir;
146
- constructor(body: unknown, testDir: string);
147
- toMatchFile(file: string): void;
148
- toContain(subset: Record<string, unknown>): void;
149
- }
150
- //#endregion
151
- //#region src/specification/assertions/string.d.ts
152
- /**
153
- * Assertions on a string (stdout, stderr, response body).
154
- * Usage: result.stdout.toContain("hello")
155
- */
156
- declare class StringAssertion extends BaseAssertion {
157
- private actual;
158
- private label;
159
- private testDir?;
160
- constructor(actual: string, label: string, testDir?: string);
161
- toContain(expected: string, options?: {
162
- near?: string;
163
- }): void;
164
- toMatch(pattern: RegExp): void;
165
- toMatchFile(file: string): void;
166
- toBeEmpty(): void;
167
- private containsNear;
168
- private stripAnsi;
169
- private truncate;
170
- }
171
- //#endregion
172
- //#region src/specification/assertions/table.d.ts
173
- /**
174
- * Assertions on a database table.
175
- * Usage: await result.table("users").toMatch({ columns: ["name"], rows: [["Alice"]] })
176
- */
177
- declare class TableAssertion extends BaseAssertion {
178
- private tableName;
179
- private db;
180
- constructor(tableName: string, db: DatabasePort);
181
- toMatch(expected: {
182
- columns: string[];
183
- rows: unknown[][];
184
- }): Promise<void>;
185
- toBeEmpty(): Promise<void>;
186
- }
187
- //#endregion
188
- //#region src/specification/assertions/value.d.ts
189
- /**
190
- * Assertions on a single value (exit code, status code).
191
- * Usage: result.exitCode.toBe(0)
192
- */
193
- declare class ValueAssertion extends BaseAssertion {
194
- private actual;
195
- private label;
196
- private context?;
197
- constructor(actual: number, label: string, context?: {
198
- request?: any;
199
- responseBody?: unknown;
200
- stdout?: string;
201
- stderr?: string;
202
- });
203
- toBe(expected: number): void;
204
- }
205
- //#endregion
206
113
  //#region src/specification/ports/command.port.d.ts
207
114
  /**
208
115
  * Result of executing a CLI command.
@@ -258,10 +165,25 @@ interface SpecificationConfig {
258
165
  fixturesRoot?: string;
259
166
  server?: ServerPort;
260
167
  }
261
- interface RequestInfo {
262
- body?: unknown;
263
- method: string;
264
- path: string;
168
+ interface FileAccessor {
169
+ readonly content: string;
170
+ readonly exists: boolean;
171
+ }
172
+ declare class TableAssertion {
173
+ private tableName;
174
+ private db;
175
+ constructor(tableName: string, db: DatabasePort);
176
+ toMatch(expected: {
177
+ columns: string[];
178
+ rows: unknown[][];
179
+ }): Promise<void>;
180
+ toBeEmpty(): Promise<void>;
181
+ }
182
+ declare class ResponseAccessor {
183
+ readonly body: unknown;
184
+ private testDir;
185
+ constructor(body: unknown, testDir: string);
186
+ toMatchFile(file: string): void;
265
187
  }
266
188
  declare class SpecificationResult {
267
189
  private commandResult?;
@@ -273,17 +195,21 @@ declare class SpecificationResult {
273
195
  constructor(options: {
274
196
  commandResult?: CommandResult;
275
197
  config: SpecificationConfig;
276
- requestInfo?: RequestInfo;
198
+ requestInfo?: {
199
+ body?: unknown;
200
+ method: string;
201
+ path: string;
202
+ };
277
203
  response?: ServerResponse;
278
204
  testDir: string;
279
205
  workDir?: string;
280
206
  });
281
- get exitCode(): ValueAssertion;
282
- get status(): ValueAssertion;
283
- get response(): ResponseAssertion;
284
- get stdout(): StringAssertion;
285
- get stderr(): StringAssertion;
286
- file(path: string): FileAssertion;
207
+ get exitCode(): number;
208
+ get status(): number;
209
+ get stdout(): string;
210
+ get stderr(): string;
211
+ get response(): ResponseAccessor;
212
+ file(path: string): FileAccessor;
287
213
  table(tableName: string, options?: {
288
214
  service?: string;
289
215
  }): TableAssertion;
@@ -424,6 +350,18 @@ declare class HonoAdapter implements ServerPort {
424
350
  request(method: string, path: string, body?: unknown): Promise<ServerResponse>;
425
351
  }
426
352
  //#endregion
353
+ //#region src/specification/grep.d.ts
354
+ /**
355
+ * Extract text blocks from output that contain a pattern.
356
+ * Splits by blank lines (how linter/compiler output is structured),
357
+ * returns only blocks matching the pattern.
358
+ *
359
+ * @example
360
+ * expect(grep(result.stdout, "unused-var.ts")).toContain("no-unused-vars")
361
+ * expect(grep(result.stdout, "valid/sorted.ts")).not.toContain("sort-imports")
362
+ */
363
+ declare function grep(output: string, pattern: string): string;
364
+ //#endregion
427
365
  //#region src/infrastructure/reporter.d.ts
428
366
  declare function stripAnsi(str: string): string;
429
367
  declare function normalizeOutput(str: string): string;
@@ -479,5 +417,5 @@ declare function e2e(options?: E2eOptions): Promise<SpecificationRunnerWithClean
479
417
  */
480
418
  declare function cli(options: CliOptions): Promise<SpecificationRunnerWithCleanup>;
481
419
  //#endregion
482
- export { type CommandPort, type CommandResult, type DatabasePort, ExecAdapter, FetchAdapter, HonoAdapter, type MockDatePort, type MockPort, Orchestrator, type ServerPort, type ServerResponse, cli, e2e, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, stripAnsi };
420
+ export { type CommandPort, type CommandResult, type DatabasePort, ExecAdapter, FetchAdapter, HonoAdapter, type MockDatePort, type MockPort, Orchestrator, type ServerPort, type ServerResponse, type SpecificationResult, cli, e2e, grep, integration, mockOf, mockOfDate, normalizeOutput, postgres, redis, stripAnsi };
483
421
  //# sourceMappingURL=index.d.ts.map