@crvy/rprtr 0.0.7 → 0.0.9
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/CHANGELOG.md +10 -0
- package/dist/{chunk-OMDYTNWY.js → chunk-TS64TROX.js} +20 -139
- package/dist/cli.js +2 -2
- package/dist/debug-log.d.ts +3 -0
- package/dist/debug-log.d.ts.map +1 -0
- package/dist/index.css +0 -22
- package/dist/index.js +83 -127
- package/dist/reporter-artifact-ops.d.ts +22 -0
- package/dist/reporter-artifact-ops.d.ts.map +1 -0
- package/dist/reporter.cjs +194 -176
- package/dist/reporter.d.ts +0 -5
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +135 -117
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server.cjs +35 -154
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/server/report-watch.d.ts +0 -9
- package/dist/server/report-watch.d.ts.map +0 -1
- package/dist/{chunk-JGS2VWQP.js → chunk-EJRLZZ22.js} +142 -142
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function createDebouncedRefresh(reload: () => Promise<void>, delayMs?: number): () => void;
|
|
2
|
-
interface ReportWatchOptions {
|
|
3
|
-
offlineReportDir: string;
|
|
4
|
-
screenshotDir: string;
|
|
5
|
-
scheduleRefresh: () => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function watchReportArtifacts(options: ReportWatchOptions): Promise<() => void>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=report-watch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-watch.d.ts","sourceRoot":"","sources":["../../src/server/report-watch.ts"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,SAAK,GAAG,MAAM,IAAI,CAa5F;AAED,UAAU,kBAAkB;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,IAAI,CAAA;CAC5B;AAsFD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAgC3F"}
|
|
@@ -154,6 +154,148 @@ function resolveBaselineTargets(input) {
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
// src/schemas.ts
|
|
158
|
+
import { z } from "zod";
|
|
159
|
+
var LocationSchema = z.object({
|
|
160
|
+
file: z.string(),
|
|
161
|
+
line: z.number()
|
|
162
|
+
});
|
|
163
|
+
var VisualSourceSchema = z.enum(["comparison", "baseline-only", "declared-only"]);
|
|
164
|
+
var ImagesSchema = z.object({
|
|
165
|
+
actual: z.string().optional(),
|
|
166
|
+
expect: z.string().optional(),
|
|
167
|
+
diff: z.string().optional(),
|
|
168
|
+
error: z.string().optional(),
|
|
169
|
+
source: VisualSourceSchema.optional()
|
|
170
|
+
});
|
|
171
|
+
var ScreenshotDeclarationSchema = z.discriminatedUnion("kind", [
|
|
172
|
+
z.object({
|
|
173
|
+
visualName: z.string(),
|
|
174
|
+
kind: z.literal("named"),
|
|
175
|
+
declaredName: z.string(),
|
|
176
|
+
snapshotBaseName: z.string(),
|
|
177
|
+
occurrenceIndex: z.number()
|
|
178
|
+
}),
|
|
179
|
+
z.object({
|
|
180
|
+
visualName: z.string(),
|
|
181
|
+
kind: z.literal("unnamed"),
|
|
182
|
+
occurrenceIndex: z.number()
|
|
183
|
+
})
|
|
184
|
+
]);
|
|
185
|
+
var AttachmentSchema = z.object({
|
|
186
|
+
name: z.string(),
|
|
187
|
+
path: z.string(),
|
|
188
|
+
contentType: z.string()
|
|
189
|
+
});
|
|
190
|
+
var TestStatusSchema = z.enum(["unknown", "pending", "running", "failed", "approved", "success", "retrying"]);
|
|
191
|
+
var TestResultStatusSchema = z.enum(["failed", "success", "pending"]);
|
|
192
|
+
var TestResultSchema = z.object({
|
|
193
|
+
status: TestResultStatusSchema,
|
|
194
|
+
retries: z.number(),
|
|
195
|
+
images: z.record(z.string(), ImagesSchema).optional(),
|
|
196
|
+
visualDeclarations: z.array(ScreenshotDeclarationSchema).optional(),
|
|
197
|
+
error: z.string().optional(),
|
|
198
|
+
duration: z.number().optional()
|
|
199
|
+
});
|
|
200
|
+
var TestDataSchema = z.object({
|
|
201
|
+
id: z.string(),
|
|
202
|
+
titlePath: z.array(z.string()),
|
|
203
|
+
browser: z.string(),
|
|
204
|
+
title: z.string(),
|
|
205
|
+
skip: z.union([z.boolean(), z.string()]).optional(),
|
|
206
|
+
retries: z.number().optional(),
|
|
207
|
+
status: TestStatusSchema.optional(),
|
|
208
|
+
results: z.array(TestResultSchema).optional(),
|
|
209
|
+
approved: z.record(z.string(), z.number()).nullable().optional(),
|
|
210
|
+
attachments: z.array(AttachmentSchema).optional(),
|
|
211
|
+
location: LocationSchema.optional()
|
|
212
|
+
});
|
|
213
|
+
var CrvyRprtrTestSchema = TestDataSchema.extend({
|
|
214
|
+
checked: z.boolean()
|
|
215
|
+
});
|
|
216
|
+
var CrvyRprtrSuiteSchema = z.lazy(
|
|
217
|
+
() => z.object({
|
|
218
|
+
path: z.array(z.string()),
|
|
219
|
+
skip: z.boolean(),
|
|
220
|
+
status: TestStatusSchema.optional(),
|
|
221
|
+
opened: z.boolean(),
|
|
222
|
+
checked: z.boolean(),
|
|
223
|
+
indeterminate: z.boolean(),
|
|
224
|
+
children: z.record(z.string(), z.union([CrvyRprtrSuiteSchema, CrvyRprtrTestSchema])).optional()
|
|
225
|
+
})
|
|
226
|
+
);
|
|
227
|
+
var WebSocketMessageSchema = z.object({
|
|
228
|
+
type: z.enum(["test-begin", "test-end", "run-end", "approve", "sync"]),
|
|
229
|
+
data: z.unknown()
|
|
230
|
+
});
|
|
231
|
+
var TestBeginDataSchema = z.object({
|
|
232
|
+
id: z.string(),
|
|
233
|
+
title: z.string(),
|
|
234
|
+
titlePath: z.array(z.string()),
|
|
235
|
+
browser: z.string(),
|
|
236
|
+
location: LocationSchema
|
|
237
|
+
});
|
|
238
|
+
var TestEndDataSchema = z.object({
|
|
239
|
+
id: z.string(),
|
|
240
|
+
status: z.enum(["passed", "failed", "skipped"]),
|
|
241
|
+
attachments: z.array(AttachmentSchema),
|
|
242
|
+
visualNames: z.array(z.string()).default([]),
|
|
243
|
+
visualDeclarations: z.preprocess(
|
|
244
|
+
(value) => value === null ? void 0 : value,
|
|
245
|
+
z.array(ScreenshotDeclarationSchema).optional()
|
|
246
|
+
),
|
|
247
|
+
error: z.string().optional(),
|
|
248
|
+
duration: z.number().optional()
|
|
249
|
+
});
|
|
250
|
+
var ReportDataSchema = z.object({
|
|
251
|
+
isRunning: z.boolean(),
|
|
252
|
+
tests: z.record(z.string(), TestDataSchema),
|
|
253
|
+
browsers: z.array(z.string()),
|
|
254
|
+
isUpdateMode: z.boolean(),
|
|
255
|
+
screenshotDir: z.string()
|
|
256
|
+
});
|
|
257
|
+
var LoadedReportDataSchema = z.object({
|
|
258
|
+
tests: z.record(z.string(), TestDataSchema).optional(),
|
|
259
|
+
isUpdateMode: z.boolean().optional()
|
|
260
|
+
});
|
|
261
|
+
var OfflineEventSchema = z.object({
|
|
262
|
+
type: z.enum(["test-begin", "test-end", "run-end"]),
|
|
263
|
+
data: z.unknown(),
|
|
264
|
+
timestamp: z.number(),
|
|
265
|
+
workerIndex: z.number()
|
|
266
|
+
});
|
|
267
|
+
var OfflineReportSchema = z.object({
|
|
268
|
+
version: z.number(),
|
|
269
|
+
generatedAt: z.string(),
|
|
270
|
+
workers: z.number(),
|
|
271
|
+
events: z.array(OfflineEventSchema)
|
|
272
|
+
});
|
|
273
|
+
var ApproveRequestBodySchema = z.object({
|
|
274
|
+
id: z.string(),
|
|
275
|
+
retry: z.number(),
|
|
276
|
+
image: z.string()
|
|
277
|
+
});
|
|
278
|
+
var ReportApiResponseSchema = z.object({
|
|
279
|
+
tests: z.record(z.string(), TestDataSchema),
|
|
280
|
+
isUpdateMode: z.boolean().optional()
|
|
281
|
+
});
|
|
282
|
+
var ClientBootstrapDataSchema = z.object({
|
|
283
|
+
report: ReportApiResponseSchema.extend({
|
|
284
|
+
isUpdateMode: z.boolean()
|
|
285
|
+
}),
|
|
286
|
+
liveUpdates: z.boolean(),
|
|
287
|
+
approvalEnabled: z.boolean(),
|
|
288
|
+
approvalMessage: z.string().optional()
|
|
289
|
+
});
|
|
290
|
+
var ImagesViewModeSchema = z.enum(["side-by-side", "swap", "slide", "blend"]);
|
|
291
|
+
function safeParse(schema, data) {
|
|
292
|
+
const result = schema.safeParse(data);
|
|
293
|
+
if (result.success) {
|
|
294
|
+
return result.data;
|
|
295
|
+
}
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
|
|
157
299
|
// src/report-utils.ts
|
|
158
300
|
function normalizeScreenshotsBaseUrl(baseUrl) {
|
|
159
301
|
return baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
@@ -341,148 +483,6 @@ function finalizeRunEvent(state) {
|
|
|
341
483
|
};
|
|
342
484
|
}
|
|
343
485
|
|
|
344
|
-
// src/schemas.ts
|
|
345
|
-
import { z } from "zod";
|
|
346
|
-
var LocationSchema = z.object({
|
|
347
|
-
file: z.string(),
|
|
348
|
-
line: z.number()
|
|
349
|
-
});
|
|
350
|
-
var VisualSourceSchema = z.enum(["comparison", "baseline-only", "declared-only"]);
|
|
351
|
-
var ImagesSchema = z.object({
|
|
352
|
-
actual: z.string().optional(),
|
|
353
|
-
expect: z.string().optional(),
|
|
354
|
-
diff: z.string().optional(),
|
|
355
|
-
error: z.string().optional(),
|
|
356
|
-
source: VisualSourceSchema.optional()
|
|
357
|
-
});
|
|
358
|
-
var ScreenshotDeclarationSchema = z.discriminatedUnion("kind", [
|
|
359
|
-
z.object({
|
|
360
|
-
visualName: z.string(),
|
|
361
|
-
kind: z.literal("named"),
|
|
362
|
-
declaredName: z.string(),
|
|
363
|
-
snapshotBaseName: z.string(),
|
|
364
|
-
occurrenceIndex: z.number()
|
|
365
|
-
}),
|
|
366
|
-
z.object({
|
|
367
|
-
visualName: z.string(),
|
|
368
|
-
kind: z.literal("unnamed"),
|
|
369
|
-
occurrenceIndex: z.number()
|
|
370
|
-
})
|
|
371
|
-
]);
|
|
372
|
-
var AttachmentSchema = z.object({
|
|
373
|
-
name: z.string(),
|
|
374
|
-
path: z.string(),
|
|
375
|
-
contentType: z.string()
|
|
376
|
-
});
|
|
377
|
-
var TestStatusSchema = z.enum(["unknown", "pending", "running", "failed", "approved", "success", "retrying"]);
|
|
378
|
-
var TestResultStatusSchema = z.enum(["failed", "success", "pending"]);
|
|
379
|
-
var TestResultSchema = z.object({
|
|
380
|
-
status: TestResultStatusSchema,
|
|
381
|
-
retries: z.number(),
|
|
382
|
-
images: z.record(z.string(), ImagesSchema).optional(),
|
|
383
|
-
visualDeclarations: z.array(ScreenshotDeclarationSchema).optional(),
|
|
384
|
-
error: z.string().optional(),
|
|
385
|
-
duration: z.number().optional()
|
|
386
|
-
});
|
|
387
|
-
var TestDataSchema = z.object({
|
|
388
|
-
id: z.string(),
|
|
389
|
-
titlePath: z.array(z.string()),
|
|
390
|
-
browser: z.string(),
|
|
391
|
-
title: z.string(),
|
|
392
|
-
skip: z.union([z.boolean(), z.string()]).optional(),
|
|
393
|
-
retries: z.number().optional(),
|
|
394
|
-
status: TestStatusSchema.optional(),
|
|
395
|
-
results: z.array(TestResultSchema).optional(),
|
|
396
|
-
approved: z.record(z.string(), z.number()).nullable().optional(),
|
|
397
|
-
attachments: z.array(AttachmentSchema).optional(),
|
|
398
|
-
location: LocationSchema.optional()
|
|
399
|
-
});
|
|
400
|
-
var CrvyRprtrTestSchema = TestDataSchema.extend({
|
|
401
|
-
checked: z.boolean()
|
|
402
|
-
});
|
|
403
|
-
var CrvyRprtrSuiteSchema = z.lazy(
|
|
404
|
-
() => z.object({
|
|
405
|
-
path: z.array(z.string()),
|
|
406
|
-
skip: z.boolean(),
|
|
407
|
-
status: TestStatusSchema.optional(),
|
|
408
|
-
opened: z.boolean(),
|
|
409
|
-
checked: z.boolean(),
|
|
410
|
-
indeterminate: z.boolean(),
|
|
411
|
-
children: z.record(z.string(), z.union([CrvyRprtrSuiteSchema, CrvyRprtrTestSchema])).optional()
|
|
412
|
-
})
|
|
413
|
-
);
|
|
414
|
-
var WebSocketMessageSchema = z.object({
|
|
415
|
-
type: z.enum(["test-begin", "test-end", "run-end", "approve", "sync"]),
|
|
416
|
-
data: z.unknown()
|
|
417
|
-
});
|
|
418
|
-
var TestBeginDataSchema = z.object({
|
|
419
|
-
id: z.string(),
|
|
420
|
-
title: z.string(),
|
|
421
|
-
titlePath: z.array(z.string()),
|
|
422
|
-
browser: z.string(),
|
|
423
|
-
location: LocationSchema
|
|
424
|
-
});
|
|
425
|
-
var TestEndDataSchema = z.object({
|
|
426
|
-
id: z.string(),
|
|
427
|
-
status: z.enum(["passed", "failed", "skipped"]),
|
|
428
|
-
attachments: z.array(AttachmentSchema),
|
|
429
|
-
visualNames: z.array(z.string()).default([]),
|
|
430
|
-
visualDeclarations: z.preprocess(
|
|
431
|
-
(value) => value === null ? void 0 : value,
|
|
432
|
-
z.array(ScreenshotDeclarationSchema).optional()
|
|
433
|
-
),
|
|
434
|
-
error: z.string().optional(),
|
|
435
|
-
duration: z.number().optional()
|
|
436
|
-
});
|
|
437
|
-
var ReportDataSchema = z.object({
|
|
438
|
-
isRunning: z.boolean(),
|
|
439
|
-
tests: z.record(z.string(), TestDataSchema),
|
|
440
|
-
browsers: z.array(z.string()),
|
|
441
|
-
isUpdateMode: z.boolean(),
|
|
442
|
-
screenshotDir: z.string()
|
|
443
|
-
});
|
|
444
|
-
var LoadedReportDataSchema = z.object({
|
|
445
|
-
tests: z.record(z.string(), TestDataSchema).optional(),
|
|
446
|
-
isUpdateMode: z.boolean().optional()
|
|
447
|
-
});
|
|
448
|
-
var OfflineEventSchema = z.object({
|
|
449
|
-
type: z.enum(["test-begin", "test-end", "run-end"]),
|
|
450
|
-
data: z.unknown(),
|
|
451
|
-
timestamp: z.number(),
|
|
452
|
-
workerIndex: z.number()
|
|
453
|
-
});
|
|
454
|
-
var OfflineReportSchema = z.object({
|
|
455
|
-
version: z.number(),
|
|
456
|
-
generatedAt: z.string(),
|
|
457
|
-
workers: z.number(),
|
|
458
|
-
events: z.array(OfflineEventSchema)
|
|
459
|
-
});
|
|
460
|
-
var ApproveRequestBodySchema = z.object({
|
|
461
|
-
id: z.string(),
|
|
462
|
-
retry: z.number(),
|
|
463
|
-
image: z.string()
|
|
464
|
-
});
|
|
465
|
-
var ReportApiResponseSchema = z.object({
|
|
466
|
-
tests: z.record(z.string(), TestDataSchema),
|
|
467
|
-
isUpdateMode: z.boolean().optional()
|
|
468
|
-
});
|
|
469
|
-
var ClientBootstrapDataSchema = z.object({
|
|
470
|
-
report: ReportApiResponseSchema.extend({
|
|
471
|
-
isUpdateMode: z.boolean()
|
|
472
|
-
}),
|
|
473
|
-
liveUpdates: z.boolean(),
|
|
474
|
-
approvalEnabled: z.boolean(),
|
|
475
|
-
approvalMessage: z.string().optional()
|
|
476
|
-
});
|
|
477
|
-
var ImagesViewModeSchema = z.enum(["side-by-side", "swap", "slide", "blend"]);
|
|
478
|
-
function safeParse(schema, data) {
|
|
479
|
-
const result = schema.safeParse(data);
|
|
480
|
-
if (result.success) {
|
|
481
|
-
return result.data;
|
|
482
|
-
}
|
|
483
|
-
return null;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
486
|
export {
|
|
487
487
|
createMutableReportState,
|
|
488
488
|
applyTestBeginEvent,
|