@percy/dom 1.32.5-beta.0 → 1.32.5
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/bundle.js +42 -35
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -2273,7 +2273,13 @@
|
|
|
2273
2273
|
}
|
|
2274
2274
|
};
|
|
2275
2275
|
}
|
|
2276
|
-
|
|
2276
|
+
|
|
2277
|
+
// Returns a Promise rather than using `async`/`await`. The shipped
|
|
2278
|
+
// @percy/dom bundle is injected into the browser verbatim by SDKs, and some
|
|
2279
|
+
// evaluators — notably TestCafe's `t.eval` — statically reject ANY async/await
|
|
2280
|
+
// or generator syntax in the evaluated source. Keeping this file async-free
|
|
2281
|
+
// preserves the pre-1.31.14 bundle contract those SDKs depend on (PER-10121).
|
|
2282
|
+
function runAllChecks(config, result, aborted) {
|
|
2277
2283
|
var _config$ready_selecto, _config$not_present_s;
|
|
2278
2284
|
let checks = [];
|
|
2279
2285
|
let expected = [];
|
|
@@ -2330,7 +2336,7 @@
|
|
|
2330
2336
|
}));
|
|
2331
2337
|
}
|
|
2332
2338
|
result._expectedChecks = expected;
|
|
2333
|
-
|
|
2339
|
+
return Promise.all(checks);
|
|
2334
2340
|
}
|
|
2335
2341
|
|
|
2336
2342
|
// Normalize camelCase config keys (from .percy.yml / SDK options) to the
|
|
@@ -2352,14 +2358,17 @@
|
|
|
2352
2358
|
max_timeout_ms: options.maxTimeoutMs ?? options.max_timeout_ms
|
|
2353
2359
|
};
|
|
2354
2360
|
}
|
|
2355
|
-
|
|
2361
|
+
|
|
2362
|
+
// Async-free by design — see the note on `runAllChecks` (PER-10121). Returns
|
|
2363
|
+
// a Promise resolving to the readiness result.
|
|
2364
|
+
function waitForReady(options = {}) {
|
|
2356
2365
|
let presetName = options.preset || 'balanced';
|
|
2357
|
-
if (presetName === 'disabled') return {
|
|
2366
|
+
if (presetName === 'disabled') return Promise.resolve({
|
|
2358
2367
|
passed: true,
|
|
2359
2368
|
timed_out: false,
|
|
2360
2369
|
skipped: true,
|
|
2361
2370
|
checks: {}
|
|
2362
|
-
};
|
|
2371
|
+
});
|
|
2363
2372
|
let preset = PRESETS[presetName] || PRESETS.balanced;
|
|
2364
2373
|
// Normalize user options to snake_case, then merge. Only overrides
|
|
2365
2374
|
// where user explicitly provided a value (undefined keys don't overwrite).
|
|
@@ -2380,40 +2389,38 @@
|
|
|
2380
2389
|
};
|
|
2381
2390
|
let settled = false;
|
|
2382
2391
|
let aborted = createAbortHandle();
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
}, effectiveTimeout))]);
|
|
2394
|
-
} catch (error) {
|
|
2392
|
+
return Promise.race([runAllChecks(config, result, aborted).then(() => {
|
|
2393
|
+
settled = true;
|
|
2394
|
+
}), new Promise(resolve => setTimeout(() => {
|
|
2395
|
+
if (!settled) {
|
|
2396
|
+
result.timed_out = true;
|
|
2397
|
+
// Abort all running checks — clears intervals, disconnects observers
|
|
2398
|
+
aborted.abort();
|
|
2399
|
+
}
|
|
2400
|
+
resolve();
|
|
2401
|
+
}, effectiveTimeout))]).catch(error => {
|
|
2395
2402
|
/* istanbul ignore next: safety net for unexpected errors in readiness checks */
|
|
2396
2403
|
result.error = error.message || String(error);
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
}
|
|
2404
|
+
}).then(() => {
|
|
2405
|
+
// Mark any checks that didn't complete before timeout as failed.
|
|
2406
|
+
// `_expectedChecks` is always set by runAllChecks, but coverage here
|
|
2407
|
+
// depends on whether any expected check was skipped due to timeout.
|
|
2408
|
+
/* istanbul ignore next: only falsy when the catch block above fires before runAllChecks sets _expectedChecks */
|
|
2409
|
+
if (result._expectedChecks) {
|
|
2410
|
+
for (let name of result._expectedChecks) {
|
|
2411
|
+
if (!result.checks[name]) {
|
|
2412
|
+
result.checks[name] = {
|
|
2413
|
+
passed: false,
|
|
2414
|
+
timed_out: true
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2410
2417
|
}
|
|
2418
|
+
delete result._expectedChecks;
|
|
2411
2419
|
}
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
return result;
|
|
2420
|
+
result.total_duration_ms = Math.round(performance.now() - startTime);
|
|
2421
|
+
result.passed = !result.timed_out && !result.error && Object.values(result.checks).every(c => c.passed);
|
|
2422
|
+
return result;
|
|
2423
|
+
});
|
|
2417
2424
|
}
|
|
2418
2425
|
|
|
2419
2426
|
exports["default"] = serializeDOM;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.32.5
|
|
3
|
+
"version": "1.32.5",
|
|
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
|
"main": "dist/bundle.js",
|
|
15
15
|
"browser": "dist/bundle.js",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"interactor.js": "^2.0.0-beta.10"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "1c83908c5913e3fab1cdd7207db49a2e0c27a3e9"
|
|
39
39
|
}
|