From 7bb4b90d1dfdd0780654fec57aec272bd4a41d2a Mon Sep 17 00:00:00 2001 From: Johannes Klein Agents Date: Tue, 24 Nov 2026 11:42:39 +0100 Subject: [PATCH] Fix unit tests that fail on Windows CI The test bridge's host followed the machine running the tests, so on Windows the store loaded the .exe binary list while the store tests expect raxml-ng and raxmlHPC. Pin the default test host off Windows; host.test.ts still covers the Windows list. runProcess goes through cmd.exe on Windows, which strips the quotes from the stand-in node -e script, so node exited 1 with a syntax error. Pass the printed line through the environment and keep the script free of quotes and spaces. Co-Authored-By: Claude Opus 5.5 --- src/main/processHelpers.test.ts | 18 +++++++++++------- src/test/setup.ts | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/processHelpers.test.ts b/src/main/processHelpers.test.ts index 4f59c6bf..e3238f9b 100644 --- a/src/main/processHelpers.test.ts +++ b/src/main/processHelpers.test.ts @@ -41,13 +41,17 @@ it( 'send skips a destroyed window instead of throwing', () => { } ); // A stand-in binary: node prints the fatal line, then exits with RAxML's failure code. -const failWith = ( line: string ) => runProcess( - 'test', - eventWith( false ).event, - path.dirname( process.execPath ), - path.basename( process.execPath ), - ['-e', `process.stdout.write(${JSON.stringify( line )}); process.exit(255)`], -); +// The line goes through the env and the script has no quotes or spaces: on Windows the args pass through cmd.exe. +const failWith = ( line: string ) => { + vi.stubEnv( 'RAXMLGUI_TEST_STDOUT', line ); + return runProcess( + 'test', + eventWith( false ).event, + path.dirname( process.execPath ), + path.basename( process.execPath ), + ['-e', 'process.exitCode=255,process.stdout.write(process.env.RAXMLGUI_TEST_STDOUT)'], + ); +}; it( 'runProcess rejects with a UserFixError when the binary prints a known cause', async () => { await expect( failWith( 'ERROR: Bad base (_) at site 99 of sequence 1\n' ) ).rejects.toMatchObject( { diff --git a/src/test/setup.ts b/src/test/setup.ts index 6f9afe95..3c630b3e 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -13,8 +13,9 @@ type RunEventName = keyof typeof runEvents; const runEventNames = Object.values( runEvents ) as RunEventName[]; const runEventStub = () => (): void => {}; +// Pinned off Windows: the store tests expect the macOS/Linux binary list (raxml-ng); host.test.ts covers Windows. const host: HostInfo = { - windows: process.platform === 'win32', + windows: false, release: os.release(), arch: os.arch(), cpuModel: os.cpus()[0].model,