From 9e47dd0356d99672daec93fe8654a05e4a91402d Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Wed, 16 Nov 2022 15:01:17 +0100 Subject: [PATCH] Chore: Polyfill core-js/array/at for frontend tests --- package.json | 1 + packages/admin-test-utils/lib/setup/test-bundler.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 76851e01c0..54a78f0bc6 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "babel-eslint": "10.1.0", "chalk": "4.1.2", "chokidar": "3.5.3", + "core-js": "3.26.1", "cross-env": "7.0.3", "dotenv": "14.2.0", "eslint": "8.27.0", diff --git a/packages/admin-test-utils/lib/setup/test-bundler.js b/packages/admin-test-utils/lib/setup/test-bundler.js index 6470e5a794..6062f9fb6b 100644 --- a/packages/admin-test-utils/lib/setup/test-bundler.js +++ b/packages/admin-test-utils/lib/setup/test-bundler.js @@ -1,5 +1,11 @@ 'use strict'; +// See https://github.com/swc-project/swc/issues/6460 +// SWC is not able to include the core-js polyfill for +// array/at automatically at the moment of writing, which +// makes some frontend tests fail on node@14. +require('core-js/actual/array/at'); + const noop = () => {}; // eslint-disable-next-line no-undef Object.defineProperty(window, 'scrollTo', { value: noop, writable: true });