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

Enable src/node_modules

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/modernserf/jest-config-src-node_modules into master Nov 21, 2016
  • Overview 22
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: modernserf

[HOLD] not particularly useful without changes in Jest

Partially fixes https://github.com/facebookincubator/create-react-app/issues/607

These are the necessary changes in react-scripts to allow code to live in src/node_modules and allow Jest to run tests in that directory.

However, Jest cannot find these tests on its own -- all files in any node_modules are filtered out even before the file matching patterns are applied. See issue https://github.com/facebook/jest/issues/2145.

Without changes in Jest, there are a few workarounds:

Import the package tests into a file that jest can find

// src/node_modules/Foo/Foo.test.js
it("does a thing", ()=> {
  expect(true).toBe(true)
})
// src/index.js
import "Foo/Foo.test.js"

Whitelist the directories you want to test with the haste.providesModuleNodeModules option

This is not the intended use for this option, but its used as a whitelist for the haste module resolution, and therefore Jest can find tests in these directories.

TODO

  • get related issue in facebook/jest resolved
  • figure out how to test this
  • rebase, clean up etc
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/modernserf/jest-config-src-node_modules