-
Notifications
You must be signed in to change notification settings - Fork 42
fix: merge .percy.yml config options into serializeDOM #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
3fb8c00
b698b95
53d450d
f08fb0c
ac11973
da7a6bf
6d87a28
e8d92bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,14 +27,6 @@ function generateName(assertOrTestOrName) { | |
| } | ||
| } | ||
|
|
||
| // Helper to add pseudoClassEnabledElements that are in .percy.yml file to snapshot options. | ||
| // when options.pseudoClassEnabledElements is not set in percySnapshot options | ||
| function addPseudoClassEnabledELements(options) { | ||
| if (!options.pseudoClassEnabledElements && utils.percy?.config?.snapshot?.pseudoClassEnabledElements) { | ||
| options.pseudoClassEnabledElements = utils.percy.config.snapshot.pseudoClassEnabledElements; | ||
| } | ||
| } | ||
|
|
||
| // Helper to scope a DOM snapshot to the ember-testing container to capture the | ||
| // ember application without the testing UI | ||
| function scopeDOM(scope, dom) { | ||
|
|
@@ -78,7 +70,8 @@ export default async function percySnapshot(name, { | |
| // window.PercyDOM mid-flight if the caller forgot to await — capture once. | ||
| const PercyDOM = window.PercyDOM; | ||
|
|
||
| addPseudoClassEnabledELements(options); | ||
| // Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| const mergedOptions = utils.mergeSnapshotOptions(options); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [High] Config-merged options never reach
Suggestion: Derive the posted options from the merged set: const { readiness: _readiness, ...forwardOpts } = mergedOptions;And base the readiness checks (L90, L96-98) on Reviewer: stack:code-review |
||
|
|
||
| // Readiness gate. Backward-compat: | ||
| // - Older CLI bundles lack PercyDOM.waitForReady — typeof guard handles that. | ||
|
|
@@ -133,7 +126,7 @@ export default async function percySnapshot(name, { | |
| domTransformation: dom => scopeDOM(emberTestingScope, ( | ||
| domTransformation ? domTransformation(dom) : dom | ||
| )), | ||
| ...options | ||
| ...mergedOptions | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [High] Merge applied only to serialize; readiness gate and post payload still use raw
Suggestion: Derive Reviewer: stack:code-review |
||
| }); | ||
|
|
||
| // Attach readiness diagnostics so the CLI can log timing and pass/fail. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Critical]
utils.mergeSnapshotOptionsis not exported by@percy/sdk-utilsutilshere is@percy/sdk-utils, whose index exports do not includemergeSnapshotOptions(it lives in@percy/core/src/snapshot.js). At runtime this isundefined(...)and throwsTypeError: utils.mergeSnapshotOptions is not a function. The error is swallowed by the surroundingtry/catchand logged as a generic "Could not take DOM snapshot", so every snapshot silently fails.Suggestion: Either export
mergeSnapshotOptionsfrom@percy/sdk-utils(and bump the dependency), or merge inline:const mergedOptions = { ...(utils.percy?.config?.snapshot || {}), ...options };Reviewer: stack:code-review