1+ import { join } from 'path' ;
12import { afterEach , describe , it , expect , vi , beforeEach } from 'vitest' ;
23import { CliResolver } from '../../src/codeql/cli-resolver' ;
34
@@ -211,7 +212,7 @@ describe('CliResolver', () => {
211212 ) ;
212213
213214 // The binary at distribution3/codeql/codeql is valid
214- const expectedPath = ` ${ storagePath } / distribution3/ codeql/ ${ binaryName } ` ;
215+ const expectedPath = join ( storagePath , ' distribution3' , ' codeql' , binaryName ) ;
215216 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
216217 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
217218 return Promise . reject ( new Error ( 'ENOENT' ) ) ;
@@ -240,7 +241,7 @@ describe('CliResolver', () => {
240241 ] as any ) ;
241242
242243 // Only distribution3 has a valid binary
243- const expectedPath = ` ${ storagePath } / distribution3/ codeql/ ${ binaryName } ` ;
244+ const expectedPath = join ( storagePath , ' distribution3' , ' codeql' , binaryName ) ;
244245 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
245246 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
246247 return Promise . reject ( new Error ( 'ENOENT' ) ) ;
@@ -265,7 +266,7 @@ describe('CliResolver', () => {
265266 vi . mocked ( access ) . mockResolvedValue ( undefined as any ) ;
266267
267268 const result = await resolver . resolve ( ) ;
268- expect ( result ) . toBe ( ` ${ storagePath } / distribution10/ codeql/ ${ binaryName } ` ) ;
269+ expect ( result ) . toBe ( join ( storagePath , ' distribution10' , ' codeql' , binaryName ) ) ;
269270 } ) ;
270271
271272 it ( 'should return undefined when no storage path is provided' , async ( ) => {
@@ -293,7 +294,7 @@ describe('CliResolver', () => {
293294 { name : 'distribution1' , isDirectory : ( ) => true } ,
294295 ] as any ) ;
295296
296- const expectedPath = ` ${ storagePath } / distribution1/ codeql/ ${ binaryName } ` ;
297+ const expectedPath = join ( storagePath , ' distribution1' , ' codeql' , binaryName ) ;
297298 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
298299 // Only distribution1 has the binary
299300 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
@@ -314,7 +315,7 @@ describe('CliResolver', () => {
314315 { name : 'distribution1' , isDirectory : ( ) => true } ,
315316 ] as any ) ;
316317
317- const expectedPath = ` ${ storagePath } / distribution1/ codeql/ ${ binaryName } ` ;
318+ const expectedPath = join ( storagePath , ' distribution1' , ' codeql' , binaryName ) ;
318319 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
319320 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
320321 return Promise . reject ( new Error ( 'ENOENT' ) ) ;
@@ -339,7 +340,7 @@ describe('CliResolver', () => {
339340 return Promise . resolve ( JSON . stringify ( { folderIndex : 1 } ) as any ) ;
340341 } ) ;
341342
342- const expectedPath = ` ${ lowercaseExtStorage } / distribution1/ codeql/ ${ binaryName } ` ;
343+ const expectedPath = join ( lowercaseExtStorage , ' distribution1' , ' codeql' , binaryName ) ;
343344 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
344345 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
345346 return Promise . reject ( new Error ( 'ENOENT' ) ) ;
@@ -360,7 +361,7 @@ describe('CliResolver', () => {
360361 { name : 'distribution1' , isDirectory : ( ) => true } ,
361362 ] as any ) ;
362363
363- const expectedPath = ` ${ storagePath } / distribution1/ codeql/ ${ binaryName } ` ;
364+ const expectedPath = join ( storagePath , ' distribution1' , ' codeql' , binaryName ) ;
364365 vi . mocked ( access ) . mockImplementation ( ( path : any ) => {
365366 if ( String ( path ) === expectedPath ) return Promise . resolve ( undefined as any ) ;
366367 return Promise . reject ( new Error ( 'ENOENT' ) ) ;
0 commit comments