Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

merge.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict'
  2. const path = require('path')
  3. const makeDir = require('make-dir')
  4. const fs = require('../fs-promises')
  5. const { cliWrapper, setupOptions } = require('./helpers.js')
  6. const NYC = require('../../index.js')
  7. exports.command = 'merge <input-directory> [output-file]'
  8. exports.describe = 'merge istanbul format coverage output in a given folder'
  9. exports.builder = function (yargs) {
  10. yargs
  11. .demandCommand(0, 0)
  12. .example('$0 merge ./out coverage.json', 'merge together reports in ./out and output as coverage.json')
  13. .positional('input-directory', {
  14. describe: 'directory containing multiple istanbul coverage files',
  15. type: 'text',
  16. default: './.nyc_output'
  17. })
  18. .positional('output-file', {
  19. describe: 'file to output combined istanbul format coverage to',
  20. type: 'text',
  21. default: 'coverage.json'
  22. })
  23. setupOptions(yargs, 'merge')
  24. yargs.default('exclude-after-remap', false)
  25. }
  26. exports.handler = cliWrapper(async argv => {
  27. process.env.NYC_CWD = process.cwd()
  28. const nyc = new NYC(argv)
  29. const inputStat = await fs.stat(argv.inputDirectory).catch(error => {
  30. throw new Error(`failed access input directory ${argv.inputDirectory} with error:\n\n${error.message}`)
  31. })
  32. if (!inputStat.isDirectory()) {
  33. throw new Error(`${argv.inputDirectory} was not a directory`)
  34. }
  35. await makeDir(path.dirname(argv.outputFile))
  36. const map = await nyc.getCoverageMapFromAllCoverageFiles(argv.inputDirectory)
  37. await fs.writeFile(argv.outputFile, JSON.stringify(map, null, 2), 'utf8')
  38. console.info(`coverage files in ${argv.inputDirectory} merged into ${argv.outputFile}`)
  39. })