Skip to content

Instantly share code, notes, and snippets.

@vincentchalamon
Created December 9, 2019 14:26
Show Gist options
  • Save vincentchalamon/19e2641de2a51d2d9b4668d42f6fe113 to your computer and use it in GitHub Desktop.
Save vincentchalamon/19e2641de2a51d2d9b4668d42f6fe113 to your computer and use it in GitHub Desktop.
Replace `fetch` requests to `xhr` in Cypress configuration
before(() => {
Cypress.log({});
cy.request('https://unpkg.com/unfetch@4.1.0/dist/unfetch.umd.js', {log: false}).as('unfetch').then(unfetch => {
Cypress.on('window:before:load', win => {
delete win.fetch;
win.eval(unfetch);
win.fetch = win.unfetch;
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment