Skip to content

Commit 9b32b48

Browse files
authored
Merge pull request #133 from bigbite/hotfix/update-fetch-polyfill
HOTFIX: Include the fetch pollyfill to prevent test fails if the cdn is down.
2 parents 2f113f7 + f2354dc commit 9b32b48

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

lib/cypress-support/hooks.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
/* eslint-disable no-param-reassign */
2-
let fetchPolyfill;
2+
const fetchPolyfill =
3+
'!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e||self).unfetch=n()}(this,function(){return function(e,n){return n=n||{},new Promise(function(t,o){var r=new XMLHttpRequest,s=[],u={},i=function e(){return{ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:function(){return Promise.resolve(r.responseText)},json:function(){return Promise.resolve(r.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([r.response]))},clone:e,headers:{keys:function(){return s},entries:function(){return s.map(function(e){return[e,r.getResponseHeader(e)]})},get:function(e){return r.getResponseHeader(e)},has:function(e){return null!=r.getResponseHeader(e)}}}};for(var f in r.open(n.method||"get",e,!0),r.onload=function(){r.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm,function(e,n){u[n]||s.push(u[n]=n)}),t(i())},r.onerror=o,r.withCredentials="include"==n.credentials,n.headers)r.setRequestHeader(f,n.headers[f]);r.send(n.body||null)})}})';
34

45
Cypress.wp = {};
56

67
before(() => {
7-
const polyfillUrl = 'https://unpkg.com/unfetch/dist/unfetch.umd.js';
8-
9-
cy.request(polyfillUrl).then((response) => {
10-
fetchPolyfill = response.body;
11-
});
12-
138
const installedWordpressVersions = Cypress.config('wordpressVersions');
149

1510
if (installedWordpressVersions.length === 1) {

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bigbite/wp-cypress",
3-
"version": "0.13.1",
3+
"version": "0.13.2",
44
"description": "WordPress end to end testing with Cypress.io",
55
"repository": "https://github.com/bigbite/wp-cypress",
66
"author": {

0 commit comments

Comments
 (0)