mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Silence jest warnings about mutating require cache
This commit is contained in:
parent
7ce188ef70
commit
5b18ef475a
11
src/index.js
11
src/index.js
@ -49,10 +49,13 @@ const getConfigFunction = config => () => {
|
||||
return resolveConfig([defaultConfig])
|
||||
}
|
||||
|
||||
if (!_.isObject(config)) {
|
||||
getModuleDependencies(config).forEach(mdl => {
|
||||
delete require.cache[require.resolve(mdl.file)]
|
||||
})
|
||||
// Skip this if Jest is running: https://github.com/facebook/jest/pull/9841#issuecomment-621417584
|
||||
if (process.env.JEST_WORKER_ID === undefined) {
|
||||
if (!_.isObject(config)) {
|
||||
getModuleDependencies(config).forEach(mdl => {
|
||||
delete require.cache[require.resolve(mdl.file)]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const configObject = _.isObject(config) ? _.get(config, 'config', config) : require(config)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user