fix: merge .percy.yml config options into serializeDOM - #754
fix: merge .percy.yml config options into serializeDOM#754rishigupta1599 wants to merge 6 commits into
Conversation
…izeDOM Previously, only per-snapshot options were passed to PercyDOM.serialize(), ignoring config-level settings (enableJavaScript, disableShadowDOM, etc.) from .percy.yml. Now config.snapshot is used as defaults, with per-snapshot options taking priority. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace inline config merge with centralized utility from sdk-utils. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
|
This PR was closed because it has been stalled for 28 days with no activity. |
rishigupta1599
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 1 inline finding(s). Full report in the PR comment below. Verdict: Passed.
| await nEval(new Function(await utils.fetchPercyDOM())); | ||
|
|
||
| // Serialize and capture the DOM | ||
| const mergedOptions = utils.mergeSnapshotOptions(options); |
There was a problem hiding this comment.
[Medium] mergeSnapshotOptions requires a newer @percy/sdk-utils than the pinned range
utils.mergeSnapshotOptions was only added to @percy/sdk-utils in 1.32.0-beta.9, but package.json pins @percy/sdk-utils: ^1.0.0. An environment resolving an older 1.x sdk-utils satisfies the range yet lacks this export, so this line throws TypeError: utils.mergeSnapshotOptions is not a function and the snapshot is silently swallowed by the surrounding catch.
Suggestion: Bump the minimum @percy/sdk-utils to the version that ships mergeSnapshotOptions (e.g. ^1.32.0), or guard the call: const mergedOptions = utils.mergeSnapshotOptions?.(options) ?? options;
Reviewer: stack:code-review
Claude Code PR ReviewPR: #754 • Head: ca9b0cb • Reviewers: stack:code-review SummaryMerges the global Review Table
Findings
Verdict: PASS — correct, minimal, and consistent with sibling SDKs; recommend bumping the |
…regen lockfile Ref: PER-8053
This SDK has no committed lockfile, so CI's bare `yarn` resolves dependencies fresh to the latest versions each run. Via @percy/core, that now pulls node-releases@2.0.47 (node>=18, through nyc->babel->browserslist) and snyk-nodejs-lockfile-parser@2.7.1 (node>=18, which also drags in @yarnpkg/core@4 + tar@7) — and yarn hard-fails on the engine mismatch, breaking the Node 14 leg on install. Pin both back to their last Node-14-compatible line via resolutions (yarn honors these on the fresh install); the snyk pin also drops the @yarnpkg/tar@7 subtree. Temporary workaround pending the upstream CLI fix (percy/cli#2301). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
| # yarn lockfile v1 | ||
|
|
| domSnapshot: PercyDOM.serialize(options), | ||
| url: document.URL | ||
| }), options); | ||
| }), mergedOptions); |
There was a problem hiding this comment.
No test coverage for this? is it covered in the existing UTs?
Commit 639b9ec ("regen lockfile") accidentally *deleted* yarn.lock entirely instead of regenerating it, leaving the SDK with no committed lockfile. Restore it from base and regenerate against the current package.json (@percy deps + node-14 resolutions) so there is a proper, consistent, committed lockfile again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restoring/regenerating the lockfile pulled event-loop-spinner@2.3.3 (node>=18) via snyk-nodejs-lockfile-parser -> @snyk/dep-graph, breaking the Node 14 lint/ typecheck legs. Pin to 2.3.2 (last node-14-compatible line) alongside the other transitive pins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Summary
.percy.ymlconfig options were not being passed toPercyDOM.serialize()— only per-snapshot options were usedutils.percy.config.snapshotas defaults with per-snapshot options taking priorityTest plan
🤖 Generated with Claude Code