Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/main/processHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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( {
Expand Down
3 changes: 2 additions & 1 deletion src/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading