From f7acd6f8a9cbbc7fbb9e946f31a52edc50fa4f1c Mon Sep 17 00:00:00 2001 From: William Wong Date: Wed, 6 Dec 2023 15:43:03 -0800 Subject: [PATCH] Add mutable performance --- .github/workflows/pull-request-validation.yml | 2 +- __tests__/setup/setupMutablePerformance.js | 3 +++ jest.config.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 __tests__/setup/setupMutablePerformance.js diff --git a/.github/workflows/pull-request-validation.yml b/.github/workflows/pull-request-validation.yml index fc7e1b811a..47ce126db7 100644 --- a/.github/workflows/pull-request-validation.yml +++ b/.github/workflows/pull-request-validation.yml @@ -22,7 +22,7 @@ defaults: env: CI_PULL_REQUEST: 1 # Skip nightly tests NODE_ENV: test # Add instrumentation code - node-version: 18.x + node-version: 20.x skip-secure-feed: false jobs: diff --git a/__tests__/setup/setupMutablePerformance.js b/__tests__/setup/setupMutablePerformance.js new file mode 100644 index 0000000000..b7783a3067 --- /dev/null +++ b/__tests__/setup/setupMutablePerformance.js @@ -0,0 +1,3 @@ +// HACK: Before we bump to jest@29, the performance object is marked as readonly in Node.js 20 and some latter versions of Node.js 18. +// Similar to https://github.com/facebook/react-native/issues/35701. +global.performance = { ...global.performance }; diff --git a/jest.config.js b/jest.config.js index 7441abd785..892f1d3389 100644 --- a/jest.config.js +++ b/jest.config.js @@ -90,7 +90,8 @@ module.exports = { '/__tests__/setup/setupCryptoGetRandomValues.js', '/__tests__/setup/setupImageSnapshot.js', '/__tests__/setup/setupTestNightly.js', - '/__tests__/setup/setupTimeout.js' + '/__tests__/setup/setupTimeout.js', + '/__tests__/setup/setupMutablePerformance.js' ], testPathIgnorePatterns: [ '/lib/',