All files / src/utils is-root-dir-of-repo.ts

83.33% Statements 10/12
66.67% Branches 4/6
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 1415x 15x     28x 28x 28x   28x 28x   1x    
import git from 'simple-git/promise'
import dirExist from './dir-exist'
 
 
export default async(path: string) => {
  Iif (!await dirExist(path)) return false
  Iif (!await git(path).checkIsRepo()) return false
 
  const toplevel = await git(path).revparse(['--show-toplevel'])
  if (toplevel.replace(/\n$/, '') !== path) return false
 
  return true
}