react/scripts/jest/config.base.js
michael faith 5ccfcd17ff
feat(eslint-plugin-react-hooks): merge rule from eslint-plugin-react-compiler into react-hooks plugin (#32416)
This change merges the `react-compiler` rule from
`eslint-plugin-react-compiler` into the `eslint-plugin-react-hooks`
plugin. In order to do the move in a way that keeps commit history with
the moved files, but also no remove them from their origin until a
future cleanup change can be done, I did the `git mv` first, and then
recreated the files that were moved in their original places, as a
separate commit. Unfortunately GH shows the moved files as new instead
of the ones that are truly new. But in the IDE and `git blame`, commit
history is intact with the moved files.

Since this change adds new dependencies, and one of those dependencies
has a higher `engines` declaration for `node` than what the plugin
currently has, this is technically a breaking change and will have to go
out as part of a major release.

### Related Changes
- https://github.com/facebook/react/pull/32458

---------

Co-authored-by: Lauren Tan <poteto@users.noreply.github.com>
2025-03-12 21:43:06 -04:00

41 lines
1.3 KiB
JavaScript

'use strict';
module.exports = {
globalSetup: require.resolve('./setupGlobal.js'),
modulePathIgnorePatterns: [
'<rootDir>/scripts/rollup/shims/',
'<rootDir>/scripts/bench/',
],
transform: {
'^.+babel-plugin-react-compiler/dist/index.js$': [
'babel-jest',
{
configFile: require.resolve('../../babel.config-react-compiler.js'),
},
],
'^.+\\.ts$': [
'babel-jest',
{configFile: require.resolve('../../babel.config-ts.js')},
],
'.(?!ts$)': require.resolve('./preprocessor.js'),
},
prettierPath: require.resolve('prettier-2'),
setupFiles: [require.resolve('./setupEnvironment.js')],
setupFilesAfterEnv: [require.resolve('./setupTests.js')],
// Only include files directly in __tests__, not in nested folders.
testRegex: '/__tests__/[^/]*(\\.js|\\.coffee|[^d]\\.ts)$',
moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'],
rootDir: process.cwd(),
roots: ['<rootDir>/packages', '<rootDir>/scripts'],
collectCoverageFrom: ['packages/**/*.js'],
fakeTimers: {
enableGlobally: true,
legacyFakeTimers: true,
},
snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')],
testEnvironment: '<rootDir>/scripts/jest/ReactJSDOMEnvironment',
testRunner: 'jest-circus/runner',
};