@percy/core 1.30.3-beta.1 → 1.30.4
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/network.js +14 -3
- package/package.json +8 -8
- package/types/index.d.ts +8 -2
package/dist/network.js
CHANGED
|
@@ -2,7 +2,7 @@ import { request as makeRequest } from '@percy/client/utils';
|
|
|
2
2
|
import logger from '@percy/logger';
|
|
3
3
|
import mime from 'mime-types';
|
|
4
4
|
import { DefaultMap, createResource, hostnameMatches, normalizeURL, waitFor, decodeAndEncodeURLWithLogging } from './utils.js';
|
|
5
|
-
const MAX_RESOURCE_SIZE = 25 * 1024 ** 2; // 25MB
|
|
5
|
+
const MAX_RESOURCE_SIZE = 25 * 1024 ** 2 * 0.63; // 25MB, 0.63 factor for accounting for base64 encoding
|
|
6
6
|
const ALLOWED_STATUSES = [200, 201, 301, 302, 304, 307, 308];
|
|
7
7
|
const ALLOWED_RESOURCES = ['Document', 'Stylesheet', 'Image', 'Media', 'Font', 'Other'];
|
|
8
8
|
const ABORTED_MESSAGE = 'Request was aborted by browser';
|
|
@@ -128,12 +128,23 @@ export class Network {
|
|
|
128
128
|
isAborted(requestId) {
|
|
129
129
|
return this.#aborted.has(requestId);
|
|
130
130
|
}
|
|
131
|
+
logNetworkRequests(filter) {
|
|
132
|
+
let msg = '';
|
|
133
|
+
let reqs = Array.from(this.#requests.values()).filter(filter).map(r => r.url);
|
|
134
|
+
msg += `\n\n ${['Active requests:', ...reqs].join('\n - ')}\n`;
|
|
135
|
+
return msg;
|
|
136
|
+
}
|
|
131
137
|
|
|
132
138
|
// Throw a better network timeout error
|
|
133
139
|
_throwTimeoutError(msg, filter = () => true) {
|
|
134
140
|
if (this.log.shouldLog('debug')) {
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
msg += this.logNetworkRequests(filter);
|
|
142
|
+
}
|
|
143
|
+
if (process.env.PERCY_IGNORE_TIMEOUT_ERROR === 'true') {
|
|
144
|
+
let warnMsg = 'Ignoring network timeout failures.';
|
|
145
|
+
warnMsg += this.logNetworkRequests(filter);
|
|
146
|
+
this.log.warn(warnMsg);
|
|
147
|
+
return;
|
|
137
148
|
}
|
|
138
149
|
throw new Error(msg);
|
|
139
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "latest"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -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.4",
|
|
47
|
+
"@percy/config": "1.30.4",
|
|
48
|
+
"@percy/dom": "1.30.4",
|
|
49
|
+
"@percy/logger": "1.30.4",
|
|
50
|
+
"@percy/webdriver-utils": "1.30.4",
|
|
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": "282289e3e0c9401f31483d6a52178fd00d1177f7"
|
|
64
64
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ interface DiscoveryOptions {
|
|
|
20
20
|
disableCache?: boolean;
|
|
21
21
|
captureMockedServiceWorker?: boolean;
|
|
22
22
|
captureSrcset?: boolean;
|
|
23
|
+
devicePixelRatio?: number;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
interface ScopeOptions {
|
|
@@ -41,15 +42,20 @@ interface AllDiscoveryOptions extends DiscoveryOptions {
|
|
|
41
42
|
|
|
42
43
|
interface CommonSnapshotOptions {
|
|
43
44
|
widths?: number[];
|
|
45
|
+
scope?: string;
|
|
44
46
|
minHeight?: number;
|
|
45
47
|
percyCSS?: string;
|
|
46
48
|
enableJavaScript?: boolean;
|
|
49
|
+
cliEnableJavascript?: boolean;
|
|
47
50
|
disableShadowDOM?: boolean;
|
|
48
|
-
enableLayout?: boolean;
|
|
49
51
|
domTransformation?: string;
|
|
52
|
+
enableLayout?: boolean;
|
|
53
|
+
sync?: boolean;
|
|
54
|
+
responsiveSnapshotCapture?: boolean;
|
|
55
|
+
testCase?: string;
|
|
56
|
+
labels?: string;
|
|
50
57
|
reshuffleInvalidTags?: boolean;
|
|
51
58
|
devicePixelRatio?: number;
|
|
52
|
-
scope?: string;
|
|
53
59
|
scopeOptions?: ScopeOptions;
|
|
54
60
|
}
|
|
55
61
|
|