@percy/core 1.31.10-beta.1 → 1.31.10-beta.3
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/snapshot.js +38 -0
- package/package.json +11 -8
package/dist/snapshot.js
CHANGED
|
@@ -360,6 +360,41 @@ function mergeSnapshotOptions(prev = {}, next) {
|
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// Runs quick doctor diagnostics after a build failure, guarded by PERCY_AUTO_DOCTOR env var.
|
|
364
|
+
// Uses dynamic import so @percy/cli-doctor is not a hard dependency of @percy/core.
|
|
365
|
+
async function runDoctorOnFailure(percy) {
|
|
366
|
+
// Guard against double-fire: build-creation failure triggers this in the
|
|
367
|
+
// 'start' catch, and the subsequent 'end' handler (no build id) would fire
|
|
368
|
+
// it again — each quick-mode run carries up to 8s of network latency.
|
|
369
|
+
if (percy._doctorRanOnFailure) return;
|
|
370
|
+
percy._doctorRanOnFailure = true;
|
|
371
|
+
if (process.env.PERCY_AUTO_DOCTOR !== 'true') {
|
|
372
|
+
percy.log.warn('Run `percy doctor` to diagnose connectivity and token issues.');
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
percy.log.info('[percy doctor] Running quick diagnostics after build failure...');
|
|
376
|
+
try {
|
|
377
|
+
var _report$checks, _report$checks2;
|
|
378
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
379
|
+
const {
|
|
380
|
+
runDiagnostics
|
|
381
|
+
} = await import('@percy/cli-doctor');
|
|
382
|
+
const report = await runDiagnostics({
|
|
383
|
+
mode: 'quick',
|
|
384
|
+
timeout: 8000
|
|
385
|
+
});
|
|
386
|
+
const failed = (report === null || report === void 0 || (_report$checks = report.checks) === null || _report$checks === void 0 || (_report$checks = _report$checks.connectivity) === null || _report$checks === void 0 ? void 0 : _report$checks.status) === 'fail' || (report === null || report === void 0 || (_report$checks2 = report.checks) === null || _report$checks2 === void 0 || (_report$checks2 = _report$checks2.auth) === null || _report$checks2 === void 0 ? void 0 : _report$checks2.status) === 'fail';
|
|
387
|
+
if (failed) {
|
|
388
|
+
percy.log.warn('[percy doctor] Quick check found issues — see above for details.');
|
|
389
|
+
} else {
|
|
390
|
+
percy.log.info('[percy doctor] Connectivity and token look healthy — the failure may be server-side.');
|
|
391
|
+
}
|
|
392
|
+
} catch {
|
|
393
|
+
// doctor not installed or import failed — degrade silently
|
|
394
|
+
percy.log.debug('[percy doctor] Could not run automatic diagnostics (package not available).');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
363
398
|
// Creates a snapshots queue that manages a Percy build and uploads snapshots.
|
|
364
399
|
export function createSnapshotsQueue(percy) {
|
|
365
400
|
let {
|
|
@@ -406,6 +441,7 @@ export function createSnapshotsQueue(percy) {
|
|
|
406
441
|
});
|
|
407
442
|
percy.log.error(build.error);
|
|
408
443
|
percy.log.error(err);
|
|
444
|
+
await runDoctorOnFailure(percy);
|
|
409
445
|
queue.close(true);
|
|
410
446
|
}
|
|
411
447
|
})
|
|
@@ -417,6 +453,7 @@ export function createSnapshotsQueue(percy) {
|
|
|
417
453
|
percy.log.warn(`Build #${build.number} failed: ${build.url}`, {
|
|
418
454
|
build
|
|
419
455
|
});
|
|
456
|
+
await runDoctorOnFailure(percy);
|
|
420
457
|
} else if ((_build2 = build) !== null && _build2 !== void 0 && _build2.id) {
|
|
421
458
|
await percy.client.finalizeBuild(build.id);
|
|
422
459
|
percy.log.info(`Finalized build #${build.number}: ${build.url}`, {
|
|
@@ -426,6 +463,7 @@ export function createSnapshotsQueue(percy) {
|
|
|
426
463
|
percy.log.warn('Build not created', {
|
|
427
464
|
build
|
|
428
465
|
});
|
|
466
|
+
await runDoctorOnFailure(percy);
|
|
429
467
|
}
|
|
430
468
|
})
|
|
431
469
|
// snapshots are unique by name and testCase both
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.31.10-beta.
|
|
3
|
+
"version": "1.31.10-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.31.10-beta.
|
|
47
|
-
"@percy/config": "1.31.10-beta.
|
|
48
|
-
"@percy/dom": "1.31.10-beta.
|
|
49
|
-
"@percy/logger": "1.31.10-beta.
|
|
50
|
-
"@percy/monitoring": "1.31.10-beta.
|
|
51
|
-
"@percy/webdriver-utils": "1.31.10-beta.
|
|
46
|
+
"@percy/client": "1.31.10-beta.3",
|
|
47
|
+
"@percy/config": "1.31.10-beta.3",
|
|
48
|
+
"@percy/dom": "1.31.10-beta.3",
|
|
49
|
+
"@percy/logger": "1.31.10-beta.3",
|
|
50
|
+
"@percy/monitoring": "1.31.10-beta.3",
|
|
51
|
+
"@percy/webdriver-utils": "1.31.10-beta.3",
|
|
52
52
|
"content-disposition": "^0.5.4",
|
|
53
53
|
"cross-spawn": "^7.0.3",
|
|
54
54
|
"extract-zip": "^2.0.1",
|
|
@@ -61,5 +61,8 @@
|
|
|
61
61
|
"ws": "^8.17.1",
|
|
62
62
|
"yaml": "^2.4.1"
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"optionalDependencies": {
|
|
65
|
+
"@percy/cli-doctor": "1.31.10-beta.3"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "a6bc2f02f722c7a6a16cdbc1dc3002b1de00f062"
|
|
65
68
|
}
|