⚠️
cy.server()andcy.route()are deprecated in Cypress 6.0.0. In a future release, support forcy.server()andcy.route()will be removed. Consider usingcy.intercept()instead. See our guide on Migratingcy.route()tocy.intercept()
Permanently change the default options for all cy.server() instances
Cypress.Server.defaults(options)
options (Object)
Pass in an options object to change the default behavior of Cypress.Server.
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
},
})
Where to put server configuration
A great place to put this configuration is in your cypress/support/index.js file, since it is loaded before any test files are evaluated.
© 2017 Cypress.io
Licensed under the MIT License.
https://docs.cypress.io/api/cypress-api/cypress-server