Skip to content

✨ Add static snapshot clean-urls and rewrites options#447

Merged
wwilsman merged 7 commits intomasterfrom
ww/static-rewrites
Jul 27, 2021
Merged

✨ Add static snapshot clean-urls and rewrites options#447
wwilsman merged 7 commits intomasterfrom
ww/static-rewrites

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

@wwilsman wwilsman commented Jul 27, 2021

What is this?

This adds two new options for static snapshots and refactors small parts of the snapshot command.

Logic that differed between static and non-static usages were moved into their respective implementation specific methods. This includes base-url error handling and default/normalized page options. Although the latter is shared, how the server address and non-static base-url is determined is specific to each implementation. Tests were also refactored a bit so suite hooks run for each test, and a couple other small test changes were made as well.

The clean-urls option is passed along to the static server handler directly, while the rewrites option is concatenated to any base-url rewrite. The rewrites are then also used in conjunction with overrides to generate a default page URL from the static file path. Another rewrite override is used to remove indexes and extensions from page URLs when clean-urls is true.

For config files, we don't want to normalize nested keys within rewrites, so it was added to the ignore-list in @percy/config's normalize module (with tests).

The snapshot command readme was also updated.

Resolves #420

@wwilsman wwilsman added the ✨ enhancement New feature or request label Jul 27, 2021
@wwilsman wwilsman requested a review from Robdel12 July 27, 2021 00:39
@wwilsman wwilsman enabled auto-merge (squash) July 27, 2021 02:02
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏁

@wwilsman wwilsman merged commit 41fb24e into master Jul 27, 2021
@wwilsman wwilsman deleted the ww/static-rewrites branch July 27, 2021 14:42
samarsault pushed a commit that referenced this pull request Mar 3, 2023
* ⬆️ Bump cypress from 9.1.1 to 9.2.0

Bumps [cypress](https://github.com/cypress-io/cypress) from 9.1.1 to 9.2.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](cypress-io/cypress@v9.1.1...v9.2.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* 💚 Fix setting `isInteractive` in test suite

Cypress 9.2 released an update that disallows setting config options at run
time (as they're supposed to be readonly). This breaks out test suite, so to get
around that I just manually set the value (rather than using their setter).

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert DeLuca <robertdeluca19@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow static snapshot pretty paths

2 participants