@jterrazz/test 3.4.0 → 4.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/README.md +251 -73
- package/dist/index.cjs +445 -4466
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -17
- package/dist/index.d.ts +105 -17
- package/dist/index.js +289 -4332
- package/dist/index.js.map +1 -1
- package/package.json +12 -8
- package/dist/assets/cpufeatures-B-FC6C9Z.node +0 -0
- package/dist/assets/sshcrypto-D82met6T.node +0 -0
- package/dist/build.cjs +0 -122200
- package/dist/build.cjs.map +0 -1
- package/dist/build.js +0 -122193
- package/dist/build.js.map +0 -1
- package/dist/chunk.cjs +0 -64
- package/dist/chunk.js +0 -37
- package/dist/dist.cjs +0 -6587
- package/dist/dist.cjs.map +0 -1
- package/dist/dist.js +0 -6582
- package/dist/dist.js.map +0 -1
- package/dist/dist2.cjs +0 -20838
- package/dist/dist2.cjs.map +0 -1
- package/dist/dist2.js +0 -20834
- package/dist/dist2.js.map +0 -1
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
|
-
*
|
|
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
|
/**
|
|
@@ -109,6 +110,99 @@ declare class Orchestrator {
|
|
|
109
110
|
getAppUrl(): null | string;
|
|
110
111
|
}
|
|
111
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
|
|
112
206
|
//#region src/specification/ports/command.port.d.ts
|
|
113
207
|
/**
|
|
114
208
|
* Result of executing a CLI command.
|
|
@@ -173,7 +267,7 @@ declare class SpecificationResult {
|
|
|
173
267
|
private commandResult?;
|
|
174
268
|
private config;
|
|
175
269
|
private requestInfo?;
|
|
176
|
-
private
|
|
270
|
+
private responseData?;
|
|
177
271
|
private testDir;
|
|
178
272
|
private workDir?;
|
|
179
273
|
constructor(options: {
|
|
@@ -184,23 +278,16 @@ declare class SpecificationResult {
|
|
|
184
278
|
testDir: string;
|
|
185
279
|
workDir?: string;
|
|
186
280
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
expectTable(table: string, options: {
|
|
195
|
-
columns: string[];
|
|
196
|
-
rows: unknown[][];
|
|
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;
|
|
287
|
+
table(tableName: string, options?: {
|
|
197
288
|
service?: string;
|
|
198
|
-
}):
|
|
199
|
-
expectFile(path: string): this;
|
|
200
|
-
expectNoFile(path: string): this;
|
|
201
|
-
expectFileContains(path: string, content: string): this;
|
|
289
|
+
}): TableAssertion;
|
|
202
290
|
private resolveDatabase;
|
|
203
|
-
private resolveWorkPath;
|
|
204
291
|
}
|
|
205
292
|
declare class SpecificationBuilder {
|
|
206
293
|
private commandArgs;
|
|
@@ -250,6 +337,7 @@ declare class PostgresHandle implements DatabasePort, ServiceHandle {
|
|
|
250
337
|
readonly environment: Record<string, string>;
|
|
251
338
|
connectionString: string;
|
|
252
339
|
started: boolean;
|
|
340
|
+
private client;
|
|
253
341
|
constructor(options?: PostgresOptions);
|
|
254
342
|
buildConnectionString(host: string, port: number): string;
|
|
255
343
|
createDatabaseAdapter(): DatabasePort;
|
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
|
-
*
|
|
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
|
/**
|
|
@@ -109,6 +110,99 @@ declare class Orchestrator {
|
|
|
109
110
|
getAppUrl(): null | string;
|
|
110
111
|
}
|
|
111
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
|
|
112
206
|
//#region src/specification/ports/command.port.d.ts
|
|
113
207
|
/**
|
|
114
208
|
* Result of executing a CLI command.
|
|
@@ -173,7 +267,7 @@ declare class SpecificationResult {
|
|
|
173
267
|
private commandResult?;
|
|
174
268
|
private config;
|
|
175
269
|
private requestInfo?;
|
|
176
|
-
private
|
|
270
|
+
private responseData?;
|
|
177
271
|
private testDir;
|
|
178
272
|
private workDir?;
|
|
179
273
|
constructor(options: {
|
|
@@ -184,23 +278,16 @@ declare class SpecificationResult {
|
|
|
184
278
|
testDir: string;
|
|
185
279
|
workDir?: string;
|
|
186
280
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
expectTable(table: string, options: {
|
|
195
|
-
columns: string[];
|
|
196
|
-
rows: unknown[][];
|
|
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;
|
|
287
|
+
table(tableName: string, options?: {
|
|
197
288
|
service?: string;
|
|
198
|
-
}):
|
|
199
|
-
expectFile(path: string): this;
|
|
200
|
-
expectNoFile(path: string): this;
|
|
201
|
-
expectFileContains(path: string, content: string): this;
|
|
289
|
+
}): TableAssertion;
|
|
202
290
|
private resolveDatabase;
|
|
203
|
-
private resolveWorkPath;
|
|
204
291
|
}
|
|
205
292
|
declare class SpecificationBuilder {
|
|
206
293
|
private commandArgs;
|
|
@@ -250,6 +337,7 @@ declare class PostgresHandle implements DatabasePort, ServiceHandle {
|
|
|
250
337
|
readonly environment: Record<string, string>;
|
|
251
338
|
connectionString: string;
|
|
252
339
|
started: boolean;
|
|
340
|
+
private client;
|
|
253
341
|
constructor(options?: PostgresOptions);
|
|
254
342
|
buildConnectionString(host: string, port: number): string;
|
|
255
343
|
createDatabaseAdapter(): DatabasePort;
|