test(ci): tolerate loaded macOS hook runners (#2939)

This commit is contained in:
haelyra
2026-09-02 16:37:08 -04:00
committed by GitHub
parent 348f80a89b
commit 90430ab3a7
2 changed files with 11 additions and 5 deletions
@@ -42,6 +42,9 @@ const repoRoot = path.join(__dirname, '..', '..');
const bootstrap = path.join(repoRoot, 'scripts', 'hooks', 'plugin-hook-bootstrap.js');
const { isRawPassthrough } = require(bootstrap);
const FIXTURE_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-pr2380-fixtures-'));
const SUBPROCESS_TIMEOUT_MS = process.platform === 'darwin' && process.env.CI === 'true'
? 120_000
: 30_000;
function cleanupFixtureDir() {
fs.rmSync(FIXTURE_DIR, { recursive: true, force: true });
@@ -67,7 +70,7 @@ function runBootstrap(args, input, env) {
encoding: 'utf8',
cwd: repoRoot,
env: { ...process.env, ...(env || {}) },
timeout: 30000,
timeout: SUBPROCESS_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
stdio: ['pipe', 'pipe', 'pipe']
});
@@ -80,7 +83,7 @@ function runHookEntry(args, input, env) {
encoding: 'utf8',
cwd: repoRoot,
env: { ...process.env, ...(env || {}) },
timeout: 30000,
timeout: SUBPROCESS_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
stdio: ['pipe', 'pipe', 'pipe']
});
+6 -3
View File
@@ -29,6 +29,9 @@ const hooksConfig = JSON.parse(
);
const MAX_STDIN = 1024 * 1024;
const SUBPROCESS_TIMEOUT_MS = process.platform === 'darwin' && process.env.CI === 'true'
? 120_000
: 60_000;
const workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-stop-stdout-')); // non-git cwd
const dataHome = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-stop-data-'));
@@ -75,7 +78,7 @@ function runViaRunner(hookId, script, input) {
encoding: 'utf8',
cwd: workDir,
env: hookEnv(),
timeout: 60000,
timeout: SUBPROCESS_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
stdio: ['pipe', 'pipe', 'pipe']
});
@@ -87,7 +90,7 @@ function runDirect(script, input) {
encoding: 'utf8',
cwd: workDir,
env: hookEnv(),
timeout: 60000,
timeout: SUBPROCESS_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
stdio: ['pipe', 'pipe', 'pipe']
});
@@ -107,7 +110,7 @@ function runRegisteredStopHook(entry, input, envOverrides = {}) {
cwd: workDir,
env,
shell: true,
timeout: 60000,
timeout: SUBPROCESS_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
stdio: ['pipe', 'pipe', 'pipe']
});