mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
Update custom "exports" conditions in Jest environment
Summary: Updates the default set of `"exports"` condition names in our `ReactNativeEnv` for Jest, so that it aligns with the defaults in React Native CLI (https://github.com/react-native-community/cli/pull/1862). Also includes a subtle update to how this is accomplished. Instead of overriding `exportConditions()`, we assign to the underlying class property — this allows users (once https://github.com/facebook/jest/pull/13989 is merged) to override `customExportConditions` via [`testEnvironmentOptions`](https://jestjs.io/docs/configuration#testenvironmentoptions-object). ```js preset: 'react-native', testEnvironmentOptions: { customExportConditions: ['test', 'react-native'], }, ``` Changelog: [Internal] Reviewed By: jacdebug Differential Revision: D43879056 fbshipit-source-id: 86fffe2b5fdf9d8492d25b8b12a78be75b5fa3be
This commit is contained in:
parent
b1b6673796
commit
0a3c55562b
4
jest/react-native-env.js
vendored
4
jest/react-native-env.js
vendored
@ -12,7 +12,5 @@
|
||||
const NodeEnv = require('jest-environment-node').TestEnvironment;
|
||||
|
||||
module.exports = class ReactNativeEnv extends NodeEnv {
|
||||
exportConditions() {
|
||||
return ['react-native'];
|
||||
}
|
||||
customExportConditions = ['import', 'require', 'react-native'];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user