From aa318a0b6c9c799ada087c7be76592da2d544c9f Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 15:51:34 +0200 Subject: [PATCH 01/13] feat: provide a decorated fetch environment for js-dom Signed-off-by: blam --- packages/cli/config/jest.js | 2 +- packages/cli/config/jsdomEnvironment.js | 30 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 packages/cli/config/jsdomEnvironment.js diff --git a/packages/cli/config/jest.js b/packages/cli/config/jest.js index 0e74b00d5a..8977c94cdf 100644 --- a/packages/cli/config/jest.js +++ b/packages/cli/config/jest.js @@ -48,7 +48,7 @@ function getRoleConfig(role) { case 'common-library': case 'frontend-plugin': case 'frontend-plugin-module': - return { testEnvironment: require.resolve('jest-environment-jsdom') }; + return { testEnvironment: require.resolve('./jsdomEnvironment') }; case 'cli': case 'backend': case 'node-library': diff --git a/packages/cli/config/jsdomEnvironment.js b/packages/cli/config/jsdomEnvironment.js new file mode 100644 index 0000000000..bef457ea40 --- /dev/null +++ b/packages/cli/config/jsdomEnvironment.js @@ -0,0 +1,30 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import JSDOMEnvironment from 'jest-environment-jsdom'; +import { Headers, Request, Response } from 'node-fetch'; + +// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string +export default class FixJSDOMEnvironment extends JSDOMEnvironment { + constructor(...args) { + super(...args); + + // FIXME https://github.com/jsdom/jsdom/issues/1724 + this.global.fetch = fetch; + this.global.Headers = Headers; + this.global.Request = Request; + this.global.Response = Response; + } +} From 5d692f72ebfbcbbbc451ecb972b97f3847a303bf Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 15:53:24 +0200 Subject: [PATCH 02/13] chore: add changeset Signed-off-by: blam --- .changeset/popular-buckets-sin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/popular-buckets-sin.md diff --git a/.changeset/popular-buckets-sin.md b/.changeset/popular-buckets-sin.md new file mode 100644 index 0000000000..c2085b31bb --- /dev/null +++ b/.changeset/popular-buckets-sin.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Make sure to include a `fetch` environment for `jsdom` in `jest` tests From d149bd5c0f21958430e9cc781fbdf949c16a8724 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 15:56:09 +0200 Subject: [PATCH 03/13] chore: woops, need fetch here too Signed-off-by: blam --- packages/cli/config/jsdomEnvironment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/config/jsdomEnvironment.js b/packages/cli/config/jsdomEnvironment.js index bef457ea40..6a2fc494ae 100644 --- a/packages/cli/config/jsdomEnvironment.js +++ b/packages/cli/config/jsdomEnvironment.js @@ -14,7 +14,7 @@ * limitations under the License. */ import JSDOMEnvironment from 'jest-environment-jsdom'; -import { Headers, Request, Response } from 'node-fetch'; +import { Headers, Request, Response, fetch } from 'node-fetch'; // https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string export default class FixJSDOMEnvironment extends JSDOMEnvironment { From 5d8771e99d8b60476900b4e444d656bba91ced31 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 16:02:22 +0200 Subject: [PATCH 04/13] chore: namespace these a little bit Signed-off-by: blam --- packages/cli/config/jest.js | 2 +- .../cli/config/{jsdomEnvironment.js => jestJsdomEnvironment.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/cli/config/{jsdomEnvironment.js => jestJsdomEnvironment.js} (100%) diff --git a/packages/cli/config/jest.js b/packages/cli/config/jest.js index 8977c94cdf..68f4b77d94 100644 --- a/packages/cli/config/jest.js +++ b/packages/cli/config/jest.js @@ -48,7 +48,7 @@ function getRoleConfig(role) { case 'common-library': case 'frontend-plugin': case 'frontend-plugin-module': - return { testEnvironment: require.resolve('./jsdomEnvironment') }; + return { testEnvironment: require.resolve('./jestJsdomEnvironment') }; case 'cli': case 'backend': case 'node-library': diff --git a/packages/cli/config/jsdomEnvironment.js b/packages/cli/config/jestJsdomEnvironment.js similarity index 100% rename from packages/cli/config/jsdomEnvironment.js rename to packages/cli/config/jestJsdomEnvironment.js From 018553e29f5d214aeea18fd39d0a7e9279717c02 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 16:25:53 +0200 Subject: [PATCH 05/13] chore: remove cross-fetch dep from plugins Signed-off-by: blam --- plugins/adr/src/setupTests.ts | 1 - plugins/airbrake/package.json | 1 - plugins/airbrake/src/setupTests.ts | 1 - plugins/allure/package.json | 1 - plugins/allure/src/setupTests.ts | 1 - plugins/analytics-module-ga/package.json | 1 - plugins/analytics-module-ga/src/setupTests.ts | 1 - plugins/analytics-module-ga4/package.json | 1 - plugins/analytics-module-ga4/src/setupTests.ts | 1 - plugins/apache-airflow/src/setupTests.ts | 1 - plugins/apollo-explorer/package.json | 1 - plugins/apollo-explorer/src/setupTests.ts | 1 - plugins/azure-devops/package.json | 1 - plugins/azure-devops/src/setupTests.ts | 1 - plugins/azure-sites/package.json | 1 - plugins/azure-sites/src/setupTests.ts | 1 - plugins/badges/package.json | 3 +-- plugins/badges/src/setupTests.ts | 1 - plugins/bazaar/package.json | 3 +-- plugins/bazaar/src/setupTests.ts | 1 - plugins/bitrise/package.json | 1 - plugins/bitrise/src/setupTests.ts | 1 - plugins/catalog-import/package.json | 1 - plugins/catalog-import/src/setupTests.ts | 1 - plugins/catalog-react/package.json | 1 - plugins/catalog-react/src/setupTests.ts | 1 - plugins/catalog-unprocessed-entities/package.json | 1 - plugins/catalog-unprocessed-entities/src/setupTests.ts | 1 - plugins/catalog/package.json | 3 +-- plugins/catalog/src/setupTests.ts | 1 - plugins/code-climate/package.json | 1 - plugins/code-climate/src/setupTests.ts | 1 - plugins/code-coverage/package.json | 1 - plugins/code-coverage/src/setupTests.ts | 1 - plugins/codescene/package.json | 1 - plugins/codescene/src/setupTests.ts | 1 - plugins/config-schema/package.json | 1 - plugins/config-schema/src/setupTests.ts | 1 - plugins/entity-feedback/package.json | 1 - plugins/entity-feedback/src/setupTests.ts | 1 - plugins/entity-validation/package.json | 1 - plugins/entity-validation/src/setupTests.ts | 1 - plugins/firehydrant/package.json | 1 - plugins/firehydrant/src/setupTests.ts | 1 - plugins/gcalendar/package.json | 1 - plugins/gcalendar/src/setupTests.ts | 1 - plugins/git-release-manager/package.json | 1 - plugins/git-release-manager/src/setupTests.ts | 1 - plugins/github-deployments/package.json | 1 - plugins/github-deployments/src/setupTests.ts | 1 - plugins/github-issues/package.json | 1 - plugins/github-issues/src/setupTests.ts | 1 - plugins/github-pull-requests-board/package.json | 1 - plugins/github-pull-requests-board/src/setupTests.ts | 1 - plugins/gocd/package.json | 1 - plugins/gocd/src/setupTests.ts | 1 - plugins/graphql-voyager/package.json | 1 - plugins/graphql-voyager/src/setupTests.ts | 1 - plugins/home/package.json | 1 - plugins/home/src/setupTests.ts | 1 - plugins/ilert/package.json | 1 - plugins/ilert/src/setupTests.ts | 1 - plugins/kafka/package.json | 1 - plugins/kafka/src/setupTests.ts | 1 - plugins/kubernetes/package.json | 1 - plugins/kubernetes/src/setupTests.ts | 1 - plugins/lighthouse/package.json | 1 - plugins/lighthouse/src/setupTests.ts | 1 - plugins/linguist/package.json | 1 - plugins/linguist/src/setupTests.ts | 1 - plugins/microsoft-calendar/package.json | 1 - plugins/microsoft-calendar/src/setupTests.ts | 1 - plugins/newrelic-dashboard/package.json | 3 +-- plugins/newrelic-dashboard/src/setupTests.ts | 1 - plugins/octopus-deploy/package.json | 1 - plugins/octopus-deploy/src/setupTests.ts | 1 - plugins/org-react/package.json | 1 - plugins/org-react/src/setupTests.ts | 1 - plugins/org/package.json | 1 - plugins/org/src/setupTests.ts | 1 - plugins/pagerduty/package.json | 1 - plugins/pagerduty/src/setupTests.ts | 1 - plugins/periskop/package.json | 1 - plugins/periskop/src/setupTests.ts | 1 - plugins/playlist/package.json | 1 - plugins/playlist/src/setupTests.ts | 1 - plugins/puppetdb/package.json | 1 - plugins/puppetdb/src/setupTests.ts | 1 - plugins/scaffolder/package.json | 1 - plugins/scaffolder/src/setupTests.ts | 1 - plugins/search/package.json | 1 - plugins/search/src/setupTests.ts | 1 - plugins/shortcuts/package.json | 1 - plugins/shortcuts/src/setupTests.ts | 1 - plugins/splunk-on-call/package.json | 1 - plugins/splunk-on-call/src/setupTests.ts | 1 - plugins/stack-overflow/src/setupTests.ts | 1 - plugins/stackstorm/package.json | 1 - plugins/stackstorm/src/setupTests.ts | 1 - plugins/tech-insights/package.json | 1 - plugins/tech-insights/src/setupTests.ts | 1 - plugins/techdocs-addons-test-utils/package.json | 1 - plugins/techdocs-addons-test-utils/src/setupTests.ts | 1 - plugins/techdocs-module-addons-contrib/package.json | 1 - plugins/techdocs-module-addons-contrib/src/setupTests.ts | 1 - plugins/todo/package.json | 1 - plugins/todo/src/setupTests.ts | 1 - plugins/vault/package.json | 1 - plugins/vault/src/setupTests.ts | 1 - plugins/xcmetrics/package.json | 1 - plugins/xcmetrics/src/setupTests.ts | 1 - 111 files changed, 4 insertions(+), 115 deletions(-) diff --git a/plugins/adr/src/setupTests.ts b/plugins/adr/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/adr/src/setupTests.ts +++ b/plugins/adr/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/airbrake/package.json b/plugins/airbrake/package.json index d600586f00..af28de5745 100644 --- a/plugins/airbrake/package.json +++ b/plugins/airbrake/package.json @@ -50,7 +50,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/airbrake/src/setupTests.ts b/plugins/airbrake/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/airbrake/src/setupTests.ts +++ b/plugins/airbrake/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/allure/package.json b/plugins/allure/package.json index 78fcfd30f0..5bfd6dfa99 100644 --- a/plugins/allure/package.json +++ b/plugins/allure/package.json @@ -49,7 +49,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/allure/src/setupTests.ts b/plugins/allure/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/allure/src/setupTests.ts +++ b/plugins/allure/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/analytics-module-ga/package.json b/plugins/analytics-module-ga/package.json index 13a6e91d2b..337c4f4ff8 100644 --- a/plugins/analytics-module-ga/package.json +++ b/plugins/analytics-module-ga/package.json @@ -49,7 +49,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/analytics-module-ga/src/setupTests.ts b/plugins/analytics-module-ga/src/setupTests.ts index 4ed20ac097..bd29200219 100644 --- a/plugins/analytics-module-ga/src/setupTests.ts +++ b/plugins/analytics-module-ga/src/setupTests.ts @@ -14,7 +14,6 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; // eslint-disable-next-line no-restricted-imports import { TextEncoder } from 'util'; diff --git a/plugins/analytics-module-ga4/package.json b/plugins/analytics-module-ga4/package.json index 4771dd5156..7a652e86ea 100644 --- a/plugins/analytics-module-ga4/package.json +++ b/plugins/analytics-module-ga4/package.json @@ -46,7 +46,6 @@ "@types/jest": "^28.1.3", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/analytics-module-ga4/src/setupTests.ts b/plugins/analytics-module-ga4/src/setupTests.ts index 4ed20ac097..bd29200219 100644 --- a/plugins/analytics-module-ga4/src/setupTests.ts +++ b/plugins/analytics-module-ga4/src/setupTests.ts @@ -14,7 +14,6 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; // eslint-disable-next-line no-restricted-imports import { TextEncoder } from 'util'; diff --git a/plugins/apache-airflow/src/setupTests.ts b/plugins/apache-airflow/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/plugins/apache-airflow/src/setupTests.ts +++ b/plugins/apache-airflow/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/apollo-explorer/package.json b/plugins/apollo-explorer/package.json index 7a55d921a8..36fe085651 100644 --- a/plugins/apollo-explorer/package.json +++ b/plugins/apollo-explorer/package.json @@ -47,7 +47,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/apollo-explorer/src/setupTests.ts b/plugins/apollo-explorer/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/apollo-explorer/src/setupTests.ts +++ b/plugins/apollo-explorer/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/azure-devops/package.json b/plugins/azure-devops/package.json index 0bebc02495..958fd290e1 100644 --- a/plugins/azure-devops/package.json +++ b/plugins/azure-devops/package.json @@ -58,7 +58,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/azure-devops/src/setupTests.ts b/plugins/azure-devops/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/azure-devops/src/setupTests.ts +++ b/plugins/azure-devops/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/azure-sites/package.json b/plugins/azure-sites/package.json index b31ebac2cc..f6ac2b9549 100644 --- a/plugins/azure-sites/package.json +++ b/plugins/azure-sites/package.json @@ -60,7 +60,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/azure-sites/src/setupTests.ts b/plugins/azure-sites/src/setupTests.ts index 2b5b615b19..7a459ed24e 100644 --- a/plugins/azure-sites/src/setupTests.ts +++ b/plugins/azure-sites/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/badges/package.json b/plugins/badges/package.json index 3f79c3a2ce..623c79644d 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -51,8 +51,7 @@ "@backstage/dev-utils": "workspace:^", "@backstage/test-utils": "workspace:^", "@testing-library/jest-dom": "^5.16.5", - "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5" + "@types/node": "^16.11.26" }, "files": [ "dist" diff --git a/plugins/badges/src/setupTests.ts b/plugins/badges/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/badges/src/setupTests.ts +++ b/plugins/badges/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/bazaar/package.json b/plugins/bazaar/package.json index 3cdb23e646..a613b5166f 100644 --- a/plugins/bazaar/package.json +++ b/plugins/bazaar/package.json @@ -51,8 +51,7 @@ "@backstage/cli": "workspace:^", "@backstage/dev-utils": "workspace:^", "@testing-library/jest-dom": "^5.10.1", - "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5" + "@types/react": "^16.13.1 || ^17.0.0" }, "files": [ "dist" diff --git a/plugins/bazaar/src/setupTests.ts b/plugins/bazaar/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/plugins/bazaar/src/setupTests.ts +++ b/plugins/bazaar/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index de09d44f77..cdb5f19b9f 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -31,7 +31,6 @@ "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.61", - "cross-fetch": "^3.1.5", "lodash": "^4.17.21", "luxon": "^3.0.0", "qs": "^6.9.6", diff --git a/plugins/bitrise/src/setupTests.ts b/plugins/bitrise/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/plugins/bitrise/src/setupTests.ts +++ b/plugins/bitrise/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 227e6295d8..96263560e3 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -69,7 +69,6 @@ "@testing-library/react": "^12.1.3", "@testing-library/react-hooks": "^8.0.0", "@testing-library/user-event": "^14.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/catalog-import/src/setupTests.ts b/plugins/catalog-import/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/catalog-import/src/setupTests.ts +++ b/plugins/catalog-import/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index be6c89290c..26bb0252fb 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -89,7 +89,6 @@ "@testing-library/user-event": "^14.0.0", "@types/jwt-decode": "^3.1.0", "@types/zen-observable": "^0.8.0", - "cross-fetch": "^3.1.5", "react-test-renderer": "^16.13.1" }, "files": [ diff --git a/plugins/catalog-react/src/setupTests.ts b/plugins/catalog-react/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/catalog-react/src/setupTests.ts +++ b/plugins/catalog-react/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/catalog-unprocessed-entities/package.json b/plugins/catalog-unprocessed-entities/package.json index 3aa40fe1c0..10096c29c0 100644 --- a/plugins/catalog-unprocessed-entities/package.json +++ b/plugins/catalog-unprocessed-entities/package.json @@ -44,7 +44,6 @@ "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^14.0.0", "@types/node": "*", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/catalog-unprocessed-entities/src/setupTests.ts b/plugins/catalog-unprocessed-entities/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/catalog-unprocessed-entities/src/setupTests.ts +++ b/plugins/catalog-unprocessed-entities/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 8d5ed9fe8f..cfe9974b25 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -70,8 +70,7 @@ "@testing-library/dom": "^8.0.0", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^12.1.3", - "@testing-library/user-event": "^14.0.0", - "cross-fetch": "^3.1.5" + "@testing-library/user-event": "^14.0.0" }, "files": [ "dist" diff --git a/plugins/catalog/src/setupTests.ts b/plugins/catalog/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/catalog/src/setupTests.ts +++ b/plugins/catalog/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/code-climate/package.json b/plugins/code-climate/package.json index 83c658673a..1b1c38f283 100644 --- a/plugins/code-climate/package.json +++ b/plugins/code-climate/package.json @@ -51,7 +51,6 @@ "@types/luxon": "^3.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/code-climate/src/setupTests.ts b/plugins/code-climate/src/setupTests.ts index eb4654b869..c2f27937b3 100644 --- a/plugins/code-climate/src/setupTests.ts +++ b/plugins/code-climate/src/setupTests.ts @@ -17,4 +17,3 @@ /* eslint-disable @backstage/no-undeclared-imports */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 15c1bee560..2f9350eb7d 100644 --- a/plugins/code-coverage/package.json +++ b/plugins/code-coverage/package.json @@ -57,7 +57,6 @@ "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", "@types/recharts": "^1.8.15", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/code-coverage/src/setupTests.ts b/plugins/code-coverage/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/code-coverage/src/setupTests.ts +++ b/plugins/code-coverage/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/codescene/package.json b/plugins/codescene/package.json index 41afdb82a4..4263ad021e 100644 --- a/plugins/codescene/package.json +++ b/plugins/codescene/package.json @@ -49,7 +49,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/codescene/src/setupTests.ts b/plugins/codescene/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/codescene/src/setupTests.ts +++ b/plugins/codescene/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index d92b17aa3a..d697dd0636 100644 --- a/plugins/config-schema/package.json +++ b/plugins/config-schema/package.json @@ -52,7 +52,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/config-schema/src/setupTests.ts b/plugins/config-schema/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/config-schema/src/setupTests.ts +++ b/plugins/config-schema/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/entity-feedback/package.json b/plugins/entity-feedback/package.json index b55a211b02..b7e2c32fe3 100644 --- a/plugins/entity-feedback/package.json +++ b/plugins/entity-feedback/package.json @@ -56,7 +56,6 @@ "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "^14.0.0", "@types/node": "*", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/entity-feedback/src/setupTests.ts b/plugins/entity-feedback/src/setupTests.ts index bf4855cb6e..c30f1d15cb 100644 --- a/plugins/entity-feedback/src/setupTests.ts +++ b/plugins/entity-feedback/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/entity-validation/package.json b/plugins/entity-validation/package.json index 803d0a79c2..849aa94082 100644 --- a/plugins/entity-validation/package.json +++ b/plugins/entity-validation/package.json @@ -63,7 +63,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/entity-validation/src/setupTests.ts b/plugins/entity-validation/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/entity-validation/src/setupTests.ts +++ b/plugins/entity-validation/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/firehydrant/package.json b/plugins/firehydrant/package.json index 464b22f46d..4345a6610c 100644 --- a/plugins/firehydrant/package.json +++ b/plugins/firehydrant/package.json @@ -50,7 +50,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/firehydrant/src/setupTests.ts b/plugins/firehydrant/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/firehydrant/src/setupTests.ts +++ b/plugins/firehydrant/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/gcalendar/package.json b/plugins/gcalendar/package.json index 1e630223af..4c2ae878fa 100644 --- a/plugins/gcalendar/package.json +++ b/plugins/gcalendar/package.json @@ -57,7 +57,6 @@ "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", "@types/sanitize-html": "^2.6.2", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/gcalendar/src/setupTests.ts b/plugins/gcalendar/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/gcalendar/src/setupTests.ts +++ b/plugins/gcalendar/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/git-release-manager/package.json b/plugins/git-release-manager/package.json index 89fea27736..65a466f1ae 100644 --- a/plugins/git-release-manager/package.json +++ b/plugins/git-release-manager/package.json @@ -54,7 +54,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/recharts": "^1.8.15", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/git-release-manager/src/setupTests.ts b/plugins/git-release-manager/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/plugins/git-release-manager/src/setupTests.ts +++ b/plugins/git-release-manager/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index 7ea56709f5..04674bd9ff 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -54,7 +54,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/github-deployments/src/setupTests.ts b/plugins/github-deployments/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/github-deployments/src/setupTests.ts +++ b/plugins/github-deployments/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/github-issues/package.json b/plugins/github-issues/package.json index 633cb60266..5a934c75f8 100644 --- a/plugins/github-issues/package.json +++ b/plugins/github-issues/package.json @@ -52,7 +52,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/github-issues/src/setupTests.ts b/plugins/github-issues/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/github-issues/src/setupTests.ts +++ b/plugins/github-issues/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/github-pull-requests-board/package.json b/plugins/github-pull-requests-board/package.json index b4af885bc6..f66cf8fbce 100644 --- a/plugins/github-pull-requests-board/package.json +++ b/plugins/github-pull-requests-board/package.json @@ -63,7 +63,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/github-pull-requests-board/src/setupTests.ts b/plugins/github-pull-requests-board/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/github-pull-requests-board/src/setupTests.ts +++ b/plugins/github-pull-requests-board/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/gocd/package.json b/plugins/gocd/package.json index 766afdcc76..58a459be4c 100644 --- a/plugins/gocd/package.json +++ b/plugins/gocd/package.json @@ -61,7 +61,6 @@ "@types/luxon": "^3.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/gocd/src/setupTests.ts b/plugins/gocd/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/gocd/src/setupTests.ts +++ b/plugins/gocd/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/graphql-voyager/package.json b/plugins/graphql-voyager/package.json index 6ad5e9df22..06608f4ed3 100644 --- a/plugins/graphql-voyager/package.json +++ b/plugins/graphql-voyager/package.json @@ -48,7 +48,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/graphql-voyager/src/setupTests.ts b/plugins/graphql-voyager/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/graphql-voyager/src/setupTests.ts +++ b/plugins/graphql-voyager/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/home/package.json b/plugins/home/package.json index 3fde2f6c51..c0b9e06e51 100644 --- a/plugins/home/package.json +++ b/plugins/home/package.json @@ -70,7 +70,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react-grid-layout": "^1.3.2", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/home/src/setupTests.ts b/plugins/home/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/home/src/setupTests.ts +++ b/plugins/home/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/ilert/package.json b/plugins/ilert/package.json index 4c4ae17ec2..15c19865e1 100644 --- a/plugins/ilert/package.json +++ b/plugins/ilert/package.json @@ -55,7 +55,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/ilert/src/setupTests.ts b/plugins/ilert/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/ilert/src/setupTests.ts +++ b/plugins/ilert/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index cd4fd99820..79e1834025 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -52,7 +52,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "jest-when": "^3.1.0", "msw": "^1.0.0" }, diff --git a/plugins/kafka/src/setupTests.ts b/plugins/kafka/src/setupTests.ts index b201a9c83e..28a35d2b06 100644 --- a/plugins/kafka/src/setupTests.ts +++ b/plugins/kafka/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 5318e1dffe..f31e0678c2 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -71,7 +71,6 @@ "@testing-library/react-hooks": "^8.0.0", "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/kubernetes/src/setupTests.ts b/plugins/kubernetes/src/setupTests.ts index f7752030ed..a373310a1a 100644 --- a/plugins/kubernetes/src/setupTests.ts +++ b/plugins/kubernetes/src/setupTests.ts @@ -16,7 +16,6 @@ import '@testing-library/jest-dom'; // eslint-disable-next-line no-restricted-imports import { TextDecoder, TextEncoder } from 'util'; -import 'cross-fetch/polyfill'; // These are missing from jest-node, so not available on global. Object.defineProperty(global, 'TextEncoder', { diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index 748daa63f0..9f9a271e93 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -62,7 +62,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/lighthouse/src/setupTests.ts b/plugins/lighthouse/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/lighthouse/src/setupTests.ts +++ b/plugins/lighthouse/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/linguist/package.json b/plugins/linguist/package.json index 3cbcf07ba3..fcc8ad4352 100644 --- a/plugins/linguist/package.json +++ b/plugins/linguist/package.json @@ -58,7 +58,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/linguist/src/setupTests.ts b/plugins/linguist/src/setupTests.ts index 2b5b615b19..7a459ed24e 100644 --- a/plugins/linguist/src/setupTests.ts +++ b/plugins/linguist/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/microsoft-calendar/package.json b/plugins/microsoft-calendar/package.json index f9eb4e0cec..c8f9799127 100644 --- a/plugins/microsoft-calendar/package.json +++ b/plugins/microsoft-calendar/package.json @@ -72,7 +72,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/microsoft-calendar/src/setupTests.ts b/plugins/microsoft-calendar/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/microsoft-calendar/src/setupTests.ts +++ b/plugins/microsoft-calendar/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/newrelic-dashboard/package.json b/plugins/newrelic-dashboard/package.json index 1ec9e0953a..790c9f6546 100644 --- a/plugins/newrelic-dashboard/package.json +++ b/plugins/newrelic-dashboard/package.json @@ -41,8 +41,7 @@ "@backstage/cli": "workspace:^", "@backstage/dev-utils": "workspace:^", "@testing-library/jest-dom": "^5.10.1", - "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5" + "@types/react": "^16.13.1 || ^17.0.0" }, "files": [ "dist" diff --git a/plugins/newrelic-dashboard/src/setupTests.ts b/plugins/newrelic-dashboard/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/newrelic-dashboard/src/setupTests.ts +++ b/plugins/newrelic-dashboard/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/octopus-deploy/package.json b/plugins/octopus-deploy/package.json index 7a2a2de7ae..4194cde3ba 100644 --- a/plugins/octopus-deploy/package.json +++ b/plugins/octopus-deploy/package.json @@ -48,7 +48,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/octopus-deploy/src/setupTests.ts b/plugins/octopus-deploy/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/octopus-deploy/src/setupTests.ts +++ b/plugins/octopus-deploy/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/org-react/package.json b/plugins/org-react/package.json index a224948146..c402a0cf57 100644 --- a/plugins/org-react/package.json +++ b/plugins/org-react/package.json @@ -57,7 +57,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/org-react/src/setupTests.ts b/plugins/org-react/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/org-react/src/setupTests.ts +++ b/plugins/org-react/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/org/package.json b/plugins/org/package.json index b250b6e26f..ab44651fdd 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -61,7 +61,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/org/src/setupTests.ts b/plugins/org/src/setupTests.ts index b201a9c83e..28a35d2b06 100644 --- a/plugins/org/src/setupTests.ts +++ b/plugins/org/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index a0eae611a0..4b9f5bf0e4 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -63,7 +63,6 @@ "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/pagerduty/src/setupTests.ts b/plugins/pagerduty/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/pagerduty/src/setupTests.ts +++ b/plugins/pagerduty/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/periskop/package.json b/plugins/periskop/package.json index 7f818a54f3..12670bd1e4 100644 --- a/plugins/periskop/package.json +++ b/plugins/periskop/package.json @@ -52,7 +52,6 @@ "@types/luxon": "^3.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/periskop/src/setupTests.ts b/plugins/periskop/src/setupTests.ts index 2b5b615b19..7a459ed24e 100644 --- a/plugins/periskop/src/setupTests.ts +++ b/plugins/periskop/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/playlist/package.json b/plugins/playlist/package.json index 91fabe172e..2df75d327d 100644 --- a/plugins/playlist/package.json +++ b/plugins/playlist/package.json @@ -64,7 +64,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0", "swr": "^2.0.0" }, diff --git a/plugins/playlist/src/setupTests.ts b/plugins/playlist/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/playlist/src/setupTests.ts +++ b/plugins/playlist/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/puppetdb/package.json b/plugins/puppetdb/package.json index 05b2d60180..b7eaa2316e 100644 --- a/plugins/puppetdb/package.json +++ b/plugins/puppetdb/package.json @@ -59,7 +59,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.1" }, "files": [ diff --git a/plugins/puppetdb/src/setupTests.ts b/plugins/puppetdb/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/puppetdb/src/setupTests.ts +++ b/plugins/puppetdb/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index d7fe15edd9..05375883ef 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -108,7 +108,6 @@ "@types/humanize-duration": "^3.18.1", "@types/json-schema": "^7.0.9", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/scaffolder/src/setupTests.ts b/plugins/scaffolder/src/setupTests.ts index 5499f969dc..8608e5b98e 100644 --- a/plugins/scaffolder/src/setupTests.ts +++ b/plugins/scaffolder/src/setupTests.ts @@ -15,7 +15,6 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; const { EventSourcePolyfill } = jest.requireMock('event-source-polyfill'); global.EventSource = EventSourcePolyfill; diff --git a/plugins/search/package.json b/plugins/search/package.json index 8ca485abd1..b546e2fb84 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -66,7 +66,6 @@ "@testing-library/react-hooks": "^8.0.0", "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "history": "^5.0.0", "msw": "^1.0.0" }, diff --git a/plugins/search/src/setupTests.ts b/plugins/search/src/setupTests.ts index b201a9c83e..28a35d2b06 100644 --- a/plugins/search/src/setupTests.ts +++ b/plugins/search/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index bcbefa439a..8f24a4088e 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -52,7 +52,6 @@ "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", "@types/zen-observable": "^0.8.2", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/shortcuts/src/setupTests.ts b/plugins/shortcuts/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/plugins/shortcuts/src/setupTests.ts +++ b/plugins/shortcuts/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index d2dcf1972a..c6b5c499f6 100644 --- a/plugins/splunk-on-call/package.json +++ b/plugins/splunk-on-call/package.json @@ -62,7 +62,6 @@ "@types/luxon": "^3.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "configSchema": "config.d.ts", diff --git a/plugins/splunk-on-call/src/setupTests.ts b/plugins/splunk-on-call/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/plugins/splunk-on-call/src/setupTests.ts +++ b/plugins/splunk-on-call/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/stack-overflow/src/setupTests.ts b/plugins/stack-overflow/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/stack-overflow/src/setupTests.ts +++ b/plugins/stack-overflow/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/stackstorm/package.json b/plugins/stackstorm/package.json index b71a8c8c66..0afececf86 100644 --- a/plugins/stackstorm/package.json +++ b/plugins/stackstorm/package.json @@ -58,7 +58,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/stackstorm/src/setupTests.ts b/plugins/stackstorm/src/setupTests.ts index 73dd8dce47..865308e634 100644 --- a/plugins/stackstorm/src/setupTests.ts +++ b/plugins/stackstorm/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/tech-insights/package.json b/plugins/tech-insights/package.json index 85207bd3f6..89225aeaf5 100644 --- a/plugins/tech-insights/package.json +++ b/plugins/tech-insights/package.json @@ -57,7 +57,6 @@ "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/tech-insights/src/setupTests.ts b/plugins/tech-insights/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/tech-insights/src/setupTests.ts +++ b/plugins/tech-insights/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/techdocs-addons-test-utils/package.json b/plugins/techdocs-addons-test-utils/package.json index 1080fbe200..be448725f7 100644 --- a/plugins/techdocs-addons-test-utils/package.json +++ b/plugins/techdocs-addons-test-utils/package.json @@ -63,7 +63,6 @@ "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/techdocs-addons-test-utils/src/setupTests.ts b/plugins/techdocs-addons-test-utils/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/techdocs-addons-test-utils/src/setupTests.ts +++ b/plugins/techdocs-addons-test-utils/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/techdocs-module-addons-contrib/package.json b/plugins/techdocs-module-addons-contrib/package.json index 3db0a218e9..d03f82b07c 100644 --- a/plugins/techdocs-module-addons-contrib/package.json +++ b/plugins/techdocs-module-addons-contrib/package.json @@ -64,7 +64,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/techdocs-module-addons-contrib/src/setupTests.ts b/plugins/techdocs-module-addons-contrib/src/setupTests.ts index 9bb3e72355..326d2ed212 100644 --- a/plugins/techdocs-module-addons-contrib/src/setupTests.ts +++ b/plugins/techdocs-module-addons-contrib/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/todo/package.json b/plugins/todo/package.json index 530c8db36d..5ab36d9987 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -57,7 +57,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/todo/src/setupTests.ts b/plugins/todo/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/todo/src/setupTests.ts +++ b/plugins/todo/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/vault/package.json b/plugins/vault/package.json index 2b2ffae17c..707fa8477a 100644 --- a/plugins/vault/package.json +++ b/plugins/vault/package.json @@ -60,7 +60,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "*", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/vault/src/setupTests.ts b/plugins/vault/src/setupTests.ts index b201a9c83e..28a35d2b06 100644 --- a/plugins/vault/src/setupTests.ts +++ b/plugins/vault/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/xcmetrics/package.json b/plugins/xcmetrics/package.json index 6d40083187..8f480f5290 100644 --- a/plugins/xcmetrics/package.json +++ b/plugins/xcmetrics/package.json @@ -52,7 +52,6 @@ "@types/luxon": "^3.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/xcmetrics/src/setupTests.ts b/plugins/xcmetrics/src/setupTests.ts index fc6dbd98f8..7435872609 100644 --- a/plugins/xcmetrics/src/setupTests.ts +++ b/plugins/xcmetrics/src/setupTests.ts @@ -14,4 +14,3 @@ * limitations under the License. */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; From 696df736b7d53dc67ac906ea7fa77ea4fe3881ec Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 16:26:26 +0200 Subject: [PATCH 06/13] chore: fix cli useage Signed-off-by: blam --- packages/cli/templates/default-plugin/package.json.hbs | 3 +-- packages/cli/templates/default-plugin/src/setupTests.ts | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/cli/templates/default-plugin/package.json.hbs b/packages/cli/templates/default-plugin/package.json.hbs index 10f893d7dc..463fc6ea90 100644 --- a/packages/cli/templates/default-plugin/package.json.hbs +++ b/packages/cli/templates/default-plugin/package.json.hbs @@ -48,8 +48,7 @@ "@testing-library/react": "{{versionQuery '@testing-library/react' '12.1.3'}}", "@testing-library/user-event": "{{versionQuery '@testing-library/user-event' '14.0.0'}}", "@types/node": "{{versionQuery '@types/node' '16.11.26'}}", - "msw": "{{versionQuery 'msw' '1.0.0'}}", - "cross-fetch": "{{versionQuery 'cross-fetch' '3.1.5'}}" + "msw": "{{versionQuery 'msw' '1.0.0'}}" }, "files": [ "dist" diff --git a/packages/cli/templates/default-plugin/src/setupTests.ts b/packages/cli/templates/default-plugin/src/setupTests.ts index 48c09b5346..7b0828bfa8 100644 --- a/packages/cli/templates/default-plugin/src/setupTests.ts +++ b/packages/cli/templates/default-plugin/src/setupTests.ts @@ -1,2 +1 @@ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; From 963d76f3292bc0f1e0105a612e588cdad136b088 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 16:26:45 +0200 Subject: [PATCH 07/13] chore: remove cross-fetch dependency again Signed-off-by: blam --- packages/core-app-api/package.json | 1 - packages/core-app-api/src/setupTests.ts | 1 - packages/core-components/package.json | 1 - packages/core-components/src/setupTests.ts | 1 - packages/core-plugin-api/package.json | 1 - packages/core-plugin-api/src/setupTests.ts | 1 - packages/integration-react/package.json | 1 - packages/integration-react/src/setupTests.ts | 1 - packages/test-utils/src/setupTests.ts | 1 - yarn.lock | 57 -------------------- 10 files changed, 66 deletions(-) diff --git a/packages/core-app-api/package.json b/packages/core-app-api/package.json index 932bf05e95..36da8b1913 100644 --- a/packages/core-app-api/package.json +++ b/packages/core-app-api/package.json @@ -59,7 +59,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/zen-observable": "^0.8.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0", "react-router-beta": "npm:react-router@6.0.0-beta.0", "react-router-dom-beta": "npm:react-router-dom@6.0.0-beta.0", diff --git a/packages/core-app-api/src/setupTests.ts b/packages/core-app-api/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/packages/core-app-api/src/setupTests.ts +++ b/packages/core-app-api/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/packages/core-components/package.json b/packages/core-components/package.json index 25c654e7d5..6f17968d2b 100644 --- a/packages/core-components/package.json +++ b/packages/core-components/package.json @@ -101,7 +101,6 @@ "@types/react-virtualized-auto-sizer": "^1.0.1", "@types/react-window": "^1.8.5", "@types/zen-observable": "^0.8.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/packages/core-components/src/setupTests.ts b/packages/core-components/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/packages/core-components/src/setupTests.ts +++ b/packages/core-components/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/packages/core-plugin-api/package.json b/packages/core-plugin-api/package.json index 7fe56c1a6d..9e9214a376 100644 --- a/packages/core-plugin-api/package.json +++ b/packages/core-plugin-api/package.json @@ -70,7 +70,6 @@ "@types/node": "^16.11.26", "@types/prop-types": "^15.7.3", "@types/zen-observable": "^0.8.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/packages/core-plugin-api/src/setupTests.ts b/packages/core-plugin-api/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/packages/core-plugin-api/src/setupTests.ts +++ b/packages/core-plugin-api/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/packages/integration-react/package.json b/packages/integration-react/package.json index d6d045b068..97f1ce2491 100644 --- a/packages/integration-react/package.json +++ b/packages/integration-react/package.json @@ -48,7 +48,6 @@ "@testing-library/user-event": "^14.0.0", "@types/node": "^16.11.26", "@types/react": "^16.13.1 || ^17.0.0", - "cross-fetch": "^3.1.5", "msw": "^1.0.0" }, "files": [ diff --git a/packages/integration-react/src/setupTests.ts b/packages/integration-react/src/setupTests.ts index 427556fe26..992b60d3a4 100644 --- a/packages/integration-react/src/setupTests.ts +++ b/packages/integration-react/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/packages/test-utils/src/setupTests.ts b/packages/test-utils/src/setupTests.ts index c1d649f2ad..963c0f188b 100644 --- a/packages/test-utils/src/setupTests.ts +++ b/packages/test-utils/src/setupTests.ts @@ -15,4 +15,3 @@ */ import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/yarn.lock b/yarn.lock index 2cc0059cde..ae5cceaa5a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4152,7 +4152,6 @@ __metadata: "@types/prop-types": ^15.7.3 "@types/react": ^16.13.1 || ^17.0.0 "@types/zen-observable": ^0.8.0 - cross-fetch: ^3.1.5 history: ^5.0.0 msw: ^1.0.0 prop-types: ^15.7.2 @@ -4314,7 +4313,6 @@ __metadata: "@types/zen-observable": ^0.8.0 ansi-regex: ^6.0.1 classnames: ^2.2.6 - cross-fetch: ^3.1.5 d3-selection: ^3.0.0 d3-shape: ^3.0.0 d3-zoom: ^3.0.0 @@ -4386,7 +4384,6 @@ __metadata: "@types/prop-types": ^15.7.3 "@types/react": ^16.13.1 || ^17.0.0 "@types/zen-observable": ^0.8.0 - cross-fetch: ^3.1.5 history: ^5.0.0 msw: ^1.0.0 prop-types: ^15.7.2 @@ -4549,7 +4546,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -4717,7 +4713,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -4749,7 +4744,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -4778,7 +4772,6 @@ __metadata: "@types/jest": ^28.1.3 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-ga4: ^2.0.0 react-use: ^17.2.4 @@ -4810,7 +4803,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 prop-types: ^15.7.2 react-ga: ^3.3.0 @@ -4927,7 +4919,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 use-deep-compare-effect: ^1.8.1 @@ -5108,7 +5099,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 humanize-duration: ^3.27.0 luxon: ^3.0.0 msw: ^1.0.0 @@ -5173,7 +5163,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -5231,7 +5220,6 @@ __metadata: "@material-ui/lab": 4.0.0-alpha.61 "@testing-library/jest-dom": ^5.16.5 "@types/node": ^16.11.26 - cross-fetch: ^3.1.5 react-use: ^17.2.4 peerDependencies: react: ^16.13.1 || ^17.0.0 @@ -5281,7 +5269,6 @@ __metadata: "@material-ui/pickers": ^3.3.10 "@testing-library/jest-dom": ^5.10.1 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 material-ui-search-bar: ^1.0.0 react-hook-form: ^7.13.0 @@ -5329,7 +5316,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 "@types/recharts": ^1.8.15 - cross-fetch: ^3.1.5 lodash: ^4.17.21 luxon: ^3.0.0 msw: ^1.0.0 @@ -5873,7 +5859,6 @@ __metadata: "@testing-library/react-hooks": ^8.0.0 "@testing-library/user-event": ^14.0.0 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 git-url-parse: ^13.0.0 js-base64: ^3.6.0 lodash: ^4.17.21 @@ -5973,7 +5958,6 @@ __metadata: "@types/react": ^16.13.1 || ^17.0.0 "@types/zen-observable": ^0.8.0 classnames: ^2.2.6 - cross-fetch: ^3.1.5 jwt-decode: ^3.1.0 lodash: ^4.17.21 material-ui-popup-state: ^1.9.3 @@ -6009,7 +5993,6 @@ __metadata: "@testing-library/react": ^12.1.3 "@testing-library/user-event": ^14.0.0 "@types/node": "*" - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -6047,7 +6030,6 @@ __metadata: "@testing-library/react": ^12.1.3 "@testing-library/user-event": ^14.0.0 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 history: ^5.0.0 lodash: ^4.17.21 pluralize: ^8.0.0 @@ -6204,7 +6186,6 @@ __metadata: "@types/luxon": ^3.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 humanize-duration: ^3.27.1 luxon: ^3.0.0 msw: ^1.0.0 @@ -6270,7 +6251,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 "@types/recharts": ^1.8.15 - cross-fetch: ^3.1.5 highlight.js: ^10.6.0 luxon: ^3.0.0 msw: ^1.0.0 @@ -6305,7 +6285,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 rc-progress: 3.4.1 react-use: ^17.2.4 @@ -6339,7 +6318,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 jsonschema: ^1.2.6 msw: ^1.0.0 react-use: ^17.2.4 @@ -6577,7 +6555,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -6617,7 +6594,6 @@ __metadata: "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 "@uiw/react-codemirror": ^4.9.3 - cross-fetch: ^3.1.5 lodash: ^4.17.21 msw: ^1.0.0 react-use: ^17.2.4 @@ -6877,7 +6853,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -7017,7 +6992,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 "@types/recharts": ^1.8.15 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 qs: ^6.10.1 @@ -7093,7 +7067,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -7128,7 +7101,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 octokit: ^2.0.4 @@ -7163,7 +7135,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 p-limit: ^4.0.0 @@ -7231,7 +7202,6 @@ __metadata: "@types/luxon": ^3.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 lodash: ^4.17.21 luxon: ^3.0.0 msw: ^1.0.0 @@ -7323,7 +7293,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 graphql-voyager: ^1.0.0-rc.31 msw: ^1.0.0 react-use: ^17.2.4 @@ -7423,7 +7392,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 "@types/react-grid-layout": ^1.3.2 - cross-fetch: ^3.1.5 lodash: ^4.17.21 msw: ^1.0.0 react-grid-layout: ^1.3.4 @@ -7462,7 +7430,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 humanize-duration: ^3.26.0 luxon: ^3.0.0 msw: ^1.0.0 @@ -7596,7 +7563,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 jest-when: ^3.1.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -7697,7 +7663,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 cronstrue: ^2.2.0 - cross-fetch: ^3.1.5 js-yaml: ^4.0.0 kubernetes-models: ^4.1.0 lodash: ^4.17.21 @@ -7761,7 +7726,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -7835,7 +7799,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^2.0.2 msw: ^1.0.0 react-use: ^17.2.4 @@ -7870,7 +7833,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 classnames: ^2.3.1 - cross-fetch: ^3.1.5 dompurify: ^2.3.6 lodash: ^4.17.21 luxon: ^3.0.0 @@ -7900,7 +7862,6 @@ __metadata: "@material-ui/lab": 4.0.0-alpha.61 "@testing-library/jest-dom": ^5.10.1 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 react-use: ^17.2.4 peerDependencies: react: ^16.13.1 || ^17.0.0 @@ -7961,7 +7922,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -7994,7 +7954,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -8030,7 +7989,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 p-limit: ^3.1.0 pluralize: ^8.0.0 @@ -8068,7 +8026,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 classnames: ^2.2.6 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -8123,7 +8080,6 @@ __metadata: "@types/luxon": ^3.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -8323,7 +8279,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 lodash: ^4.17.21 msw: ^1.0.0 pluralize: ^8.0.0 @@ -8387,7 +8342,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.1 react-use: ^17.2.4 peerDependencies: @@ -8773,7 +8727,6 @@ __metadata: "@types/react": ^16.13.1 || ^17.0.0 "@uiw/react-codemirror": ^4.9.3 classnames: ^2.2.6 - cross-fetch: ^3.1.5 event-source-polyfill: ^1.0.31 git-url-parse: ^13.0.0 humanize-duration: ^3.25.1 @@ -9035,7 +8988,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 history: ^5.0.0 msw: ^1.0.0 qs: ^6.9.4 @@ -9106,7 +9058,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 "@types/zen-observable": ^0.8.2 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-hook-form: ^7.12.2 react-use: ^17.2.4 @@ -9214,7 +9165,6 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 classnames: ^2.2.6 - cross-fetch: ^3.1.5 luxon: ^3.0.0 msw: ^1.0.0 react-use: ^17.2.4 @@ -9297,7 +9247,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -9410,7 +9359,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 qs: ^6.9.4 react-use: ^17.2.4 @@ -9481,7 +9429,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 testing-library__dom: ^7.29.4-beta.1 @@ -9552,7 +9499,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 git-url-parse: ^13.0.0 msw: ^1.0.0 photoswipe: ^5.3.7 @@ -9738,7 +9684,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -9855,7 +9800,6 @@ __metadata: "@testing-library/user-event": ^14.0.0 "@types/node": "*" "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 msw: ^1.0.0 react-use: ^17.2.4 peerDependencies: @@ -9887,7 +9831,6 @@ __metadata: "@types/luxon": ^3.0.0 "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 - cross-fetch: ^3.1.5 lodash: ^4.17.21 luxon: ^3.0.0 msw: ^1.0.0 From ed290e2730867eb20eef79f82600a7a78ae885cb Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 16:27:25 +0200 Subject: [PATCH 08/13] chore: add another changeset Signed-off-by: blam --- .changeset/thick-buckets-smile.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-buckets-smile.md diff --git a/.changeset/thick-buckets-smile.md b/.changeset/thick-buckets-smile.md new file mode 100644 index 0000000000..eca55e3d09 --- /dev/null +++ b/.changeset/thick-buckets-smile.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-bitrise': patch +--- + +Remove `cross-fetch` dependency as it's not used From a63e691502e4d5b5c70587a964da3745fb8979f9 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 17:30:00 +0200 Subject: [PATCH 09/13] chore: fix the fetch method Signed-off-by: blam --- packages/cli/config/jestJsdomEnvironment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/config/jestJsdomEnvironment.js b/packages/cli/config/jestJsdomEnvironment.js index 6a2fc494ae..14cdf929eb 100644 --- a/packages/cli/config/jestJsdomEnvironment.js +++ b/packages/cli/config/jestJsdomEnvironment.js @@ -14,7 +14,7 @@ * limitations under the License. */ import JSDOMEnvironment from 'jest-environment-jsdom'; -import { Headers, Request, Response, fetch } from 'node-fetch'; +import { Headers, Request, Response, default as fetch } from 'node-fetch'; // https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string export default class FixJSDOMEnvironment extends JSDOMEnvironment { From 4425a17dd6d40002191c0f164aaf239eb5df1f03 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 13 Jun 2023 17:32:12 +0200 Subject: [PATCH 10/13] chore: it's not the same object Signed-off-by: blam --- plugins/airbrake/src/api/ProductionApi.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/airbrake/src/api/ProductionApi.test.ts b/plugins/airbrake/src/api/ProductionApi.test.ts index f09127b4c2..bb0fab7ee0 100644 --- a/plugins/airbrake/src/api/ProductionApi.test.ts +++ b/plugins/airbrake/src/api/ProductionApi.test.ts @@ -38,7 +38,7 @@ describe('The production Airbrake API', () => { const groups = await productionApi.fetchGroups('123456'); - expect(groups).toStrictEqual(mockGroupsData); + expect(groups).toEqual(mockGroupsData); }); it('throws if fetching groups was unsuccessful', async () => { From 5f599539c2c484c502181edc2acd532e039879a2 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 14 Jun 2023 10:10:56 +0200 Subject: [PATCH 11/13] feat: fix this another way Signed-off-by: blam --- packages/cli/config/jest.js | 11 +++++-- packages/cli/config/jestJsdomEnvironment.js | 30 ------------------- packages/cli/package.json | 1 + .../airbrake/src/api/ProductionApi.test.ts | 3 +- 4 files changed, 11 insertions(+), 34 deletions(-) delete mode 100644 packages/cli/config/jestJsdomEnvironment.js diff --git a/packages/cli/config/jest.js b/packages/cli/config/jest.js index 68f4b77d94..1b32f954ef 100644 --- a/packages/cli/config/jest.js +++ b/packages/cli/config/jest.js @@ -48,7 +48,7 @@ function getRoleConfig(role) { case 'common-library': case 'frontend-plugin': case 'frontend-plugin-module': - return { testEnvironment: require.resolve('./jestJsdomEnvironment') }; + return { testEnvironment: require.resolve('jest-environment-jsdom') }; case 'cli': case 'backend': case 'node-library': @@ -194,9 +194,16 @@ async function getProjectConfig(targetPath, extraConfig) { ...getRoleConfig(closestPkgJson?.backstage?.role), }; + options.setupFilesAfterEnv = []; + + if (options.testEnvironment === require.resolve('jest-environment-jsdom')) { + // FIXME https://github.com/jsdom/jsdom/issues/1724 + options.setupFilesAfterEnv.push(require.resolve('cross-fetch/polyfill')); + } + // Use src/setupTests.ts as the default location for configuring test env if (fs.existsSync(path.resolve(targetPath, 'src/setupTests.ts'))) { - options.setupFilesAfterEnv = ['/setupTests.ts']; + options.setupFilesAfterEnv.push('/setupTests.ts'); } const config = Object.assign(options, ...pkgJsonConfigs); diff --git a/packages/cli/config/jestJsdomEnvironment.js b/packages/cli/config/jestJsdomEnvironment.js deleted file mode 100644 index 14cdf929eb..0000000000 --- a/packages/cli/config/jestJsdomEnvironment.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2023 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import JSDOMEnvironment from 'jest-environment-jsdom'; -import { Headers, Request, Response, default as fetch } from 'node-fetch'; - -// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string -export default class FixJSDOMEnvironment extends JSDOMEnvironment { - constructor(...args) { - super(...args); - - // FIXME https://github.com/jsdom/jsdom/issues/1724 - this.global.fetch = fetch; - this.global.Headers = Headers; - this.global.Request = Request; - this.global.Response = Response; - } -} diff --git a/packages/cli/package.json b/packages/cli/package.json index 4da91b0870..8a0c0508e8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -74,6 +74,7 @@ "chalk": "^4.0.0", "chokidar": "^3.3.1", "commander": "^9.1.0", + "cross-fetch": "^3.1.5", "cross-spawn": "^7.0.3", "css-loader": "^6.5.1", "diff": "^5.0.0", diff --git a/plugins/airbrake/src/api/ProductionApi.test.ts b/plugins/airbrake/src/api/ProductionApi.test.ts index bb0fab7ee0..92593e42bc 100644 --- a/plugins/airbrake/src/api/ProductionApi.test.ts +++ b/plugins/airbrake/src/api/ProductionApi.test.ts @@ -37,8 +37,7 @@ describe('The production Airbrake API', () => { ); const groups = await productionApi.fetchGroups('123456'); - - expect(groups).toEqual(mockGroupsData); + expect(groups).toStrictEqual(mockGroupsData); }); it('throws if fetching groups was unsuccessful', async () => { From ce2e202f3ae6d5b869f552d44d1613afa2da92bb Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 14 Jun 2023 10:27:20 +0200 Subject: [PATCH 12/13] chore: woops Signed-off-by: blam --- yarn.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/yarn.lock b/yarn.lock index ae5cceaa5a..970565aea6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3992,6 +3992,7 @@ __metadata: chalk: ^4.0.0 chokidar: ^3.3.1 commander: ^9.1.0 + cross-fetch: ^3.1.5 cross-spawn: ^7.0.3 css-loader: ^6.5.1 del: ^7.0.0 From 1aad4a99cea332219ee46ba22d1a25f4f6dd968f Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 19 Jun 2023 14:02:53 +0200 Subject: [PATCH 13/13] chore: review comments Signed-off-by: blam --- packages/cli/config/jest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/config/jest.js b/packages/cli/config/jest.js index 1b32f954ef..1756b37db2 100644 --- a/packages/cli/config/jest.js +++ b/packages/cli/config/jest.js @@ -194,11 +194,11 @@ async function getProjectConfig(targetPath, extraConfig) { ...getRoleConfig(closestPkgJson?.backstage?.role), }; - options.setupFilesAfterEnv = []; + options.setupFilesAfterEnv = options.setupFilesAfterEnv || []; if (options.testEnvironment === require.resolve('jest-environment-jsdom')) { // FIXME https://github.com/jsdom/jsdom/issues/1724 - options.setupFilesAfterEnv.push(require.resolve('cross-fetch/polyfill')); + options.setupFilesAfterEnv.unshift(require.resolve('cross-fetch/polyfill')); } // Use src/setupTests.ts as the default location for configuring test env