diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..c8021801d --- /dev/null +++ b/jest.config.js @@ -0,0 +1,35 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @oncall react_native + */ + +module.exports = function jestConfig() { + /** @type {import('jest').Config} **/ + const config = { + modulePathIgnorePatterns: ['/node_modules/', 'packages/[^/]+/build/'], + snapshotFormat: { + escapeString: true, + printBasicPrototype: true, + }, + testEnvironment: 'node', + testRegex: '/__tests__/.*-test\\.js$', + fakeTimers: { + enableGlobally: true, + legacyFakeTimers: false, + }, + transform: { + '\\.js$': '/scripts/babelJestTransformer.js', + }, + setupFiles: ['/scripts/setupJest.js'], + watchPlugins: [ + 'jest-watch-typeahead/filename', + 'jest-watch-typeahead/testname', + ], + }; + return config; +}; diff --git a/package.json b/package.json index 33266f5df..025013c77 100644 --- a/package.json +++ b/package.json @@ -65,32 +65,6 @@ "workspaces": [ "packages/*" ], - "jest": { - "modulePathIgnorePatterns": [ - "/node_modules/", - "packages/[^/]+/build/" - ], - "snapshotFormat": { - "escapeString": true, - "printBasicPrototype": true - }, - "testEnvironment": "node", - "testRegex": "/__tests__/.*-test\\.js$", - "fakeTimers": { - "enableGlobally": true, - "legacyFakeTimers": false - }, - "transform": { - "\\.js$": "/scripts/babelJestTransformer.js" - }, - "setupFiles": [ - "/scripts/setupJest.js" - ], - "watchPlugins": [ - "jest-watch-typeahead/filename", - "jest-watch-typeahead/testname" - ] - }, "license": "MIT", "dependencies": {}, "engines": {