From 90430ab3a716e12a9c6770802efa352098735f24 Mon Sep 17 00:00:00 2001 From: haelyra <49814733+haelyra@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:37:08 -0400 Subject: [PATCH] test(ci): tolerate loaded macOS hook runners (#2939) --- tests/hooks/plugin-hook-bootstrap-no-echo.test.js | 7 +++++-- tests/hooks/stop-hooks-stdout.test.js | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/hooks/plugin-hook-bootstrap-no-echo.test.js b/tests/hooks/plugin-hook-bootstrap-no-echo.test.js index e896ec48b..b9bb2ca82 100644 --- a/tests/hooks/plugin-hook-bootstrap-no-echo.test.js +++ b/tests/hooks/plugin-hook-bootstrap-no-echo.test.js @@ -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'] }); diff --git a/tests/hooks/stop-hooks-stdout.test.js b/tests/hooks/stop-hooks-stdout.test.js index 04ef84acd..707f16c2f 100644 --- a/tests/hooks/stop-hooks-stdout.test.js +++ b/tests/hooks/stop-hooks-stdout.test.js @@ -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'] });