Skip to content

Commit e8ebe6a

Browse files
committed
Attempted fix for cli-executor.test.ts
1 parent f5d358a commit e8ebe6a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/test/src/lib/cli-executor.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import { describe, it, expect, beforeAll, afterAll, afterEach, vi } from 'vitest';
66
import { mkdirSync, writeFileSync, rmSync, chmodSync } from 'fs';
7+
import { execFileSync } from 'child_process';
78
import { join } from 'path';
89
import {
910
buildCodeQLArgs,
@@ -720,6 +721,15 @@ describe('CODEQL_PATH - PATH prepend integration', () => {
720721
});
721722
});
722723

724+
// Check if codeql is available on PATH (may not be in CI environments like build-server)
725+
let codeqlOnPath = false;
726+
try {
727+
execFileSync('codeql', ['version', '--format=terse'], { timeout: 5000 });
728+
codeqlOnPath = true;
729+
} catch {
730+
codeqlOnPath = false;
731+
}
732+
723733
describe('validateCodeQLBinaryReachable', () => {
724734
const originalEnv = process.env.CODEQL_PATH;
725735

@@ -732,7 +742,7 @@ describe('validateCodeQLBinaryReachable', () => {
732742
resetResolvedCodeQLBinary();
733743
});
734744

735-
it('should return a version string when codeql is on PATH', async () => {
745+
it.skipIf(!codeqlOnPath)('should return a version string when codeql is on PATH', async () => {
736746
// Use the default PATH-based resolution (codeql must be on PATH for tests)
737747
delete process.env.CODEQL_PATH;
738748
resolveCodeQLBinary();

0 commit comments

Comments
 (0)