intercept()'s minimatch glob-matching against routeMatcher url property no longer works
See original GitHub issueCurrent behavior
In Cypress 4.12.1, matching a route (cy.route()
) with a url
property that contains a string with minimatch syntax (*
) works.
In Cypress 6.0.0, using cy.intercept()
with a routeMatcher.url
that also contains minimatch syntax fails to match.
The help at https://docs.cypress.io/api/commands/intercept.html#routeMatcher-RouteMatcher says:
All properties are optional. All properties that are set must match for the route to handle a request. If a string is passed to any property, it will be glob-matched against the request using minimatch.The available routeMatcher properties are listed below:
Desired behavior
Glob-matching should succeed with string properties passed to cy.intercept()
in a routeMatcher
.
Test code to reproduce
Versions
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:16 (6 by maintainers)
Top Results From Across the Web
intercept - Cypress Documentation
routeMatcher is an object used to match the incoming HTTP requests with this intercepted route. All properties are optional but all those that...
Read more >Minimatch pattern for two paths where one is prefix of the other
The way I am trying to mock these two endpoints with cy.intercept() is the following. For the first url, /users/1 , I tried...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
The problem. The command cy. intercept can match requests using a substring, a minimatch, or a regular expression. By default, it intercepts ......
Read more >Response phase - intercept - Runebook.dev
Once the HTTP response is received from upstream server, following steps are applied: When matching URL, providing an exact to can be too...
Read more >Cypress Intercept Not Honoring Actual Pathname/Query
Cypress will prefix the URL with the baseUrl configured in your network options path of an html file and Cypress will serve this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We are planning to update cy.intercept() to match the old behavior like cy.route() matching as Zach showed above.
Thank you for addressing this. I await a new release so I can complete my port to Cypress 6.x.