mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-11 20:27:58 +02:00
test: honor per-invocation Bash overrides
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user