From b34bde2a91472d295dba04fe7fe7ad252e582cd9 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 10 Nov 2022 06:21:53 -0800 Subject: [PATCH] fix(jest-env): pass `exportConditions` (#35203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Like discussed in https://github.com/react-native-community/discussions-and-proposals/issues/509, RN should override the default `node` and `node-addons` conditions. You might consider supporting (or just setting) [`customExportConditions`](https://github.com/facebook/jest/blob/4670d3be0d80d47844673eb163666253e788f006/packages/jest-environment-node/src/index.ts#L187-L189) instead, but the default of the node env should be overwritten 🙂 ## Changelog [General] [Changed] - use `'react-native'` export conditions in Jest environment Pull Request resolved: https://github.com/facebook/react-native/pull/35203 Test Plan: Green CI? Reviewed By: lunaleaps Differential Revision: D41081783 Pulled By: jacdebug fbshipit-source-id: 844c70d92a58c5432ba5b9e5e99c8f50045ef8ac --- jest/react-native-env.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jest/react-native-env.js b/jest/react-native-env.js index b45ac255d9c202..624d3648766c33 100644 --- a/jest/react-native-env.js +++ b/jest/react-native-env.js @@ -12,5 +12,7 @@ const NodeEnv = require('jest-environment-node').TestEnvironment; module.exports = class ReactNativeEnv extends NodeEnv { - // this is where we'll add our custom logic + exportConditions() { + return ['react-native']; + } };