Here is my package.json:
"jest": {
"cacheDirectory": "/tmp/jestCache",
"scriptPreprocessor": "node_modules/babel-jest",
"modulePaths": [
"<rootDir>/app/static/react/"
],
"moduleDirectories": [
"node_modules",
"app/static/react/app"
],
"testPathDirs": [
"app/static/react/__tests__"
],
"testRegex": "(.*Tests?\\.jsx?)$"
}
When I run jest --verbose, the tests run, but there is no way to communicate anything to stdout as far as I can tell except by throwing an error. console.log itself does not exist. I am using jest 16.0.2. I've read that there are some recent changes around automocking and console buffering, but it seems like I'm missing something more fundamental.
The tests otherwise run fine.
Working on OSX Yosemite, node 7.4, npm 4.0.5.
I feel like you have too much configuration which is overwriting the defaults. One of the reasons that jest is awesome is that it works out of the box. First I would update to the latest version of jest 18.0.1 and babel-jest 17.0.2, and then I would try with the default configuration.
jest: {
},
Since you are using babel-jest you do not have to specify it in the config at all. Jest will just pick it up. Make sure you have a .babelrc in the same level as package.json though.
testPathDirs and testRegex default to ["<rootDir>"] and (/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$ so I think you do not need that too. Also moduleDirectories defaults to ["node_modules"] so you should be ok with this too.
Something else that I would definitely change is the path to your source. app/static/react/app seems a bit weird to me(I am not sure if jest gets confused because of react being inside your path). Something like app/static/src/ would make more sense. Also I would move the tests to app/static/src/__tests__/.
I know this answer might sound too generic but I would definitely start with not overriding the default config.