test: honor per-invocation Bash overrides

This commit is contained in:
haelyra
2026-08-29 15:11:38 -04:00
parent 2f895a1823
commit 703163275d
+16 -5
View File
@@ -56,13 +56,14 @@ function runBash(
scriptPath,
{ args = [], env = {}, cwd = repoRoot, input = undefined, preservePath = true } = {},
) {
const bash = resolveBashExecutable();
const effectiveEnv = {
...(preservePath ? process.env : {}),
...env,
};
const bash = resolveBashExecutable(effectiveEnv);
return spawnSync(bash, [scriptPath, ...args], {
cwd,
env: {
...(preservePath ? process.env : {}),
...env,
},
env: effectiveEnv,
encoding: 'utf8',
input,
stdio: ['pipe', 'pipe', 'pipe'],
@@ -148,6 +149,16 @@ if (
passed++;
else failed++;
if (
test('shell test runner honors a per-invocation BASH_PATH override', () => {
const missingBash = path.join(os.tmpdir(), 'ecc-missing-bash-executable');
const result = runBash(prePushHook, { env: { BASH_PATH: missingBash } });
assert.strictEqual(result.error?.code, 'ENOENT');
})
)
passed++;
else failed++;
function runHermeticPrePush({
failScript = null,
includeCorepack = true,