Skip to content

Commit 0376aa4

Browse files
SimenBfacebook-github-bot
authored andcommitted
fix(jest-env): pass exportConditions (#35203)
Summary: Like discussed in react-native-community/discussions-and-proposals#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 <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - use `'react-native'` export conditions in Jest environment Pull Request resolved: #35203 Test Plan: Green CI? Reviewed By: lunaleaps Differential Revision: D41081783 Pulled By: jacdebug fbshipit-source-id: 844c70d92a58c5432ba5b9e5e99c8f50045ef8ac
1 parent 3d9a3b7 commit 0376aa4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jest/react-native-env.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
const NodeEnv = require('jest-environment-node').TestEnvironment;
1313

1414
module.exports = class ReactNativeEnv extends NodeEnv {
15-
// this is where we'll add our custom logic
15+
exportConditions() {
16+
return ['react-native'];
17+
}
1618
};

0 commit comments

Comments
 (0)