Stop publishing jest/preprocessor.js to npm

Summary:
Changelog:
[Breaking][General] Remove jest/preprocessor from the react-native package

Using `react-native/jest/preprocessor` outside of the React Native repo has been deprecated since D34820086 (https://github.com/facebook/react-native/commit/c1e9aa9a272aed3cba60c4aeff783eeb8bffce68). Here, we make this file private and stop publishing it to npm.

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package.

NOTE: We could probably make some of the other files under `jest/` private as well, but we should go through a separate deprecation cycle with those, in case they are also being used externally by some projects. I'm leaving that for future followup at the moment.

Reviewed By: GijsWeterings

Differential Revision: D36132939

fbshipit-source-id: 300ffa6cf16232573cd3a79a34c14daaafd7aa43
This commit is contained in:
Moti Zilberman
2022-05-06 04:43:09 -07:00
committed by Facebook GitHub Bot
parent 9d3d5e13f0
commit 0301cb285b
4 changed files with 5 additions and 44 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ module.exports = {
transform: {
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
'<rootDir>/jest/assetFileTransformer.js',
'.*': './jest/preprocessor_DO_NOT_USE.js',
'.*': './jest/private/preprocessor.js',
},
setupFiles: ['./jest/setup.js'],
timers: 'fake',
-40
View File
@@ -1,40 +0,0 @@
/**
* 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
* @flow
*/
/* eslint-env node */
'use strict';
// NOTE: Avoiding using a package like 'chalk' here, for simplicity
const YELLOW = process.stderr.isTTY ? '\u001b[33m' : '';
const BOLD = process.stderr.isTTY ? '\u001b[1m' : '';
const RESET = process.stderr.isTTY ? '\u001b[0m' : '';
const UNDERLINE = process.stderr.isTTY ? '\u001b[4m' : '';
console.warn(
'\n' +
YELLOW +
BOLD +
'react-native/jest/preprocessor.js' +
RESET +
YELLOW +
' is deprecated and will be removed.\n' +
'Use "preset": "react-native" in your Jest config instead.\n' +
'See ' +
UNDERLINE +
'https://jestjs.io/docs/tutorial-react-native' +
RESET +
YELLOW +
' for more setup instructions.' +
RESET +
'\n',
);
module.exports = require('./preprocessor_DO_NOT_USE');
+4 -3
View File
@@ -14,9 +14,6 @@
"outputName": "js-test-results.xml"
},
"files": [
"!template/node_modules",
"!template/package-lock.json",
"!template/yarn.lock",
"android",
"cli.js",
"flow",
@@ -25,6 +22,7 @@
"interface.js",
"jest-preset.js",
"jest",
"!jest/private",
"Libraries",
"LICENSE",
"local-cli",
@@ -60,6 +58,9 @@
"sdks/hermes-engine.podspec",
"template.config.js",
"template",
"!template/node_modules",
"!template/package-lock.json",
"!template/yarn.lock",
"third-party-podspecs"
],
"scripts": {