@percy/core 1.31.2-beta.0 → 1.31.2-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 +3 -3
- package/dist/api.js +2 -2
- package/dist/discovery.js +2 -2
- package/dist/install.js +1 -1
- package/dist/network.js +7 -7
- package/dist/percy.js +6 -6
- package/dist/queue.js +1 -1
- package/dist/snapshot.js +3 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -56,12 +56,12 @@ The following options can also be defined within a Percy config file
|
|
|
56
56
|
- `userAgent` — Custom user-agent string used when requesting assets
|
|
57
57
|
- `cookies` — Browser cookies to use when requesting assets
|
|
58
58
|
- `networkIdleTimeout` — Milliseconds to wait for the network to idle (**default** `100`)
|
|
59
|
-
- `concurrency` — Asset discovery
|
|
59
|
+
- `concurrency` — Asset discovery concurrency (**default** `5`)
|
|
60
60
|
- `launchOptions` — Asset discovery browser launch options
|
|
61
61
|
- `executable` — Browser executable path (**default** `process.env.PERCY_BROWSER_EXECUTABLE`)
|
|
62
62
|
- `timeout` — Discovery launch timeout, in milliseconds (**default** `30000`)
|
|
63
63
|
- `args` — Additional browser process arguments
|
|
64
|
-
- `headless` — Runs the browser
|
|
64
|
+
- `headless` — Runs the browser headlessly (**default** `true`)
|
|
65
65
|
|
|
66
66
|
Additional Percy config file options are also allowed and will override any options defined by a
|
|
67
67
|
local config file. These config file options are also made available to SDKs via the local API
|
|
@@ -282,7 +282,7 @@ environment variable.
|
|
|
282
282
|
|
|
283
283
|
- Vist https://chromiumdash.appspot.com/releases?platform=Mac and check for current version in use.
|
|
284
284
|
- Get Branch Base Position for that release.
|
|
285
|
-
- Visit https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/ and search for exact/
|
|
285
|
+
- Visit https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/ and search for exact/nearest Branch Base Position.
|
|
286
286
|
|
|
287
287
|
### Excerpt
|
|
288
288
|
|
package/dist/api.js
CHANGED
|
@@ -54,7 +54,7 @@ export function createPercyServer(percy, port) {
|
|
|
54
54
|
res.setHeader('X-Percy-Core-Version', ((_percy$testing2 = percy.testing) === null || _percy$testing2 === void 0 ? void 0 : _percy$testing2.version) ?? pkg.version);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// track all api
|
|
57
|
+
// track all api requests in testing mode
|
|
58
58
|
if (percy.testing && !req.url.pathname.startsWith('/test/')) {
|
|
59
59
|
var _percy$testing3;
|
|
60
60
|
((_percy$testing3 = percy.testing).requests || (_percy$testing3.requests = [])).push({
|
|
@@ -119,7 +119,7 @@ export function createPercyServer(percy, port) {
|
|
|
119
119
|
logger('core:server').deprecated(['It looks like you’re using @percy/cli with an older SDK.', 'Please upgrade to the latest version to fix this warning.', 'See these docs for more info: https://www.browserstack.com/docs/percy/migration/migrate-to-cli'].join(' '));
|
|
120
120
|
let content = await fs.promises.readFile(PERCY_DOM, 'utf-8');
|
|
121
121
|
let wrapper = '(window.PercyAgent = class { snapshot(n, o) { return PercyDOM.serialize(o); } });';
|
|
122
|
-
return res.send(200, '
|
|
122
|
+
return res.send(200, 'application/javascript', content.concat(wrapper));
|
|
123
123
|
})
|
|
124
124
|
// post one or more snapshots, optionally async
|
|
125
125
|
.route('post', '/percy/snapshot', async (req, res) => {
|
package/dist/discovery.js
CHANGED
|
@@ -259,7 +259,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
259
259
|
let cookies = ((_snapshot$domSnapshot = snapshot.domSnapshot) === null || _snapshot$domSnapshot === void 0 ? void 0 : _snapshot$domSnapshot.cookies) || ((_snapshot$domSnapshot2 = snapshot.domSnapshot) === null || _snapshot$domSnapshot2 === void 0 || (_snapshot$domSnapshot2 = _snapshot$domSnapshot2[0]) === null || _snapshot$domSnapshot2 === void 0 ? void 0 : _snapshot$domSnapshot2.cookies);
|
|
260
260
|
cookies = parseCookies(cookies);
|
|
261
261
|
|
|
262
|
-
// iterate over device to trigger
|
|
262
|
+
// iterate over device to trigger requests and capture other dpr width
|
|
263
263
|
async function* captureResponsiveAssets() {
|
|
264
264
|
for (const device of captureForDevices) {
|
|
265
265
|
discovery = {
|
|
@@ -354,7 +354,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
354
354
|
} = snap;
|
|
355
355
|
let [width] = widths;
|
|
356
356
|
|
|
357
|
-
// iterate over widths to trigger
|
|
357
|
+
// iterate over widths to trigger requests and capture other widths
|
|
358
358
|
if (isBaseSnapshot || captureWidths) {
|
|
359
359
|
for (let i = 0; i < widths.length - 1; i++) {
|
|
360
360
|
if (captureWidths) yield* takeSnapshot(snap, width);
|
package/dist/install.js
CHANGED
|
@@ -6,7 +6,7 @@ import logger from '@percy/logger';
|
|
|
6
6
|
import cp from 'child_process';
|
|
7
7
|
import { ProxyHttpsAgent, formatBytes } from '@percy/client/utils';
|
|
8
8
|
|
|
9
|
-
// Formats
|
|
9
|
+
// Formats milliseconds as "MM:SS"
|
|
10
10
|
function formatTime(ms) {
|
|
11
11
|
let minutes = (ms / 1000 / 60).toString().split('.')[0].padStart(2, '0');
|
|
12
12
|
let seconds = (ms / 1000 % 60).toFixed().padStart(2, '0');
|
package/dist/network.js
CHANGED
|
@@ -289,10 +289,10 @@ export class Network {
|
|
|
289
289
|
response
|
|
290
290
|
} = event;
|
|
291
291
|
// await on requestWillBeSent
|
|
292
|
-
// no explicitly wait on requestWillBePaused as we
|
|
292
|
+
// no explicitly wait on requestWillBePaused as we implicitly wait on it, since it manipulates the lifeCycle of request using Fetch module
|
|
293
293
|
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
|
|
294
294
|
let request = this.#requests.get(requestId);
|
|
295
|
-
/* istanbul ignore if: race condition
|
|
295
|
+
/* istanbul ignore if: race condition paranoia */
|
|
296
296
|
if (!request) return;
|
|
297
297
|
request.response = response;
|
|
298
298
|
request.response.buffer = async () => {
|
|
@@ -314,7 +314,7 @@ export class Network {
|
|
|
314
314
|
// wait for request to be sent
|
|
315
315
|
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
|
|
316
316
|
let request = this.#requests.get(requestId);
|
|
317
|
-
/* istanbul ignore else: race condition
|
|
317
|
+
/* istanbul ignore else: race condition paranoia */
|
|
318
318
|
if (request) this._forgetRequest(request);
|
|
319
319
|
};
|
|
320
320
|
|
|
@@ -327,7 +327,7 @@ export class Network {
|
|
|
327
327
|
// wait for upto 2 seconds or check if response has been sent
|
|
328
328
|
await this.#requestsLifeCycleHandler.get(requestId).responseReceived;
|
|
329
329
|
let request = this.#requests.get(requestId);
|
|
330
|
-
/* istanbul ignore if: race condition
|
|
330
|
+
/* istanbul ignore if: race condition paranoia */
|
|
331
331
|
if (!request) return;
|
|
332
332
|
await saveResponseResource(this, request, session);
|
|
333
333
|
this._forgetRequest(request);
|
|
@@ -344,7 +344,7 @@ export class Network {
|
|
|
344
344
|
// and in any case, order of processing for responseReceived and loadingFailed does not matter, as response capturing is done in loadingFinished
|
|
345
345
|
await this.#requestsLifeCycleHandler.get(requestId).requestWillBeSent;
|
|
346
346
|
let request = this.#requests.get(event.requestId);
|
|
347
|
-
/* istanbul ignore if: race condition
|
|
347
|
+
/* istanbul ignore if: race condition paranoia */
|
|
348
348
|
if (!request) return;
|
|
349
349
|
|
|
350
350
|
// If request was aborted, keep track of it as we need to cancel any in process callbacks for
|
|
@@ -489,7 +489,7 @@ async function makeDirectRequest(network, request, session) {
|
|
|
489
489
|
});
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
// Save a resource from a request, skipping it if specific
|
|
492
|
+
// Save a resource from a request, skipping it if specific parameters are not met
|
|
493
493
|
async function saveResponseResource(network, request, session) {
|
|
494
494
|
var _response$headers;
|
|
495
495
|
let {
|
|
@@ -505,7 +505,7 @@ async function saveResponseResource(network, request, session) {
|
|
|
505
505
|
url,
|
|
506
506
|
responseStatus: response === null || response === void 0 ? void 0 : response.status
|
|
507
507
|
};
|
|
508
|
-
//
|
|
508
|
+
// Checking for content length more than 100MB, to prevent websocket error which is governed by
|
|
509
509
|
// maxPayload option of websocket defaulted to 100MB.
|
|
510
510
|
// If content-length is more than our allowed 25MB, no need to process that resouce we can return log.
|
|
511
511
|
let contentLength = (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers[Object.keys(response.headers).find(key => key.toLowerCase() === 'content-length')];
|
package/dist/percy.js
CHANGED
|
@@ -212,7 +212,7 @@ export class Percy {
|
|
|
212
212
|
if (process.env.PERCY_CLIENT_ERROR_LOGS !== 'false') {
|
|
213
213
|
this.log.warn('Notice: Percy collects CI logs to improve service and enhance your experience. These logs help us debug issues and provide insights on your dashboards, making it easier to optimize the product experience. Logs are stored securely for 30 days. You can opt out anytime with export PERCY_CLIENT_ERROR_LOGS=false, but keeping this enabled helps us offer the best support and features.');
|
|
214
214
|
}
|
|
215
|
-
// Not awaiting proxy check as this can be
|
|
215
|
+
// Not awaiting proxy check as this can be asynchronous when not enabled
|
|
216
216
|
const detectProxy = detectSystemProxyAndLog(this.config.percy.useSystemProxy);
|
|
217
217
|
if (this.config.percy.useSystemProxy) await detectProxy;
|
|
218
218
|
// start the snapshots queue immediately when not delayed or deferred
|
|
@@ -372,7 +372,7 @@ export class Percy {
|
|
|
372
372
|
if (cpuInfo.currentUsagePercent >= 80 || memoryUsageInfo.currentUsagePercent >= 80) {
|
|
373
373
|
let currentConcurrent = _classPrivateFieldGet(_discovery, this).concurrency;
|
|
374
374
|
|
|
375
|
-
// concurrency must be
|
|
375
|
+
// concurrency must be between [1, (default/user defined value)]
|
|
376
376
|
let newConcurrency = Math.max(1, parseInt(currentConcurrent / 2));
|
|
377
377
|
newConcurrency = Math.min(this.discoveryMaxConcurrency, newConcurrency);
|
|
378
378
|
this.log.debug(`Downscaling discovery browser concurrency from ${_classPrivateFieldGet(_discovery, this).concurrency} to ${newConcurrency}`);
|
|
@@ -383,7 +383,7 @@ export class Percy {
|
|
|
383
383
|
let currentConcurrent = _classPrivateFieldGet(_discovery, this).concurrency;
|
|
384
384
|
let newConcurrency = currentConcurrent + 2;
|
|
385
385
|
|
|
386
|
-
// concurrency must be
|
|
386
|
+
// concurrency must be between [1, (default/user-defined value)]
|
|
387
387
|
newConcurrency = Math.min(this.discoveryMaxConcurrency, newConcurrency);
|
|
388
388
|
newConcurrency = Math.max(1, newConcurrency);
|
|
389
389
|
this.log.debug(`Upscaling discovery browser concurrency from ${_classPrivateFieldGet(_discovery, this).concurrency} to ${newConcurrency}`);
|
|
@@ -429,7 +429,7 @@ export class Percy {
|
|
|
429
429
|
throw new Error('Cannot capture DOM snapshots when asset discovery is disabled');
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
// return an async generator to allow
|
|
432
|
+
// return an async generator to allow cancellation
|
|
433
433
|
return async function* () {
|
|
434
434
|
let server;
|
|
435
435
|
try {
|
|
@@ -533,7 +533,7 @@ export class Percy {
|
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
-
// return an async generator to allow
|
|
536
|
+
// return an async generator to allow cancellation
|
|
537
537
|
return async function* () {
|
|
538
538
|
try {
|
|
539
539
|
return yield* yieldTo(_classPrivateFieldGet(_snapshots, this).push(options));
|
|
@@ -615,7 +615,7 @@ export class Percy {
|
|
|
615
615
|
// This can be due to proxy issue
|
|
616
616
|
this.log.error('percy.io might not be reachable, check network connection, proxy and ensure that percy.io is whitelisted.');
|
|
617
617
|
if (!_assertClassBrand(_Percy_brand, this, _proxyEnabled).call(this)) {
|
|
618
|
-
this.log.error('If inside a proxied
|
|
618
|
+
this.log.error('If inside a proxied environment, please configure the following environment variables: HTTP_PROXY, [ and optionally HTTPS_PROXY if you need it ]. Refer to our documentation for more details');
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
this.log.error('Unable to analyze error logs');
|
package/dist/queue.js
CHANGED
|
@@ -211,7 +211,7 @@ export class Queue {
|
|
|
211
211
|
|
|
212
212
|
// processes tasks using a generator promise, allowing task handlers to be cancelable
|
|
213
213
|
|
|
214
|
-
// returns a generator that
|
|
214
|
+
// returns a generator that yields until started and no longer pending, calling the
|
|
215
215
|
// callback every 10ms during checks with the current number of pending tasks
|
|
216
216
|
idle(callback) {
|
|
217
217
|
return yieldFor(() => {
|
package/dist/snapshot.js
CHANGED
|
@@ -19,7 +19,7 @@ function validURL(url, base) {
|
|
|
19
19
|
}
|
|
20
20
|
function validateAndFixSnapshotUrl(snapshot) {
|
|
21
21
|
let log = logger('core:snapshot');
|
|
22
|
-
// encoding snapshot url, if
|
|
22
|
+
// encoding snapshot url, if contains invalid URI characters/syntax
|
|
23
23
|
let modifiedURL = decodeAndEncodeURLWithLogging(snapshot.url, log, {
|
|
24
24
|
meta: {
|
|
25
25
|
snapshot: {
|
|
@@ -93,7 +93,7 @@ function mapSnapshotOptions(snapshots, context) {
|
|
|
93
93
|
exclude,
|
|
94
94
|
...opts
|
|
95
95
|
}) => snap => next(
|
|
96
|
-
// assign additional options to included
|
|
96
|
+
// assign additional options to included snapshots
|
|
97
97
|
snapshotMatches(snap, include, exclude) ? Object.assign(snap, opts) : snap), snap => getSnapshotOptions(snap, context));
|
|
98
98
|
|
|
99
99
|
// reduce snapshots with options
|
|
@@ -326,7 +326,7 @@ function mergeSnapshotOptions(prev = {}, next) {
|
|
|
326
326
|
...incoming
|
|
327
327
|
} = next;
|
|
328
328
|
|
|
329
|
-
// prioritize singular widths over
|
|
329
|
+
// prioritize singular widths over multiple widths
|
|
330
330
|
widths = width ? [width] : widths;
|
|
331
331
|
|
|
332
332
|
// deduplicate resources by associated widths and url
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.31.2-beta.
|
|
3
|
+
"version": "1.31.2-beta.1",
|
|
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.2-beta.
|
|
47
|
-
"@percy/config": "1.31.2-beta.
|
|
48
|
-
"@percy/dom": "1.31.2-beta.
|
|
49
|
-
"@percy/logger": "1.31.2-beta.
|
|
50
|
-
"@percy/monitoring": "1.31.2-beta.
|
|
51
|
-
"@percy/webdriver-utils": "1.31.2-beta.
|
|
46
|
+
"@percy/client": "1.31.2-beta.1",
|
|
47
|
+
"@percy/config": "1.31.2-beta.1",
|
|
48
|
+
"@percy/dom": "1.31.2-beta.1",
|
|
49
|
+
"@percy/logger": "1.31.2-beta.1",
|
|
50
|
+
"@percy/monitoring": "1.31.2-beta.1",
|
|
51
|
+
"@percy/webdriver-utils": "1.31.2-beta.1",
|
|
52
52
|
"content-disposition": "^0.5.4",
|
|
53
53
|
"cross-spawn": "^7.0.3",
|
|
54
54
|
"extract-zip": "^2.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"ws": "^8.17.1",
|
|
62
62
|
"yaml": "^2.4.1"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "c8ba03fdd3ab7543f741a68eb5c357e38b48129e"
|
|
65
65
|
}
|