@percy/core 1.32.3-beta.1 → 1.32.3-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/api.js +20 -34
- package/package.json +9 -9
package/dist/api.js
CHANGED
|
@@ -387,20 +387,19 @@ export function createPercyServer(percy, port) {
|
|
|
387
387
|
.route('post', '/percy/comparison', async (req, res) => {
|
|
388
388
|
let data;
|
|
389
389
|
if (percy.syncMode(req.body)) {
|
|
390
|
-
// percy.upload
|
|
390
|
+
// percy.upload() is the generatePromise-wrapped method: calling it drives the
|
|
391
|
+
// underlying async generator to completion (enqueuing #snapshots) and the sync
|
|
392
|
+
// queue resolves/rejects the attached callback. Do NOT `for await` the return
|
|
393
|
+
// value — it is a Promise, not an async iterable. The raw generator lives at
|
|
394
|
+
// percy.yield.upload() if direct iteration is ever needed. The trailing
|
|
395
|
+
// .catch(reject) surfaces generator errors that bypass the sync-queue callback
|
|
396
|
+
// (e.g. a throw before the queue task runs) instead of leaking an unhandled
|
|
397
|
+
// rejection and hanging the request.
|
|
391
398
|
const snapshotPromise = new Promise((resolve, reject) => {
|
|
392
|
-
|
|
399
|
+
percy.upload(req.body, {
|
|
393
400
|
resolve,
|
|
394
401
|
reject
|
|
395
|
-
}, 'app');
|
|
396
|
-
(async () => {
|
|
397
|
-
// eslint-disable-next-line no-unused-vars
|
|
398
|
-
try {
|
|
399
|
-
for await (const _ of upload) {/* drain */}
|
|
400
|
-
} catch (e) {
|
|
401
|
-
reject(e);
|
|
402
|
-
}
|
|
403
|
-
})();
|
|
402
|
+
}, 'app').catch(reject);
|
|
404
403
|
});
|
|
405
404
|
data = await handleSyncJob(snapshotPromise, percy, 'comparison');
|
|
406
405
|
} else {
|
|
@@ -952,21 +951,14 @@ export function createPercyServer(percy, port) {
|
|
|
952
951
|
if (req.body.sync === true) payload.sync = true;
|
|
953
952
|
let data;
|
|
954
953
|
if (percy.syncMode(payload)) {
|
|
955
|
-
//
|
|
956
|
-
//
|
|
954
|
+
// See the /percy/comparison route: percy.upload() is the Promise-wrapped method;
|
|
955
|
+
// calling it drives the generator and the sync queue resolves/rejects the callback.
|
|
956
|
+
// The .catch(reject) surfaces generator errors that bypass that callback.
|
|
957
957
|
const snapshotPromise = new Promise((resolve, reject) => {
|
|
958
|
-
|
|
958
|
+
percy.upload(payload, {
|
|
959
959
|
resolve,
|
|
960
960
|
reject
|
|
961
|
-
}, 'app');
|
|
962
|
-
(async () => {
|
|
963
|
-
// eslint-disable-next-line no-unused-vars
|
|
964
|
-
try {
|
|
965
|
-
for await (const _ of upload) {/* drain */}
|
|
966
|
-
} catch (e) {
|
|
967
|
-
reject(e);
|
|
968
|
-
}
|
|
969
|
-
})();
|
|
961
|
+
}, 'app').catch(reject);
|
|
970
962
|
});
|
|
971
963
|
data = await handleSyncJob(snapshotPromise, percy, 'comparison');
|
|
972
964
|
return res.json(200, {
|
|
@@ -1003,20 +995,14 @@ export function createPercyServer(percy, port) {
|
|
|
1003
995
|
percyAutomateRequestHandler(req, percy);
|
|
1004
996
|
let comparisonData = await WebdriverUtils.captureScreenshot(req.body);
|
|
1005
997
|
if (percy.syncMode(comparisonData)) {
|
|
1006
|
-
//
|
|
998
|
+
// See the /percy/comparison route: percy.upload() is the Promise-wrapped method;
|
|
999
|
+
// calling it drives the generator and the sync queue resolves/rejects the callback.
|
|
1000
|
+
// The .catch(reject) surfaces generator errors that bypass that callback.
|
|
1007
1001
|
const snapshotPromise = new Promise((resolve, reject) => {
|
|
1008
|
-
|
|
1002
|
+
percy.upload(comparisonData, {
|
|
1009
1003
|
resolve,
|
|
1010
1004
|
reject
|
|
1011
|
-
}, 'automate');
|
|
1012
|
-
(async () => {
|
|
1013
|
-
// eslint-disable-next-line no-unused-vars
|
|
1014
|
-
try {
|
|
1015
|
-
for await (const _ of upload) {/* drain */}
|
|
1016
|
-
} catch (e) {
|
|
1017
|
-
reject(e);
|
|
1018
|
-
}
|
|
1019
|
-
})();
|
|
1005
|
+
}, 'automate').catch(reject);
|
|
1020
1006
|
});
|
|
1021
1007
|
data = await handleSyncJob(snapshotPromise, percy, 'comparison');
|
|
1022
1008
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.32.3-beta.
|
|
3
|
+
"version": "1.32.3-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@grpc/grpc-js": "^1.14.3",
|
|
48
48
|
"@grpc/proto-loader": "^0.8.0",
|
|
49
|
-
"@percy/client": "1.32.3-beta.
|
|
50
|
-
"@percy/config": "1.32.3-beta.
|
|
51
|
-
"@percy/dom": "1.32.3-beta.
|
|
52
|
-
"@percy/logger": "1.32.3-beta.
|
|
53
|
-
"@percy/monitoring": "1.32.3-beta.
|
|
54
|
-
"@percy/webdriver-utils": "1.32.3-beta.
|
|
49
|
+
"@percy/client": "1.32.3-beta.3",
|
|
50
|
+
"@percy/config": "1.32.3-beta.3",
|
|
51
|
+
"@percy/dom": "1.32.3-beta.3",
|
|
52
|
+
"@percy/logger": "1.32.3-beta.3",
|
|
53
|
+
"@percy/monitoring": "1.32.3-beta.3",
|
|
54
|
+
"@percy/webdriver-utils": "1.32.3-beta.3",
|
|
55
55
|
"busboy": "^1.6.0",
|
|
56
56
|
"content-disposition": "^0.5.4",
|
|
57
57
|
"cross-spawn": "^7.0.3",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"yaml": "^2.4.1"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@percy/cli-doctor": "1.32.3-beta.
|
|
70
|
+
"@percy/cli-doctor": "1.32.3-beta.3"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "f2029c138431bb176dd41ea0d1df1f3a3120cc8d"
|
|
73
73
|
}
|