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: 0ea90981860218992e931a8c17db3d497f6b5c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const coverageMap = (filename) => {
  const { basename } = require('path')
  const testbase = basename(filename)
  if (filename === 'test/index.js') {
    return ['index.js']
  }
  if (testbase === 'load-all-commands.js') {
    const { cmdList } = require('../lib/utils/cmd-list.js')
    return cmdList.map(cmd => `lib/${cmd}.js`)
      .concat('lib/base-command.js')
  }
  if (/^test\/lib\/commands/.test(filename) || filename === 'test/lib/npm.js') {
    return [
      filename.replace(/^test\//, ''),
      'lib/base-command.js',
      'lib/exec/get-workspace-location-msg.js',
    ]
  }
  if (/^test\/(lib|bin)\//.test(filename)) {
    return filename.replace(/^test\//, '')
  }
  return []
}

module.exports = coverageMap