Welcome to mirror list, hosted at ThFree Co, Russian Federation.

coverage-map.js « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b29fcd86185573355354ab71ad8c2c95cfc1a4ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const full = process.env.npm_lifecycle_event === 'check-coverage'
const coverageMap = (filename) => {
  if (full && /load-all.js$/.test(filename)) {
    const glob = require('glob')
    const { resolve, relative } = require('path')
    const dir = resolve(__dirname, '../lib')
    return glob.sync(`${dir}/**/*.js`)
      .map(f => relative(process.cwd(), f))
  }
  if (/windows-shims\.js$/.test(filename)) {
    // this one doesn't provide any coverage nyc can track
    return []
  }
  if (/^test\/(lib\/|bin\/|index\.js$)/.test(filename)) {
    return filename.replace(/^test\//, '')
  }
  return []
}

module.exports = coverageMap