summaryrefslogtreecommitdiff
path: root/deps/npm/test/coverage-map.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/coverage-map.js')
-rw-r--r--deps/npm/test/coverage-map.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/deps/npm/test/coverage-map.js b/deps/npm/test/coverage-map.js
index b29fcd8618..0ea9098186 100644
--- a/deps/npm/test/coverage-map.js
+++ b/deps/npm/test/coverage-map.js
@@ -1,17 +1,22 @@
-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))
+ const { basename } = require('path')
+ const testbase = basename(filename)
+ if (filename === 'test/index.js') {
+ return ['index.js']
}
- if (/windows-shims\.js$/.test(filename)) {
- // this one doesn't provide any coverage nyc can track
- return []
+ 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\/|bin\/|index\.js$)/.test(filename)) {
+ 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 []