Skip to content

Escape theme test locator regexp#27907

Merged
ErisDS merged 1 commit into
mainfrom
fix/escape-theme-test-regexp
May 15, 2026
Merged

Escape theme test locator regexp#27907
ErisDS merged 1 commit into
mainfrom
fix/escape-theme-test-regexp

Conversation

@ErisDS
Copy link
Copy Markdown
Member

@ErisDS ErisDS commented May 14, 2026

Summary

  • Escapes theme names before constructing the installed-theme Playwright locator regexp.
  • Follows up on CodeRabbit nitpick from ✨ Added a built-in theme code editor #27656 so future fixture names with regexp metacharacters match literally.

Testing

  • pnpm --filter @tryghost/admin-x-settings exec eslint --cache test/acceptance/site/theme.test.ts

The acceptance helper builds a case-insensitive regexp from theme names. Escaping the fixture value keeps the locator matching literally if a future theme name contains regexp metacharacters.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 09292f56-df7b-42eb-b229-e530696be3ca

📥 Commits

Reviewing files that changed from the base of the PR and between 9f59480 and 91b4cb6.

📒 Files selected for processing (1)
  • apps/admin-x-settings/test/acceptance/site/theme.test.ts

Walkthrough

This PR adds a local escapeRegExp helper function to the theme test file and applies it to safely filter theme list items by name. The change prevents regex metacharacters (such as *, +, ., ?, and others) from being interpreted as regex syntax when constructing the theme name filter. The installed-theme editor UI lookup now escapes the theme name before building a case-insensitive RegExp for comparison, ensuring theme names with special characters are matched literally.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: escaping the theme test locator regexp to prevent regex metacharacters from causing unintended behavior.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of escaping theme names in the test locator and referencing the previous PR context.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/escape-theme-test-regexp

Comment @coderabbitai help to get the list of available commands and usage tips.

@ErisDS ErisDS merged commit c2d72e9 into main May 15, 2026
42 checks passed
@ErisDS ErisDS deleted the fix/escape-theme-test-regexp branch May 15, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant