Cypress.Server
⚠️ cy.server()
and cy.route()
are deprecated in Cypress 6.0.0. In a
future release, support for cy.server()
and cy.route()
will be removed.
Consider using cy.intercept()
instead. See our
guide on
Migrating cy.route()
to cy.intercept()
Permanently change the default options for all
cy.server()
instances
Syntax
Cypress.Server.defaults(options)
Arguments
options (Object)
Pass in an options object to change the default behavior of Cypress.Server
.
Examples
Options
These options will be the new defaults.
// pass anything here you'd normally pass to cy.server().
Cypress.Server.defaults({
delay: 500,
force404: false,
ignore: (xhr) => {
// handle custom logic for filtering XHR requests
},
})
Notes
Where to put server configuration
A great place to put this configuration is in the supportFile, since it is loaded before any test files are evaluated.