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
  • !355

Allow projects to customize Jest configs. Fixes #338.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/cpojer/master into master Aug 04, 2016
  • Overview 8
  • Commits 1
  • Pipelines 0
  • Changes 8

Created by: cpojer

This changes create-jest-config to take in the app's configuration so that people can decide to overwrite the defaults if they like.

I recommend people to use the node environment and not bother with jsdom, however people might have existing code that accesses DOM APIs. In such cases people can put

"jest": {
  "testEnvironment": "jest-environment-jsdom"
}

into their config and npm run test will merge the default config and the app config together. If someone decides to eject, the custom config will be kept in-tact when we write the default config into package.json.

I was unsure how to test my changes to test/eject so I figured I'll add a Jest test to scripts which can be invoked using npm run test-scripts. I used a snapshot test to lock in the Jest config and validated that it is correct. I also enjoy how meta it is to use snapshots in Jest to test a feature for Jest integration into a project that is promoting snapshot testing. Anyway, people can now write tests for stuff in scripts/ to make sure we don't regress.

Fixes #338 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/cpojer/master