import path from 'path' ; import getPathToTargetWorkspaceRootDirFromCLIArgs from '../getPathToTargetWorkspaceRootDirFromCLIArgs' ; describe ( 'getPathToTargetWorkspaceRootDirFromCLIArgs' , ( ) => { it ( 'Should parse process.argv and return from there correct absolute path to workspace-root-dir using LONG form of this flag' , ( ) => { process . argv = [ 'node' , 'jest' , '--path-to-workspace-root-dir' , '/my/absolute/path/to/workspace-root-dir' , ] ; const parsedTargetPath = getPathToTargetWorkspaceRootDirFromCLIArgs ( ) ; expect ( parsedTargetPath ) . toMatch ( '/my/absolute/path/to/workspace-root-dir' ) ; } ) ; it ( 'Should parse process.argv and return from there correct absolute path to workspace-root-dir using SHORT form (-w) of this flag' , ( ) => { process . argv = [ 'node' , 'jest' , '-w' , '/my/absolute/path/to/workspace-root-dir' , ] ; const parsedTargetPath = getPathToTargetWorkspaceRootDirFromCLIArgs ( ) ; expect ( parsedTargetPath ) . toMatch ( '/my/absolute/path/to/workspace-root-dir' ) ; } ) ; it ( 'Should parse process.argv and return from there correct path and TRANSFORM it to absolute one if a relative one is provided' , ( ) => { process . argv = [ 'node' , 'jest' , '--path-to-workspace-root-dir' , './relative/to/workspace-root-dir' , ] ; const parsedTargetPath = getPathToTargetWorkspaceRootDirFromCLIArgs ( ) ; expect ( parsedTargetPath ) . toMatch ( path . join ( process . cwd ( ) , './relative/to/workspace-root-dir' ) ) ; } ) ; } ) ;