question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

intercept()'s minimatch glob-matching against routeMatcher url property no longer works

See original GitHub issue

Current 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
jennifer-shehanecommented, Dec 11, 2020

We are planning to update cy.intercept() to match the old behavior like cy.route() matching as Zach showed above.

1reaction
knottherecommented, Dec 21, 2020

Thank you for addressing this. I await a new release so I can complete my port to Cypress 6.x.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found