fix(testing): recalculate cypress targets when cypress config changes (#20593)
This commit is contained in:
parent
bda1c7d153
commit
0618ba4ee4
@ -263,15 +263,15 @@ function getCypressConfig(
|
||||
if (tsConfigPath) {
|
||||
const unregisterTsProject = registerTsProject(tsConfigPath);
|
||||
try {
|
||||
module = require(resolvedPath);
|
||||
module = load(resolvedPath);
|
||||
} finally {
|
||||
unregisterTsProject();
|
||||
}
|
||||
} else {
|
||||
module = require(resolvedPath);
|
||||
module = load(resolvedPath);
|
||||
}
|
||||
} else {
|
||||
module = require(resolvedPath);
|
||||
module = load(resolvedPath);
|
||||
}
|
||||
return module.default ?? module;
|
||||
}
|
||||
@ -297,3 +297,18 @@ function getInputs(
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the module after ensuring that the require cache is cleared.
|
||||
*/
|
||||
function load(path: string): any {
|
||||
// Clear cache if the path is in the cache
|
||||
if (require.cache[path]) {
|
||||
for (const k of Object.keys(require.cache)) {
|
||||
delete require.cache[k];
|
||||
}
|
||||
}
|
||||
|
||||
// Then require
|
||||
return require(path);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user