diff --git a/packages/bruno-js/src/runtime/script-runtime.js b/packages/bruno-js/src/runtime/script-runtime.js index 8df51d793..a913462f8 100644 --- a/packages/bruno-js/src/runtime/script-runtime.js +++ b/packages/bruno-js/src/runtime/script-runtime.js @@ -144,6 +144,11 @@ class ScriptRuntime { const res = new BrunoResponse(response); const allowScriptFilesystemAccess = get(scriptingConfig, 'filesystemAccess.allow', false); const moduleWhitelist = get(scriptingConfig, 'moduleWhitelist', []); + const additionalContextRoots = get(scriptingConfig, 'additionalContextRoots', []); + const additionalContextRootsAbsolute = lodash + .chain(additionalContextRoots) + .map((acr) => (acr.startsWith('/') ? acr : path.join(collectionPath, acr))) + .value(); const whitelistedModules = {}; @@ -181,7 +186,7 @@ class ScriptRuntime { require: { context: 'sandbox', external: true, - root: [collectionPath], + root: [collectionPath, ...additionalContextRootsAbsolute], mock: { // node libs path,