Files
react/scripts/jest/setupEnvironment.js
Jan Kassens 6b30832666 Upgrade prettier (#26081)
The old version of prettier we were using didn't support the Flow syntax
to access properties in a type using `SomeType['prop']`. This updates
`prettier` and `rollup-plugin-prettier` to the latest versions.

I added the prettier config `arrowParens: "avoid"` to reduce the diff
size as the default has changed in Prettier 2.0. The largest amount of
changes comes from function expressions now having a space. This doesn't
have an option to preserve the old behavior, so we have to update this.
2023-01-31 08:25:05 -05:00

39 lines
1.0 KiB
JavaScript

/* eslint-disable */
const NODE_ENV = process.env.NODE_ENV;
if (NODE_ENV !== 'development' && NODE_ENV !== 'production') {
throw new Error('NODE_ENV must either be set to development or production.');
}
global.__DEV__ = NODE_ENV === 'development';
global.__EXTENSION__ = false;
global.__TEST__ = NODE_ENV === 'test';
global.__PROFILE__ = NODE_ENV === 'development';
global.__UMD__ = false;
const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
// Default to running tests in experimental mode. If the release channel is
// set via an environment variable, then check if it's "experimental".
global.__EXPERIMENTAL__ =
typeof RELEASE_CHANNEL === 'string'
? RELEASE_CHANNEL === 'experimental'
: true;
global.__VARIANT__ = !!process.env.VARIANT;
if (typeof window !== 'undefined') {
global.requestIdleCallback = function (callback) {
return setTimeout(() => {
callback({
timeRemaining() {
return Infinity;
},
});
});
};
global.cancelIdleCallback = function (callbackID) {
clearTimeout(callbackID);
};
}