Skip to content

Instantly share code, notes, and snippets.

yagudaev / cypress_support_hooks.js
Last active September 16, 2021 08:46
Cypress Fetch Support Workaround - replaces fetch request with traditional XHR so cypress can track them
View cypress_support_hooks.js
// cypress/support/hooks.js
// Cypress does not support listening to the fetch method
// Therefore, as a workaround we polyfill `fetch` with traditional XHR which
// are supported. See:
// private helpers
function enableFetchWorkaround() {
let polyfill