Skip to content
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

feat(Jest): support overriding config #2197

Merged
merged 15 commits into from
May 13, 2020
Merged

feat(Jest): support overriding config #2197

merged 15 commits into from
May 13, 2020

Conversation

nicojs
Copy link
Member

@nicojs nicojs commented May 13, 2020

  • Adds support for overriding config in your package.json/jest.config.js and/or react-scripts node_modules.
  • Added config setting jest.configFile to specify a path to your config file. This file will be loaded using require
  • The jest.config setting now works together with jest.configFile to allow you to override the config in your configFile

Fixes #2155

@@ -18,10 +19,7 @@ export default class ReactScriptsTSJestConfigLoader implements JestConfigLoader

// Create the React configuration for Jest
const jestConfiguration = this.createJestConfig(reactScriptsTsLocation);

// Set test environment to jsdom (otherwise Jest won't run)
jestConfiguration.testEnvironment = 'jsdom';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simondel this made the test succeed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it turns out react-scripts does use 'jsdom' as a default (facebook/create-react-app#5074) but react-scripts-ts was forked before that change was made and it hasn't really been updated for two years...

@nicojs nicojs marked this pull request as ready for review May 13, 2020 10:52
@simondel simondel changed the title 2155 jest custom params feat(Jest): support overriding config May 13, 2020
@nicojs nicojs merged commit d37b7d7 into master May 13, 2020
@nicojs nicojs deleted the 2155-jest-custom-params branch May 13, 2020 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest custom params
2 participants