Last active
August 9, 2019 23:37
-
-
Save Js-Brecht/84ad06ac851af23ea84829fac4dd4fe2 to your computer and use it in GitHub Desktop.
Pulling @craco/craco merged config for jest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const reactScriptsPath = path.resolve(path.join('node_modules', 'react-scripts')); | |
const craPaths = require('react-scripts/config/paths'); | |
const { overrideJest } = require("@craco/craco/lib/features/test/jest"); | |
const { loadCracoConfig } = require("@craco/craco/lib/config"); | |
const { getCraPaths } = require("@craco/craco/lib/cra"); | |
const { removeJestConflictingCustomArgs } = require("@craco/craco/lib/args"); | |
const context = { | |
env: process.env.NODE_ENV, | |
}; | |
const cracoConfig = loadCracoConfig(context); | |
context.paths = getCraPaths(cracoConfig); | |
overrideJest(cracoConfig, context); | |
removeJestConflictingCustomArgs(); | |
const createJestConfig = require('react-scripts/scripts/utils/createJestConfig.js'); | |
const config = createJestConfig( | |
(relativePath) => path.resolve(reactScriptsPath, relativePath), | |
path.resolve(craPaths.appSrc, ".."), | |
false | |
); | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment