@percy/core 1.30.0 → 1.30.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/dist/discovery.js +2 -4
- package/dist/network.js +2 -0
- package/dist/page.js +2 -2
- package/dist/percy.js +11 -2
- package/dist/snapshot.js +2 -2
- package/package.json +7 -7
- package/dist/timing.js +0 -21
package/dist/discovery.js
CHANGED
|
@@ -4,7 +4,6 @@ import Page from './page.js';
|
|
|
4
4
|
import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll, snapshotLogName, waitForTimeout, withRetries, waitForSelectorInsideBrowser } from './utils.js';
|
|
5
5
|
import { sha256hash } from '@percy/client/utils';
|
|
6
6
|
import Pako from 'pako';
|
|
7
|
-
import TimeIt from './timing.js';
|
|
8
7
|
|
|
9
8
|
// Logs verbose debug logs detailing various snapshot options.
|
|
10
9
|
function debugSnapshotOptions(snapshot) {
|
|
@@ -419,7 +418,6 @@ export function createDiscoveryQueue(percy) {
|
|
|
419
418
|
concurrency
|
|
420
419
|
} = percy.config.discovery;
|
|
421
420
|
let queue = new Queue('discovery');
|
|
422
|
-
let timeit = new TimeIt();
|
|
423
421
|
let cache;
|
|
424
422
|
return queue.set({
|
|
425
423
|
concurrency
|
|
@@ -453,13 +451,13 @@ export function createDiscoveryQueue(percy) {
|
|
|
453
451
|
})
|
|
454
452
|
// discovery resources for snapshots and call the callback for each discovered snapshot
|
|
455
453
|
.handle('task', async function* (snapshot, callback) {
|
|
456
|
-
await
|
|
454
|
+
await logger.measure('asset-discovery', snapshot.name, snapshot.meta, async () => {
|
|
457
455
|
percy.log.debug(`Discovering resources: ${snapshot.name}`, snapshot.meta);
|
|
458
456
|
|
|
459
457
|
// expectation explained in tests
|
|
460
458
|
/* istanbul ignore next: tested, but coverage is stripped */
|
|
461
459
|
let assetDiscoveryPageEnableJS = snapshot.cliEnableJavaScript && !snapshot.domSnapshot || (snapshot.enableJavaScript ?? !snapshot.domSnapshot);
|
|
462
|
-
percy.log.debug(`Asset discovery Browser Page enable JS: ${assetDiscoveryPageEnableJS}
|
|
460
|
+
percy.log.debug(`Asset discovery Browser Page enable JS: ${assetDiscoveryPageEnableJS}`, snapshot.meta);
|
|
463
461
|
await withRetries(async function* () {
|
|
464
462
|
// create a new browser page
|
|
465
463
|
let page = yield percy.browser.page({
|
package/dist/network.js
CHANGED
|
@@ -515,6 +515,7 @@ async function saveResponseResource(network, request) {
|
|
|
515
515
|
if (mimeType !== null && mimeType !== void 0 && mimeType.includes('font') || detectedMime && detectedMime.includes('font')) {
|
|
516
516
|
log.debug('- Requesting asset directly', meta);
|
|
517
517
|
body = await makeDirectRequest(network, request);
|
|
518
|
+
log.debug('- Got direct response', meta);
|
|
518
519
|
}
|
|
519
520
|
resource = createResource(url, body, mimeType, {
|
|
520
521
|
status: response.status,
|
|
@@ -533,6 +534,7 @@ async function saveResponseResource(network, request) {
|
|
|
533
534
|
}
|
|
534
535
|
}
|
|
535
536
|
if (resource && !resource.root) {
|
|
537
|
+
log.debug('- Saving resource', meta);
|
|
536
538
|
network.intercept.saveResource(resource);
|
|
537
539
|
}
|
|
538
540
|
}
|
package/dist/page.js
CHANGED
|
@@ -17,7 +17,7 @@ export class Page {
|
|
|
17
17
|
session.on('Runtime.executionContextDestroyed', this._handleExecutionContextDestroyed);
|
|
18
18
|
session.on('Runtime.executionContextsCleared', this._handleExecutionContextsCleared);
|
|
19
19
|
session.send('Runtime.enable').catch(session._handleClosedError);
|
|
20
|
-
this.log.debug('Page created');
|
|
20
|
+
this.log.debug('Page created', this.meta);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// Close the page
|
|
@@ -33,7 +33,7 @@ export class Page {
|
|
|
33
33
|
deviceScaleFactor = 1,
|
|
34
34
|
mobile = false
|
|
35
35
|
}) {
|
|
36
|
-
this.log.debug(`Resize page to ${width}x${height} @${deviceScaleFactor}x
|
|
36
|
+
this.log.debug(`Resize page to ${width}x${height} @${deviceScaleFactor}x`, this.meta);
|
|
37
37
|
await this.session.send('Emulation.setDeviceMetricsOverride', {
|
|
38
38
|
deviceScaleFactor,
|
|
39
39
|
mobile,
|
package/dist/percy.js
CHANGED
|
@@ -383,12 +383,12 @@ export class Percy {
|
|
|
383
383
|
|
|
384
384
|
// Uploads one or more snapshots directly to the current Percy build
|
|
385
385
|
upload(options, callback = null, screenshotFlow = null) {
|
|
386
|
+
var _options$tag2;
|
|
386
387
|
if (this.readyState !== 1) {
|
|
387
388
|
throw new Error('Not running');
|
|
388
389
|
} else if (Array.isArray(options)) {
|
|
389
390
|
return yieldAll(options.map(o => this.yield.upload(o)));
|
|
390
391
|
}
|
|
391
|
-
|
|
392
392
|
// validate comparison uploads and warn about any errors
|
|
393
393
|
|
|
394
394
|
// we are having two similar attrs in options: tags & tag
|
|
@@ -416,6 +416,15 @@ export class Percy {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
// set meta for logging
|
|
420
|
+
options.meta = {
|
|
421
|
+
snapshot: {
|
|
422
|
+
name: options.name,
|
|
423
|
+
testCase: options.testCase,
|
|
424
|
+
tag: (_options$tag2 = options.tag) === null || _options$tag2 === void 0 ? void 0 : _options$tag2.name
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
419
428
|
// add client & environment info
|
|
420
429
|
this.client.addClientInfo(options.clientInfo);
|
|
421
430
|
this.client.addEnvironmentInfo(options.environmentInfo);
|
|
@@ -555,7 +564,7 @@ function _displaySuggestionLogs(suggestions, options = {}) {
|
|
|
555
564
|
const suggestion = item === null || item === void 0 ? void 0 : item.suggestion;
|
|
556
565
|
const referenceDocLinks = item === null || item === void 0 ? void 0 : item.reference_doc_link;
|
|
557
566
|
if (options !== null && options !== void 0 && options.snapshotLevel) {
|
|
558
|
-
this.log.warn(`Detected
|
|
567
|
+
this.log.warn(`Detected error for Snapshot: ${options === null || options === void 0 ? void 0 : options.snapshotName}`);
|
|
559
568
|
} else {
|
|
560
569
|
this.log.warn('Detected error for percy build');
|
|
561
570
|
}
|
package/dist/snapshot.js
CHANGED
|
@@ -465,7 +465,7 @@ export function createSnapshotsQueue(percy) {
|
|
|
465
465
|
// Pushing to syncQueue, that will check for
|
|
466
466
|
// snapshot processing status, and will resolve once done
|
|
467
467
|
if (snapshot.sync) {
|
|
468
|
-
percy.log.info(`Waiting for snapshot '${name}' to be completed
|
|
468
|
+
percy.log.info(`Waiting for snapshot '${name}' to be completed`, meta);
|
|
469
469
|
const data = new JobData(response.data.id, null, snapshot.resolve, snapshot.reject);
|
|
470
470
|
percy.syncQueue.push(data);
|
|
471
471
|
}
|
|
@@ -501,7 +501,7 @@ export function createSnapshotsQueue(percy) {
|
|
|
501
501
|
if (duplicate) {
|
|
502
502
|
if (process.env.PERCY_IGNORE_DUPLICATES !== 'true') {
|
|
503
503
|
let errMsg = `Ignored duplicate snapshot. ${errors[1].detail}`;
|
|
504
|
-
percy.log.warn(errMsg);
|
|
504
|
+
percy.log.warn(errMsg, meta);
|
|
505
505
|
await percy.suggestionsForFix(errMsg, {
|
|
506
506
|
snapshotLevel: true,
|
|
507
507
|
snapshotName: name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.30.
|
|
47
|
-
"@percy/config": "1.30.
|
|
48
|
-
"@percy/dom": "1.30.
|
|
49
|
-
"@percy/logger": "1.30.
|
|
50
|
-
"@percy/webdriver-utils": "1.30.
|
|
46
|
+
"@percy/client": "1.30.1",
|
|
47
|
+
"@percy/config": "1.30.1",
|
|
48
|
+
"@percy/dom": "1.30.1",
|
|
49
|
+
"@percy/logger": "1.30.1",
|
|
50
|
+
"@percy/webdriver-utils": "1.30.1",
|
|
51
51
|
"content-disposition": "^0.5.4",
|
|
52
52
|
"cross-spawn": "^7.0.3",
|
|
53
53
|
"extract-zip": "^2.0.1",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"ws": "^8.17.1",
|
|
61
61
|
"yaml": "^2.4.1"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2f8fc42f57c3989de0c5ceca207854d8f66272d3"
|
|
64
64
|
}
|
package/dist/timing.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import logger from '@percy/logger';
|
|
2
|
-
export default class TimeIt {
|
|
3
|
-
log = logger('timer');
|
|
4
|
-
// returns a singleton instance
|
|
5
|
-
constructor() {
|
|
6
|
-
let {
|
|
7
|
-
instance = this
|
|
8
|
-
} = this.constructor;
|
|
9
|
-
this.constructor.instance = instance;
|
|
10
|
-
return instance;
|
|
11
|
-
}
|
|
12
|
-
async measure(name, identifier, callback) {
|
|
13
|
-
const startTime = Date.now();
|
|
14
|
-
try {
|
|
15
|
-
return await callback();
|
|
16
|
-
} finally {
|
|
17
|
-
const duration = Date.now() - startTime;
|
|
18
|
-
this.log.debug(`${name} - ${identifier} - ${duration / 1000}s`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|