mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Fix tests
This commit is contained in:
parent
57bbb06f39
commit
a438175e8a
4 changed files with 16 additions and 14 deletions
|
|
@ -69,8 +69,7 @@ function pip3() {
|
|||
wrapSafeChainCommand "pip3" "aikido-pip3" "$@"
|
||||
}
|
||||
|
||||
# Intercept `python -m pip[...]` so it routes through safe-chain without changing python itself.
|
||||
# Supports: `python -m pip`, `python -m pip3`, `python3 -m pip`, `python3 -m pip3`.
|
||||
# `python -m pip`, `python -m pip3`.
|
||||
function python() {
|
||||
if [[ "$1" == "-m" && "$2" == pip* ]]; then
|
||||
local mod="$2"
|
||||
|
|
@ -85,6 +84,7 @@ function python() {
|
|||
fi
|
||||
}
|
||||
|
||||
# `python3 -m pip`, `python3 -m pip3'.
|
||||
function python3() {
|
||||
if [[ "$1" == "-m" && "$2" == pip* ]]; then
|
||||
local mod="$2"
|
||||
|
|
|
|||
|
|
@ -245,6 +245,15 @@ describe("safeSpawnPy", () => {
|
|||
};
|
||||
return obj;
|
||||
},
|
||||
// Provide execSync so the module under test can import it without ESM errors.
|
||||
// We don't actually execute it in safeSpawnPy flows, but Node's module loader
|
||||
// validates the presence of the named export during import.
|
||||
execSync: (cmd) => {
|
||||
// Minimal stub: emulate `command -v <cmd>` returning a path
|
||||
const match = /command -v (.*)/.exec(String(cmd) || "");
|
||||
const bin = match?.[1] || "mockbin";
|
||||
return `/usr/bin/${bin}\n`;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue