Conversation
Add a spec that spies on Percy.replaySnapshot to throw, exercising the error-handling branch in replay.js (lines 44-46) so coverage hits 100%.
Drive archiveSnapshot through fs.writeFileSync rather than spying on the ESM module export (which is a read-only binding under babel ESM), and silence the unused-expression lint by capturing the spread result.
Add cases for serializeSnapshot with no resources field, readArchivedSnapshots skipping non-json and directory entries, and Percy honoring an explicit skipUploads when archiveDir is configured.
rishigupta1599
approved these changes
May 7, 2026
archive.js validates the archive dir via validateArchiveDir (resolve + normalize + '..' rejection) before any join/resolve sinks. The semgrep rule cannot trace that guard, so suppress at the file level with the same pattern used for lock.js.
aryanku-dev
added a commit
that referenced
this pull request
May 11, 2026
Windows CI surfaced 6 archive-related test failures that boil down to path-separator and stale-fixture issues, not real regressions. None of them touch the closed-shadow / page.js work this PR is about; they're all in the bundled #2216 archive flow. Fixes: - percy.test.js archive flow assertions: regexes hard-coded a leading forward slash before `percy-archive`. On Windows the resolved path uses backslashes — relax to `[\\/]percy-archive`. - archive.test.js validateArchiveDir 'resolves a valid path': asserted `'/tmp/percy-archive'` literally; `path.resolve` prepends a drive letter on Windows. Use `path.resolve` to construct the expected value. - archive.test.js validateArchiveDir 'resolves a relative path': same separator fix as above. - archive.test.js validateArchiveDir 'rejects paths that resolve to traversal segments': built the traversal string with literal `/`, but the implementation splits on `path.sep`. Build the test string from `path.sep` so the `..` segments actually surface on Windows. - archive.test.js symlink spec: the `.test-archive-symlink` dir persisted between runs, hitting EEXIST on the second invocation. Clean up the dir before recreating it. Verified locally on Node 14 (the version CI uses): - Unit / Archive: 19/19 pass (was 3 failing on Windows) - Percy archive flow specs: pass (were 2 failing on Windows) The remaining test failures in the percy.test.js suite are all environment-related (real backend / browser needed locally) and present on master too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2173