- Environment must be set before preloading and executing modules
- Caching of fs module must be inhibited
- Mocklib class object should be returned
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
local code=$7
local fail=0
- ucode -m mocklib -m fw4 ${uenv:+-e "$uenv"} -e '{
+ ucode ${uenv:+-e "$uenv"} -e '{
"MOCK_SEARCH_PATH": [
"'"$dir"'/files",
"./tests/mocks"
]
- }' ${env:+-e "$(cat "$env")"} -i - <"$in" >"$dir/res.out" 2>"$dir/res.err"
+ }' ${env:+-e "$(cat "$env")"} -m mocklib -m fw4 -i - <"$in" >"$dir/res.out" 2>"$dir/res.err"
printf "%d\n" $? > "$dir/res.code"
{%
let _fs = require("fs");
+ /* Force reloading fs module on next require */
+ delete global.modules.fs;
+
let _log = (level, fmt, ...args) => {
let color, prefix;
global.print(...args);
};
+ return global.mocklib;
+