diff --git a/tests/utils.js b/tests/utils.js index 4e5dd03..6d85e3a 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -1,14 +1,14 @@ import path from 'path'; import { entry } from './constants'; -export function load(relPath) { +export function load(relPath, clearCache) { const absPath = path.resolve(entry, relPath); - delete require.cache[require.resolve(absPath)]; + if (clearCache) delete require.cache[require.resolve(absPath)]; // eslint-disable-next-line security/detect-non-literal-require const result = require(absPath); - delete require.cache[require.resolve(absPath)]; + if (clearCache) delete require.cache[require.resolve(absPath)]; return result; }