tests: mocklib: prevent caching modules loaded by mocklib.require()

This is needed to ensure that subsequent wrapped require() calls (re)load
the mock modules instead of reusing the cached real module instances.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich
2022-04-06 21:04:14 +02:00
committed by John Crispin
parent 184226532d
commit 2fb97d5436

View File

@@ -179,6 +179,7 @@ global.mocklib = {
try {
res = require(module);
delete global.modules[module];
}
catch (e) {
ex = e;