jest . mock ( 'execa' ) ; import { getChanges } from './get_changes' ; import { createAbsolutePathSerializer } from '@kbn/dev-utils' ; import { REPO_ROOT } from '@kbn/utils' ; const execa = jest . requireMock ( 'execa' ) ; expect . addSnapshotSerializer ( createAbsolutePathSerializer ( ) ) ; it ( 'parses git ls-files output' , async ( ) => { expect . assertions ( 4 ) ; execa . mockImplementation ( ( cmd , args , options ) => { expect ( cmd ) . toBe ( 'git' ) ; expect ( args ) . toEqual ( [ 'ls-files' , '-dmt' , '--' , 'foo/bar/x' ] ) ; expect ( options ) . toEqual ( { cwd : REPO_ROOT , } ) ; return { stdout : [ 'C kbn-optimizer/package.json' , 'C kbn-optimizer/src/common/bundle.ts' , 'R kbn-optimizer/src/common/bundles.ts' , 'C kbn-optimizer/src/common/bundles.ts' , 'R kbn-optimizer/src/get_bundle_definitions.test.ts' , 'C kbn-optimizer/src/get_bundle_definitions.test.ts' , ] . join ( '\n' ) , } ; } ) ; const changes = await getChanges ( 'foo/bar/x' ) ; expect ( changes ) . toMatchInlineSnapshot ( `
    Map {
      <absolute path>/kbn-optimizer/package.json => "modified",
      <absolute path>/kbn-optimizer/src/common/bundle.ts => "modified",
      <absolute path>/kbn-optimizer/src/common/bundles.ts => "deleted",
      <absolute path>/kbn-optimizer/src/get_bundle_definitions.test.ts => "deleted",
    }
  ` ) ; } ) ;