mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
chore: upgrade to jest 24 (#15778)
* chore: upgrade to jest 24 * download react-is from npm manually
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = {
|
||||
'.*': require.resolve('./preprocessor.js'),
|
||||
},
|
||||
setupFiles: [require.resolve('./setupEnvironment.js')],
|
||||
setupTestFrameworkScriptFile: require.resolve('./setupTests.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'],
|
||||
|
||||
@@ -60,8 +60,9 @@ module.exports = Object.assign({}, baseConfig, {
|
||||
'../../packages/react-devtools-shared/src/__tests__/setupEnv.js'
|
||||
),
|
||||
],
|
||||
// TODO (Jest v24) Rename "setupFilesAfterEnv" after Jest upgrade
|
||||
setupTestFrameworkScriptFile: require.resolve(
|
||||
'../../packages/react-devtools-shared/src/__tests__/setupTests.js'
|
||||
),
|
||||
setupFilesAfterEnv: [
|
||||
require.resolve(
|
||||
'../../packages/react-devtools-shared/src/__tests__/setupTests.js'
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -62,6 +62,9 @@ module.exports = {
|
||||
if (filePath.match(/\.ts$/) && !filePath.match(/\.d\.ts$/)) {
|
||||
return tsPreprocessor.compile(src, filePath);
|
||||
}
|
||||
if (filePath.match(/\.json$/)) {
|
||||
return src;
|
||||
}
|
||||
if (!filePath.match(/\/third_party\//)) {
|
||||
// for test files, we also apply the async-await transform, but we want to
|
||||
// make sure we don't accidentally apply that transform to product code.
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const pacote = require('pacote');
|
||||
const rimraf = require('rimraf');
|
||||
const prettyFormatPkg = require('pretty-format/package.json');
|
||||
const prettyFormatPkgPath = require.resolve('pretty-format/package.json');
|
||||
|
||||
const reactIsDependencyVersion = prettyFormatPkg.dependencies['react-is'];
|
||||
|
||||
if (!reactIsDependencyVersion) {
|
||||
throw new Error('Unable to find `react-is` dependency in `pretty-format`');
|
||||
}
|
||||
|
||||
const prettyFormatNodeModulesReactIsDir = path.join(
|
||||
path.dirname(prettyFormatPkgPath),
|
||||
'node_modules/react-is'
|
||||
);
|
||||
|
||||
rimraf.sync(prettyFormatNodeModulesReactIsDir);
|
||||
|
||||
pacote
|
||||
.extract(
|
||||
`react-is@${reactIsDependencyVersion}`,
|
||||
prettyFormatNodeModulesReactIsDir
|
||||
)
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Reference in New Issue
Block a user