All files / lib/report whitelist.js

89.28% Statements 25/28
66.66% Branches 2/3
100% Functions 1/1
89.28% Lines 25/28

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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2927x 27x 27x 27x 27x 27x 27x 27x 27x 27x 27x 27x 27x 2x 2x 2x 2x 2x       2x 2x 2x 2x 2x 2x 2x  
'use strict'
 
const { moduleList } = require('./util')
const {
  COLORS,
  tooltip
} = require('../ncm-style')
const L = console.log
 
const chalk = require('chalk')
 
module.exports = whitelistReport
 
function whitelistReport (report) {
  L()
  L(chalk`${report.length} {${COLORS.light1} modules total}`)
 
  if (report.length === 0) {
    L()
    L(tooltip('Run `ncm whitelist --add <pkg-name>@<ver>` to add a package to the whitelist.'))
    L()
  } else {
    /* todo: what to do if unpublished */
    moduleList(report, 'Whitelisted Modules')
    L(tooltip('Run `ncm whitelist --remove <pkg-name>@<ver>` to remove a package from the whitelist.'))
    L()
  }
}