From 80e893b7ee2a295277345df2f7267d8872e49bc8 Mon Sep 17 00:00:00 2001 From: Taylor Mullen Date: Wed, 11 Feb 2026 00:22:21 -0800 Subject: [PATCH] repro: use node -e for failing tests and fix setup order --- integration-tests/hooks-system.test.ts | 49 +++++++++----------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/integration-tests/hooks-system.test.ts b/integration-tests/hooks-system.test.ts index cc8eb9ca76..8e2d10fb30 100644 --- a/integration-tests/hooks-system.test.ts +++ b/integration-tests/hooks-system.test.ts @@ -517,7 +517,7 @@ console.log(JSON.stringify({ }); describe('BeforeToolSelection Hooks - Tool Configuration', () => { - it.only('should modify tool selection with BeforeToolSelection hooks', async () => { + it('should modify tool selection with BeforeToolSelection hooks', async () => { // 1. Initial setup to establish test directory rig.setup('should modify tool selection with BeforeToolSelection hooks'); @@ -531,11 +531,8 @@ console.log(JSON.stringify({ }, }); - // Use simple echo to avoid node-pty instability in CI - const echoCmd = - process.platform === 'win32' - ? `powershell -NoProfile -Command "echo '${toolConfigJson.replace(/"/g, '\"')}'"` - : `echo '${toolConfigJson}'`; + // Use node -e to avoid file system and PTY overhead + const nodeCmd = `node -e "console.log(JSON.stringify(${toolConfigJson.replace(/"/g, '\\"')}))"`; rig.setup('should modify tool selection with BeforeToolSelection hooks', { fakeResponsesPath: join( @@ -551,8 +548,8 @@ console.log(JSON.stringify({ hooks: [ { type: 'command', - command: echoCmd, - timeout: 5000, + command: nodeCmd, + timeout: 15000, }, ], }, @@ -1765,7 +1762,7 @@ console.log(JSON.stringify({ }); describe('Hook Disabling', () => { - it.only('should not execute hooks disabled in settings file', async () => { + it('should not execute hooks disabled in settings file', async () => { // 1. Initial setup to establish test directory rig.setup('should not execute hooks disabled in settings file'); @@ -1781,15 +1778,9 @@ console.log(JSON.stringify({ reason: disabledMsg, }); - const enabledCmd = - process.platform === 'win32' - ? `powershell -NoProfile -Command "echo '${enabledJson.replace(/"/g, '\"')}'"` - : `echo '${enabledJson}'`; - - const disabledCmd = - process.platform === 'win32' - ? `powershell -NoProfile -Command "echo '${disabledJson.replace(/"/g, '\"')}'"` - : `echo '${disabledJson}'`; + // Use node -e to avoid file system and PTY overhead + const enabledCmd = `node -e "console.log(JSON.stringify(${enabledJson.replace(/"/g, '\\"')}))"`; + const disabledCmd = `node -e "console.log(JSON.stringify(${disabledJson.replace(/"/g, '\\"')}))"`; // 3. Final setup with full settings rig.setup('should not execute hooks disabled in settings file', { @@ -1807,12 +1798,12 @@ console.log(JSON.stringify({ { type: 'command', command: enabledCmd, - timeout: 5000, + timeout: 15000, }, { type: 'command', command: disabledCmd, - timeout: 5000, + timeout: 15000, }, ], }, @@ -1842,7 +1833,7 @@ console.log(JSON.stringify({ expect(disabledHookLog).toBeUndefined(); }); - it.only('should respect disabled hooks across multiple operations', async () => { + it('should respect disabled hooks across multiple operations', async () => { // 1. Initial setup to establish test directory rig.setup('should respect disabled hooks across multiple operations'); @@ -1858,15 +1849,9 @@ console.log(JSON.stringify({ reason: disabledMsg, }); - const activeCmd = - process.platform === 'win32' - ? `powershell -NoProfile -Command "echo '${activeJson.replace(/"/g, '\"')}'"` - : `echo '${activeJson}'`; - - const disabledCmd = - process.platform === 'win32' - ? `powershell -NoProfile -Command "echo '${disabledJson.replace(/"/g, '\"')}'"` - : `echo '${disabledJson}'`; + // Use node -e to avoid file system and PTY overhead + const activeCmd = `node -e "console.log(JSON.stringify(${activeJson.replace(/"/g, '\\"')}))"`; + const disabledCmd = `node -e "console.log(JSON.stringify(${disabledJson.replace(/"/g, '\\"')}))"`; // 3. Final setup with full settings rig.setup('should respect disabled hooks across multiple operations', { @@ -1880,12 +1865,12 @@ console.log(JSON.stringify({ { type: 'command', command: activeCmd, - timeout: 5000, + timeout: 15000, }, { type: 'command', command: disabledCmd, - timeout: 5000, + timeout: 15000, }, ], },