Skip to content

fix: implement glob pattern matching for wait --url and route matching#1077

Open
tmchow wants to merge 3 commits intovercel-labs:mainfrom
tmchow:osc/1061-fix-glob-matching
Open

fix: implement glob pattern matching for wait --url and route matching#1077
tmchow wants to merge 3 commits intovercel-labs:mainfrom
tmchow:osc/1061-fix-glob-matching

Conversation

@tmchow
Copy link
Copy Markdown

@tmchow tmchow commented Mar 30, 2026

Summary

Replaces literal string matching with Playwright-compatible glob semantics in wait --url, route matching, and responsebody URL matching.

Changes

Three code paths in cli/src/native/actions.rs used string operations (includes(), contains(), starts_with/ends_with split) instead of glob matching. After the Rust rewrite (f341c0a), patterns like **/dashboard were treated as literal strings.

This PR adds a glob_to_regex() helper that converts glob patterns to regex:

  • * matches any characters except /
  • ** matches any characters including /
  • ? matches a single character
  • Regex metacharacters are escaped

Fixed locations:

  • wait_for_url (line ~2913): location.href.includes() -> new RegExp(glob_to_regex(...)).test(location.href)
  • Route matching (line ~6287): simplified split('*') logic -> glob_matches()
  • handle_responsebody (line ~5585): resp_url.contains() -> glob_matches()

No new crate dependencies beyond regex (added to cli/Cargo.toml). 6 unit tests cover exact match, escaping, *, **, and ? patterns.

This contribution was developed with AI assistance (Claude Code).

Fixes #1061

tmchow added 2 commits March 29, 2026 22:24
Replace literal string matching with Playwright-compatible glob semantics
in three code paths:

- wait_for_url: use RegExp instead of String.includes()
- route matching: use glob_matches() instead of simplified split logic
- responsebody URL matching: use glob_matches() instead of contains()

Add glob_to_regex() helper that converts * (non-slash), ** (any), and ?
(single char) patterns. Regex metacharacters are escaped.

Fixes vercel-labs#1061
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 30, 2026

@tmchow is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 30, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​regex@​1.12.310010093100100

View full report

Playwright's URL glob semantics only support * and **. The ? character
is the query string separator in URLs and should be matched literally.
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.

wait --url glob pattern matching broken after Rust rewrite

1 participant