Skip to content

Commit

Permalink
fix: fetch api polyfill (#3262)
Browse files Browse the repository at this point in the history
* fix: fetch api polyfill

* Create nine-cows-add.md

---------

Co-authored-by: Tobias Deekens <[email protected]>
  • Loading branch information
abreu-ct and tdeekens authored Oct 10, 2023
1 parent fe0b5f7 commit d4765a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-cows-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@commercetools-frontend/jest-preset-mc-app": patch
---

Adds `Request` and `Response` from `node-fetch` as globals to the Jest preset.
2 changes: 2 additions & 0 deletions packages/jest-preset-mc-app/setup-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ global.window.app = {

window.MutationObserver = MutationObserver;
global.Headers = global.Headers || require('node-fetch').Headers;
global.Request = global.Request || require('node-fetch').Request;
global.Response = global.Response || require('node-fetch').Response;

// Fix missing globals when `jsdom` is used in a test environment.
// See https://github.com/jsdom/jsdom/issues/2524#issuecomment-1108991178.
Expand Down

1 comment on commit d4765a2

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for merchant-center-application-kit ready!

✅ Preview
https://merchant-center-application-3eo8oz6r5-commercetools.vercel.app

Built with commit d4765a2.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.