Skip to content

Enhance Jest config error for setupTestFrameworkScriptFile #3512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change the order of Jest config errors.
  • Loading branch information
jackfranklin committed Jan 11, 2018
commit a308764370015c821d598df11c61e7434b4b1e03
9 changes: 5 additions & 4 deletions packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ module.exports = (resolve, rootDir, isEjecting) => {
unsupportedKeys.indexOf('setupTestFrameworkScriptFile') >= -1;

const setupFileError = isOverridingSetupFile
? '\nTo add a setupTestFrameworkScriptFile, create the file in ' +
? 'We detected `setupTestFrameworkScriptFile` in your package.json.\n' +
'To add a setupTestFrameworkScriptFile, create the file in ' +
chalk.bold('src/setupTests.js') +
' and create-react-app will automatically load it for you.\n'
: '';

console.error(
chalk.red(
'Out of the box, Create React App only supports overriding ' +
setupFileError +
'\nOut of the box, Create React App only supports overriding ' +
'these Jest options:\n\n' +
supportedKeys.map(key => chalk.bold(' \u2022 ' + key)).join('\n') +
'.\n\n' +
Expand All @@ -97,8 +99,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
chalk.bold('npm run eject') +
' but remember that this is a one-way operation. ' +
'You may also file an issue with Create React App to discuss ' +
'supporting more options out of the box.\n' +
setupFileError
'supporting more options out of the box.\n'
)
);
process.exit(1);
Expand Down