@percy/core 1.11.0 → 1.12.0
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 +13 -8
- package/dist/page.js +11 -5
- package/dist/session.js +2 -1
- package/package.json +6 -6
package/dist/network.js
CHANGED
|
@@ -72,19 +72,22 @@ export class Network {
|
|
|
72
72
|
timeout: Network.TIMEOUT,
|
|
73
73
|
idle: timeout
|
|
74
74
|
}).catch(error => {
|
|
75
|
-
// throw a better timeout error
|
|
76
75
|
if (error.message.startsWith('Timeout')) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (this.log.shouldLog('debug')) {
|
|
80
|
-
msg += `\n\n ${['Active requests:', ...requests.map(r => r.url)].join('\n - ')}\n`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
throw new Error(msg);
|
|
76
|
+
this._throwTimeoutError('Timed out waiting for network requests to idle.', filter);
|
|
84
77
|
} else {
|
|
85
78
|
throw error;
|
|
86
79
|
}
|
|
87
80
|
});
|
|
81
|
+
} // Throw a better network timeout error
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
_throwTimeoutError(msg, filter = () => true) {
|
|
85
|
+
if (this.log.shouldLog('debug')) {
|
|
86
|
+
let reqs = Array.from(this.#requests.values()).filter(filter).map(r => r.url);
|
|
87
|
+
msg += `\n\n ${['Active requests:', ...reqs].join('\n - ')}\n`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
throw new Error(msg);
|
|
88
91
|
} // Called when a request should be removed from various trackers
|
|
89
92
|
|
|
90
93
|
|
|
@@ -307,6 +310,8 @@ async function sendResponseResource(network, request, session) {
|
|
|
307
310
|
});
|
|
308
311
|
}
|
|
309
312
|
} catch (error) {
|
|
313
|
+
/* istanbul ignore next: too hard to test (create race condition) */
|
|
314
|
+
if (session.closing && error.message.includes('close')) return;
|
|
310
315
|
log.debug(`Encountered an error handling request: ${url}`, meta);
|
|
311
316
|
log.debug(error);
|
|
312
317
|
/* istanbul ignore next: catch race condition */
|
package/dist/page.js
CHANGED
|
@@ -86,12 +86,18 @@ export class Page {
|
|
|
86
86
|
return handlers.every(handler => handler.finished);
|
|
87
87
|
}, Page.TIMEOUT)]);
|
|
88
88
|
} catch (error) {
|
|
89
|
-
// remove
|
|
90
|
-
for (let handler of handlers) handler.off();
|
|
89
|
+
// remove any unused handlers
|
|
90
|
+
for (let handler of handlers) handler.off(); // assign context to unknown errors
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
|
|
93
|
+
if (!error.message.startsWith('Timeout')) {
|
|
94
|
+
throw Object.assign(error, {
|
|
95
|
+
message: `Navigation failed: ${error.message}`
|
|
96
|
+
});
|
|
97
|
+
} // throw a network error to show active requests
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
this.network._throwTimeoutError(`Navigation failed: Timed out waiting for the page ${waitUntil} event`);
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
this.log.debug('Page navigated', this.meta);
|
package/dist/session.js
CHANGED
|
@@ -23,7 +23,8 @@ export class Session extends EventEmitter {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async close() {
|
|
26
|
-
if (!this.browser) return;
|
|
26
|
+
if (!this.browser || this.closing) return;
|
|
27
|
+
this.closing = true;
|
|
27
28
|
await this.browser.send('Target.closeTarget', {
|
|
28
29
|
targetId: this.targetId
|
|
29
30
|
}).catch(this._handleClosedError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"test:types": "tsd"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@percy/client": "1.
|
|
43
|
-
"@percy/config": "1.
|
|
44
|
-
"@percy/dom": "1.
|
|
45
|
-
"@percy/logger": "1.
|
|
42
|
+
"@percy/client": "1.12.0",
|
|
43
|
+
"@percy/config": "1.12.0",
|
|
44
|
+
"@percy/dom": "1.12.0",
|
|
45
|
+
"@percy/logger": "1.12.0",
|
|
46
46
|
"content-disposition": "^0.5.4",
|
|
47
47
|
"cross-spawn": "^7.0.3",
|
|
48
48
|
"extract-zip": "^2.0.1",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
54
|
"ws": "^8.0.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "4303b74df91f60e36065141289d2ef2277d1d6fc"
|
|
57
57
|
}
|