mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-28 09:25:42 +08:00
Update to Jest 24 (#6278)
* Update to jest 24 * Add notice about pnpResolver.js * Formatting * Fix linting * Update to jest 24.1.0 * Update jest-pnp-resolver * Swap create-react-app params in e2e scripts * Add extraGlobals to supportedKeys * Bump jest to 24.3.1 * Bump jest to 24.4.0 * Bumb jest to 24.5.0 * Update template dependencies jest to 24.5.0 * Debug failing test * Remove jest-pnp-resolver * Remove console.log * Revert yarn.lock.cached
This commit is contained in:
committed by
Ian Sutherland
parent
eee8491d57
commit
3be3576304
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"bootstrap": "4.1.1",
|
||||
"jest": "23.6.0",
|
||||
"jest": "24.5.0",
|
||||
"node-sass": "4.8.3",
|
||||
"normalize.css": "7.0.0",
|
||||
"prop-types": "15.5.6",
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@typescript-eslint/parser": "1.4.1",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "10.0.1",
|
||||
"babel-jest": "23.6.0",
|
||||
"babel-jest": "24.5.0",
|
||||
"babel-loader": "8.0.5",
|
||||
"babel-plugin-named-asset-import": "^0.3.1",
|
||||
"babel-preset-react-app": "^7.0.2",
|
||||
@@ -51,9 +51,8 @@
|
||||
"fs-extra": "7.0.1",
|
||||
"html-webpack-plugin": "4.0.0-beta.5",
|
||||
"identity-obj-proxy": "3.0.0",
|
||||
"jest": "23.6.0",
|
||||
"jest-pnp-resolver": "1.0.2",
|
||||
"jest-resolve": "23.6.0",
|
||||
"jest": "24.5.0",
|
||||
"jest-resolve": "24.5.0",
|
||||
"jest-watch-typeahead": "^0.2.1",
|
||||
"mini-css-extract-plugin": "0.5.0",
|
||||
"optimize-css-assets-webpack-plugin": "5.0.1",
|
||||
|
||||
@@ -24,20 +24,13 @@ module.exports = (resolve, rootDir, isEjecting) => {
|
||||
const config = {
|
||||
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'],
|
||||
|
||||
// TODO: this breaks Yarn PnP on eject.
|
||||
// But we can't simply emit this because it'll be an absolute path.
|
||||
// The proper fix is to write jest.config.js on eject instead of a package.json key.
|
||||
// Then these can always stay as require.resolve()s.
|
||||
resolver: isEjecting
|
||||
? 'jest-pnp-resolver'
|
||||
: require.resolve('jest-pnp-resolver'),
|
||||
setupFiles: [
|
||||
isEjecting
|
||||
? 'react-app-polyfill/jsdom'
|
||||
: require.resolve('react-app-polyfill/jsdom'),
|
||||
],
|
||||
|
||||
setupTestFrameworkScriptFile: setupTestsFile,
|
||||
setupFilesAfterEnv: setupTestsFile ? [setupTestsFile] : [],
|
||||
testMatch: [
|
||||
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
|
||||
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}',
|
||||
@@ -77,6 +70,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
|
||||
'collectCoverageFrom',
|
||||
'coverageReporters',
|
||||
'coverageThreshold',
|
||||
'extraGlobals',
|
||||
'globalSetup',
|
||||
'globalTeardown',
|
||||
'resetMocks',
|
||||
@@ -94,13 +88,13 @@ module.exports = (resolve, rootDir, isEjecting) => {
|
||||
const unsupportedKeys = Object.keys(overrides);
|
||||
if (unsupportedKeys.length) {
|
||||
const isOverridingSetupFile =
|
||||
unsupportedKeys.indexOf('setupTestFrameworkScriptFile') > -1;
|
||||
unsupportedKeys.indexOf('setupFilesAfterEnv') > -1;
|
||||
|
||||
if (isOverridingSetupFile) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
'We detected ' +
|
||||
chalk.bold('setupTestFrameworkScriptFile') +
|
||||
chalk.bold('setupFilesAfterEnv') +
|
||||
' in your package.json.\n\n' +
|
||||
'Remove it from Jest configuration, and put the initialization code in ' +
|
||||
chalk.bold('src/setupTests.js') +
|
||||
|
||||
Reference in New Issue
Block a user