Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !6055

Support for graceful extension of Jest config

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jamesmfriedman/patch-1 into master Dec 17, 2018
  • Overview 20
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: jamesmfriedman

This PR fixes what I believe to be a very necessary fix for Jest configuration. https://github.com/facebook/create-react-app/issues/6042

What it does

  • It adds 3 new keys to the allowedOverrides config
  • It gracefully extends any jest config option that is an object while leaving arrays and primitive types to override
  • Gracefully extending the objects made the most sense because it allows the original pieces to keep working as expected while give you the ability to fix things that would render the test framework useless for a project

We need to be able to update these keys for the following reasons

  • moduleNameMapper: I've worked on many many jobs and projects and have yet to find one that didn't take advantage of aliasing in someway. If a project is using aliasing (despite CRAs efforts to continue to block it?) it renders the test framework useless.
  • transform: adding any additional file types or loaders to a project will render this broken. Specifically here, I know people need to use jest-transform-graphql
  • transformIgnorePatterns: This is really the reason this PR was created in the first place, the above two items were just logical additions... If someone distributes ES6 / ESNext code and you are using it in your project, you can no longer use Jest. While we can promote in a perfect world that everyone ships ES5 code, first class browser support for ES6 is making this less true. Also, some codebases intentionally use ES6 code since it results in smaller end user bundles. Lastly, The dev / build system supports this while Jest does not!

My current Jest key in package.json image

Config before change, lacking my additions image

Config after this PR :) image

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jamesmfriedman/patch-1