Chore: Polyfill core-js/array/at for frontend tests

This commit is contained in:
Gustav Hansen 2022-11-16 15:01:17 +01:00
parent a9613ef178
commit 9e47dd0356
2 changed files with 7 additions and 0 deletions

View File

@ -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",

View File

@ -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 });