File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
packages/mongodb-memory-server-core/src/util Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class DryMongoBinary {
8787 if ( ! ! useOpts . systemBinary ) {
8888 log ( `locateBinary: env "SYSTEM_BINARY" was provided with value: "${ useOpts . systemBinary } "` ) ;
8989
90- const systemReturn = await this . getSystemPath ( useOpts . systemBinary ) ;
90+ const systemReturn = await this . getSystemPath ( path . resolve ( useOpts . systemBinary ) ) ;
9191
9292 if ( isNullOrUndefined ( systemReturn ) ) {
9393 throw new BinaryNotFoundError ( useOpts . systemBinary , ' (systemBinary)' ) ;
Original file line number Diff line number Diff line change @@ -499,6 +499,18 @@ describe('DryBinary', () => {
499499 expect ( fspromises . access ) . toHaveBeenCalled ( ) ;
500500 } ) ;
501501
502+ it ( 'should return SystemBinary with absolute path' , async ( ) => {
503+ const mockBinary = 'bin/mongod' ;
504+ process . env [ envName ( ResolveConfigVariables . SYSTEM_BINARY ) ] = mockBinary ;
505+ jest . spyOn ( fspromises , 'access' ) . mockResolvedValue ( void 0 ) ;
506+
507+ const returnValue = await binary . DryMongoBinary . locateBinary ( { version : '1.1.1' } ) ;
508+ expect ( returnValue ) . not . toEqual ( mockBinary ) ;
509+ expect ( returnValue ) . toEqual ( path . resolve ( mockBinary ) ) ;
510+ expect ( binary . DryMongoBinary . binaryCache . size ) . toBe ( 0 ) ; // system binaries dont get added to the cache
511+ expect ( fspromises . access ) . toHaveBeenCalled ( ) ;
512+ } ) ;
513+
502514 it ( 'should throw an error if SystemBinary was provided, but not found' , async ( ) => {
503515 const mockBinary = '/usr/local/bin/mongod' ;
504516 process . env [ envName ( ResolveConfigVariables . SYSTEM_BINARY ) ] = mockBinary ;
You can’t perform that action at this time.
0 commit comments