@vizzly-testing/cli 0.35.2 → 0.35.3-beta.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/README.md +8 -5
- package/dist/api/client.js +20 -5
- package/dist/api/core.js +17 -3
- package/dist/api/endpoints.js +24 -3
- package/dist/api/index.js +1 -1
- package/dist/cli.js +25 -65
- package/dist/commands/baselines.js +0 -7
- package/dist/commands/comparisons.js +52 -45
- package/dist/commands/config-cmd.js +0 -7
- package/dist/commands/context.js +444 -238
- package/dist/commands/doctor.js +0 -8
- package/dist/commands/init.js +7 -12
- package/dist/commands/login.js +0 -13
- package/dist/commands/logout.js +0 -12
- package/dist/commands/orgs.js +0 -9
- package/dist/commands/run.js +84 -29
- package/dist/commands/status.js +276 -59
- package/dist/commands/tdd.js +19 -3
- package/dist/commands/whoami.js +0 -12
- package/dist/context/local-workspace-provider.js +293 -37
- package/dist/plugin-loader.js +1 -1
- package/dist/reporter/reporter-bundle.css +1 -1
- package/dist/reporter/reporter-bundle.iife.js +17 -17
- package/dist/server/routers/events.js +4 -4
- package/dist/test-runner/operations.js +70 -28
- package/dist/types/index.d.ts +4 -2
- package/dist/uploader/core.js +6 -6
- package/dist/uploader/operations.js +4 -1
- package/dist/utils/visual-context-normalizers.js +455 -0
- package/package.json +13 -13
- package/skills/vizzly/SKILL.md +68 -101
- package/skills/vizzly/agents/openai.yaml +2 -2
- package/skills/vizzly/references/cli-context.md +79 -27
- package/skills/vizzly/references/dynamic-content.md +28 -33
- package/skills/vizzly/references/sdks.md +26 -39
- package/skills/vizzly/references/setup-ci.md +44 -20
- package/dist/config/index.js +0 -13
- package/dist/project/index.js +0 -13
- package/dist/tdd/index.js +0 -19
- package/dist/tdd/services/baseline-downloader.js +0 -151
- package/dist/tdd/services/hotspot-service.js +0 -58
- package/dist/utils/environment.js +0 -109
- package/skills/vizzly/references/public-screenshots.md +0 -44
|
@@ -19,7 +19,7 @@ let defaultTimers = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Read and parse JSON from disk, returning null on missing or invalid files.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
function readJsonFile(path) {
|
|
23
23
|
if (!existsSync(path)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
@@ -33,7 +33,7 @@ export function readJsonFile(path) {
|
|
|
33
33
|
/**
|
|
34
34
|
* Read report data and attach baseline metadata for the stats view.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
function readReportDataFile({
|
|
37
37
|
reportDataPath,
|
|
38
38
|
baselineMetadataPath
|
|
39
39
|
}) {
|
|
@@ -84,7 +84,7 @@ function summaryChanged(oldData, newData) {
|
|
|
84
84
|
/**
|
|
85
85
|
* Build incremental SSE events by diffing old vs new report data.
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
function buildReportDataEvents(oldData, newData) {
|
|
88
88
|
if (!oldData) {
|
|
89
89
|
return [{
|
|
90
90
|
type: 'reportData',
|
|
@@ -129,7 +129,7 @@ export function buildReportDataEvents(oldData, newData) {
|
|
|
129
129
|
/**
|
|
130
130
|
* Watch report-data.json with fs.watch plus a lightweight mtime fallback.
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
function watchReportDataFile({
|
|
133
133
|
workingDir,
|
|
134
134
|
reportDataPath,
|
|
135
135
|
onReportDataChanged,
|
|
@@ -57,6 +57,9 @@ export async function createBuild({
|
|
|
57
57
|
let client = createApiClient(clientOptions);
|
|
58
58
|
let payload = buildApiBuildPayload(runOptions, config.comparison);
|
|
59
59
|
let buildResult = await createApiBuild(client, payload);
|
|
60
|
+
if (!buildResult?.id) {
|
|
61
|
+
throw new Error('Vizzly API did not return a build ID');
|
|
62
|
+
}
|
|
60
63
|
output.debug('build', `created ${buildResult.id}`);
|
|
61
64
|
return buildResult.id;
|
|
62
65
|
}
|
|
@@ -227,6 +230,26 @@ export function executeTestCommand({
|
|
|
227
230
|
resolve.__process = testProcess;
|
|
228
231
|
});
|
|
229
232
|
}
|
|
233
|
+
async function executeDisabledTestRun({
|
|
234
|
+
testCommand,
|
|
235
|
+
json,
|
|
236
|
+
deps
|
|
237
|
+
}) {
|
|
238
|
+
let {
|
|
239
|
+
spawn,
|
|
240
|
+
createError
|
|
241
|
+
} = deps;
|
|
242
|
+
await executeTestCommand({
|
|
243
|
+
command: testCommand,
|
|
244
|
+
env: buildDisabledEnv(),
|
|
245
|
+
json,
|
|
246
|
+
deps: {
|
|
247
|
+
spawn,
|
|
248
|
+
createError
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return buildDisabledRunResult();
|
|
252
|
+
}
|
|
230
253
|
|
|
231
254
|
// ============================================================================
|
|
232
255
|
// High-Level Run Operations
|
|
@@ -278,25 +301,22 @@ export async function runTests({
|
|
|
278
301
|
hasApiKey: hasApiKey(config),
|
|
279
302
|
tdd
|
|
280
303
|
})) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
command: testCommand,
|
|
284
|
-
env,
|
|
304
|
+
return executeDisabledTestRun({
|
|
305
|
+
testCommand,
|
|
285
306
|
json: runOptions.json,
|
|
286
307
|
deps: {
|
|
287
308
|
spawn,
|
|
288
309
|
createError
|
|
289
310
|
}
|
|
290
311
|
});
|
|
291
|
-
return buildDisabledRunResult();
|
|
292
312
|
}
|
|
293
313
|
let buildId = null;
|
|
294
314
|
let buildUrl = null;
|
|
295
315
|
let screenshotCount = 0;
|
|
296
316
|
let testSuccess = false;
|
|
297
317
|
let testError = null;
|
|
318
|
+
let setBaseline;
|
|
298
319
|
try {
|
|
299
|
-
// Create build
|
|
300
320
|
buildId = await createBuild({
|
|
301
321
|
runOptions,
|
|
302
322
|
tdd,
|
|
@@ -332,7 +352,7 @@ export async function runTests({
|
|
|
332
352
|
}
|
|
333
353
|
|
|
334
354
|
// Start server
|
|
335
|
-
|
|
355
|
+
setBaseline = normalizeSetBaseline(runOptions);
|
|
336
356
|
await serverManager.start(buildId, tdd, setBaseline);
|
|
337
357
|
if (onServerReady) {
|
|
338
358
|
onServerReady({
|
|
@@ -341,32 +361,48 @@ export async function runTests({
|
|
|
341
361
|
tdd
|
|
342
362
|
});
|
|
343
363
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
buildId,
|
|
349
|
-
setBaseline,
|
|
350
|
-
failOnDiff: runOptions.failOnDiff || false
|
|
364
|
+
} catch (error) {
|
|
365
|
+
output.warn('Vizzly encountered an error. Running tests without visual testing.');
|
|
366
|
+
output.debug('run', 'setup failed; disabling Vizzly', {
|
|
367
|
+
error: error.message
|
|
351
368
|
});
|
|
352
369
|
try {
|
|
353
|
-
await
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
deps: {
|
|
358
|
-
spawn,
|
|
359
|
-
createError
|
|
360
|
-
}
|
|
370
|
+
await serverManager.stop();
|
|
371
|
+
} catch (stopError) {
|
|
372
|
+
output.debug('run', 'failed to stop Vizzly after setup error', {
|
|
373
|
+
error: stopError.message
|
|
361
374
|
});
|
|
362
|
-
testSuccess = true;
|
|
363
|
-
} catch (error) {
|
|
364
|
-
testError = error;
|
|
365
|
-
testSuccess = false;
|
|
366
375
|
}
|
|
376
|
+
return executeDisabledTestRun({
|
|
377
|
+
testCommand,
|
|
378
|
+
json: runOptions.json,
|
|
379
|
+
deps: {
|
|
380
|
+
spawn,
|
|
381
|
+
createError
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Execute the user's tests. This is the only error that can fail the run.
|
|
387
|
+
let env = buildTestEnv({
|
|
388
|
+
port: config.server?.port,
|
|
389
|
+
buildId,
|
|
390
|
+
setBaseline,
|
|
391
|
+
failOnDiff: runOptions.failOnDiff || false
|
|
392
|
+
});
|
|
393
|
+
try {
|
|
394
|
+
await executeTestCommand({
|
|
395
|
+
command: testCommand,
|
|
396
|
+
env,
|
|
397
|
+
json: runOptions.json,
|
|
398
|
+
deps: {
|
|
399
|
+
spawn,
|
|
400
|
+
createError
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
testSuccess = true;
|
|
367
404
|
} catch (error) {
|
|
368
405
|
testError = error;
|
|
369
|
-
testSuccess = false;
|
|
370
406
|
}
|
|
371
407
|
|
|
372
408
|
// Get TDD results before stopping the server
|
|
@@ -410,7 +446,13 @@ export async function runTests({
|
|
|
410
446
|
|
|
411
447
|
// In API mode, get actual screenshot count from handler after flush
|
|
412
448
|
if (!tdd && serverManager.server?.getScreenshotCount) {
|
|
413
|
-
|
|
449
|
+
try {
|
|
450
|
+
screenshotCount = serverManager.server.getScreenshotCount(buildId) || 0;
|
|
451
|
+
} catch (countError) {
|
|
452
|
+
output.debug('build', 'failed to get screenshot count', {
|
|
453
|
+
error: countError.message
|
|
454
|
+
});
|
|
455
|
+
}
|
|
414
456
|
}
|
|
415
457
|
} finally {
|
|
416
458
|
try {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -205,10 +205,12 @@ export interface BuildResult {
|
|
|
205
205
|
status: 'completed' | 'failed' | 'pending';
|
|
206
206
|
build: unknown;
|
|
207
207
|
comparisons?: number;
|
|
208
|
-
totalComparisons
|
|
208
|
+
totalComparisons?: number;
|
|
209
209
|
passedComparisons?: number;
|
|
210
210
|
failedComparisons?: number;
|
|
211
|
-
newComparisons
|
|
211
|
+
newComparisons?: number;
|
|
212
|
+
identicalComparisons?: number;
|
|
213
|
+
approvalStatus?: string;
|
|
212
214
|
url?: string;
|
|
213
215
|
}
|
|
214
216
|
|
package/dist/uploader/core.js
CHANGED
|
@@ -340,15 +340,15 @@ export function buildUploadResult({
|
|
|
340
340
|
* @returns {Object} Wait result
|
|
341
341
|
*/
|
|
342
342
|
export function buildWaitResult(build) {
|
|
343
|
-
let totalComparisons = build.comparisonsTotal ?? build.total_comparisons
|
|
344
|
-
let passedComparisons = build.comparisonsPassed ?? build.passed_comparisons ?? build.identicalComparisons ?? build.identical_comparisons
|
|
345
|
-
let failedComparisons = build.comparisonsFailed ?? build.failed_comparisons ?? build.changedComparisons ?? build.changed_comparisons
|
|
346
|
-
let newComparisons = build.comparisonsNew ?? build.newComparisons ?? build.new_comparisons
|
|
343
|
+
let totalComparisons = build.comparisonsTotal ?? build.total_comparisons;
|
|
344
|
+
let passedComparisons = build.comparisonsPassed ?? build.passed_comparisons ?? build.identicalComparisons ?? build.identical_comparisons;
|
|
345
|
+
let failedComparisons = build.comparisonsFailed ?? build.failed_comparisons ?? build.changedComparisons ?? build.changed_comparisons;
|
|
346
|
+
let newComparisons = build.comparisonsNew ?? build.newComparisons ?? build.new_comparisons;
|
|
347
347
|
let identicalComparisons = build.identicalComparisons ?? build.identical_comparisons ?? passedComparisons;
|
|
348
|
-
let approvalStatus = build.approvalStatus ?? build.approval_status
|
|
348
|
+
let approvalStatus = build.approvalStatus ?? build.approval_status;
|
|
349
349
|
let hasComparisonCounts = build.comparisonsTotal !== undefined || build.total_comparisons !== undefined || build.comparisonsPassed !== undefined || build.passed_comparisons !== undefined || build.comparisonsFailed !== undefined || build.failed_comparisons !== undefined || build.comparisonsNew !== undefined || build.new_comparisons !== undefined || build.identicalComparisons !== undefined || build.identical_comparisons !== undefined;
|
|
350
350
|
let result = {
|
|
351
|
-
status:
|
|
351
|
+
status: build.status,
|
|
352
352
|
build,
|
|
353
353
|
passedComparisons,
|
|
354
354
|
failedComparisons,
|
|
@@ -281,7 +281,10 @@ export async function waitForBuild({
|
|
|
281
281
|
return buildWaitResult(build);
|
|
282
282
|
}
|
|
283
283
|
if (build.status === 'failed') {
|
|
284
|
-
throw createError(`Build failed: ${build.error || 'Unknown error'}`, 'BUILD_FAILED'
|
|
284
|
+
throw createError(`Build failed: ${build.error || 'Unknown error'}`, 'BUILD_FAILED', {
|
|
285
|
+
buildId,
|
|
286
|
+
build
|
|
287
|
+
});
|
|
285
288
|
}
|
|
286
289
|
let remaining = timeout - getElapsedTime(startTime, now());
|
|
287
290
|
if (remaining <= 0) {
|