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"
haste.providesModuleNodeModules
option
Whitelist the directories you want to test with the 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