diff --git a/README.md b/README.md index 14e881f5..a5a7e15e 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ Here is a list of common options. Run `c8 --help` for the full list and document | `--per-file` | check thresholds per file | `boolean` | `false` | | `--temp-directory` | directory V8 coverage data is written to and read from | `string` | `process.env.NODE_V8_COVERAGE` | | `--clean` | should temp files be deleted before script execution | `boolean` | `true` | +| `--print-config` | prints the derived configuration between defaults and a detected configuration file or a file passed as an argument | `boolean` | `false` +| `--print-config-format` | format in which to print the derived configuration. Either text or json. | `string` | `text` | `--experimental-monocart` | see [section below](#using-monocart-coverage-reports-experimental) for more info | `boolean` | `false` | ## Checking for "full" source coverage using `--all` diff --git a/lib/parse-args.js b/lib/parse-args.js index 84ff8e3e..0a67ab7e 100644 --- a/lib/parse-args.js +++ b/lib/parse-args.js @@ -7,6 +7,8 @@ const { applyExtends } = require('yargs/helpers') const parser = require('yargs-parser') const { resolve } = require('path') +const { printConfig } = require('./print-config.js') + function buildYargs (withCommands = false) { const yargs = Yargs([]) .usage('$0 [opts] [script] [opts]') @@ -158,13 +160,24 @@ function buildYargs (withCommands = false) { describe: 'supplying --merge-async will merge all v8 coverage reports asynchronously and incrementally. ' + 'This is to avoid OOM issues with Node.js runtime.' }) + .options('print-config', { + default: false, + type: 'boolean', + describe: 'Print the derived configuration between command line parameters and loaded configuration file' + }) + // Todo: refactor. Use parse-args options. + .options('print-config-format', { + default: 'text', + type: 'string', + choices: ['text', 'json'], + describe: 'Format to print the configuration in. Accepted formats are either text or json' + }) .option('experimental-monocart', { default: false, type: 'boolean', describe: 'Use Monocart coverage reports' }) .pkgConf('c8') - .demandCommand(1) .check((argv) => { if (!argv.tempDirectory) { argv.tempDirectory = resolve(argv.reportsDir, 'tmp') @@ -186,6 +199,10 @@ function buildYargs (withCommands = false) { // } // }) + printConfig(yargs, hideInstrumenteeArgs) + + yargs.demandCommand(1) + const checkCoverage = require('./commands/check-coverage') const report = require('./commands/report') if (withCommands) { diff --git a/lib/print-config.js b/lib/print-config.js new file mode 100644 index 00000000..75132634 --- /dev/null +++ b/lib/print-config.js @@ -0,0 +1,382 @@ +const parser = require('yargs-parser') + +/** + * Function: printConfig + * + * @param {Object} yargs: instance of populated yargs object. + * @param {Function} hideInstrumenteeArgs: Callback defined in lib/parse-args. + * @returns {undefined} + * + * Entry point for print config logic from lib/parse-args.js file. + * Kills process at the end of execution. + * + */ +function printConfig (yargs, hideInstrumenteeArgs) { + const argv = process.argv.slice(2) + const checkArgs = parser(argv) + + let shouldPrint = false + + if (Object.keys(checkArgs).includes('print-config')) { + // checkArgs['print-config'] could contain a boolean or a string + // representing a boolean. + if (typeof checkArgs['print-config'] === 'boolean') { + shouldPrint = checkArgs['print-config'] + } else if (typeof checkArgs['print-config'] === 'string') { + shouldPrint = JSON.parse(checkArgs['print-config']) + } + } + + if (shouldPrint) { + const args = yargs.parse(hideInstrumenteeArgs()) + const cmdExecuted = 'c8 ' + argv.join(' ') + const cleanArgs = cleanUpArgumentObject(args) + + if (args.printConfigFormat === 'text') { + printConfigText(cleanArgs, cmdExecuted) + } else if (checkArgs.printConfigFormat === 'json') { + const jsonYargs = JSON.stringify(cleanArgs, 2) + console.log(jsonYargs) + } + + // DO NOT REMOVE! This is intentional. + process.exit() + } +} + +/** + * Function: cleanUpArgumentObject + * + * @param {Object} args: key/value pairs of configuration options + * generated by yargs.parse(). + * @returns {Object} - Clone of args with duplicated data removed. + * + * This function exclude duplicate values that have different keys. + * Additionally, scrubs convenience key values. + * + * For example: args['temp-directory'] and args['tempDirectory'] + * are essentially the same variable. + * + */ +function cleanUpArgumentObject (args) { + const argsToPrint = {} + + const keysToIterate = Object.keys(args).filter(v => { + return (!['_', '$0'].includes(v) && v.length > 1) + }) + + const camelCaseKeys = keysToIterate.filter(x => { + return [...x.matchAll(/([A-Z])/g)].length > 0 + }) + + keysToIterate.forEach(v => { + if (camelCaseKeys.includes(v)) { + // Derive Kebab Case string from Camel Case Key string + const newKey = v.replace(/([A-Z])/g, '-$1').toLowerCase() + // If the Kebab Case key is not assigned a value + if (!args[newKey]) { + // Then assigned it the Camel Case Variable + argsToPrint[newKey] = args[v] + } + } else { + // Just keep the value. Either Kebab case or otherwise + argsToPrint[v] = args[v] + } + // Not sure if we will hit this scenario + // should we throw an error? + }) + + return argsToPrint +} + +/** + * Function: printConfigText + * + * @param {Object} argsv: sanitized configuration option object. + * @param {String} cmdExecuted: the string representing the + * command for c8 that passed to the cli. + * @returns {undefined} + * + */ +function printConfigText (argsv, cmdExecuted) { + const configFilePath = argsv instanceof Object && + Object.keys(argsv).includes('config') && argsv.config + ? argsv.config + : '' + + // get the table string and add some padding + const tablePadding = ' ' + + // Adding padding to right side of table display + const table = printConfigTable(argsv, tablePadding) + + // find the line in the table with the most characters + const tableWidth = longestColumn(table) + + const description = printTableDescription(tableWidth, tablePadding) + + // get the banner string + const banner = printConfigBanner(cmdExecuted, configFilePath, tableWidth, tablePadding) + + // now print + console.log(banner) + console.log(description) + console.log(table) +} + +/** + * Function: printConfigBanner + * + * @param {String} cmdExecuted: the string representing the + * command for c8 that passed to the cli. + * @param {String} configFilePath: the absolute path to + * the configuration file that was loaded. + * @param {Number} tableWidth: the maximum table with measured by + * the number of characters. + * @param {String} tablePadding: a whitespace string to add as + * padding to the entire table. + * @returns {String} - the banner string to print. + * + * Todo: + * 1. Should I center this using the process.stdout.columns variable? + * + */ +function printConfigBanner (cmdExecuted, configFilePath, tableWidth, tablePadding) { + const graphic = String.raw` + + + /* ________/\\\\\\\\\_ _____/\\\\\\\\\____ */ + /* _____/\\\////////__ ___/\\\///////\\\__ */ + /* ___/\\\/___________ __\/\\\_____\/\\\__ */ + /* __/\\\_____________ __\///\\\\\\\\\/___ */ + /* _\/\\\_____________ ___/\\\///////\\\__ */ + /* _\//\\\____________ __/\\\______\//\\\_ */ + /* __\///\\\__________ _\//\\\______/\\\__ */ + /* ____\////\\\\\\\\\_ __\///\\\\\\\\\/___ */ + /* _______\/////////__ ____\/////////_____ */ + ` + + const graphicWidth = longestColumn(graphic) + + const graphicPaddingNum = Math.floor((tableWidth - graphicWidth) / 2) + const graphicPaddingStr = charString(graphicPaddingNum) + tablePadding + + const summery = String.raw` + Command Issued: ${cmdExecuted} + Config File Loaded: ${configFilePath} + + ` + + const reg = /\n{1} +/g + const replacement = '\n' + graphicPaddingStr + + const banner = graphic + summery + + return banner.replace(reg, replacement) +} + +/** + * Function: printTableDescription + * + * @param {Number} tableWidth: A number representing the column + * length of the configuration table. + * @param {String} tablePadding: a whitespace string to add as + * padding to the entire table. + * @returns {String} - A string representing the configuration + * table's description. + * + */ +function printTableDescription (tableWidth, tablePadding) { + const description = tablePadding + + 'Derived Configuration from CLI options and configuration file' + const line = '\n' + tablePadding + charString(tableWidth, '-') + '\n' + + return description + line +} + +/** + * Function: charString + * + * @param {Number} num: a digit for the number of character + * @returns {String} - a string with char repeated equal + * to the parameter num. + */ +function charString (num, char = ' ') { + let str = '' + for (let i = 0; i < num; i++) str += char + return str +} + +/** + * Function: printConfigTable + * + * @param {Object} args: An object of config params processed by + * cleanUpArgumentObject function. + * @param {String} tablePadding = '': A String representing the amount + * of right padding of the configuration value table. + * @returns {String} - A string representing the current configuration. + * + */ +function printConfigTable (args, tablePadding = '') { + let output = '' + const headerPadding = 10 + const headerColWidth = tableCalcHeaderWidth(args) + headerPadding + + Object.keys(args).forEach(v => { + const headerText = v + const value = args[v] + output += printConfigTableRow(headerText, value, headerColWidth, tablePadding) + }) + + return output +} + +/** + * Function: tableCalcHeaderWidth + * + * @param {Object} args: An object of config params processed by + * cleanUpArgumentObject function. + * @returns {Number} - An integer representing the max length of + * all keys assigned to the args object. + * + * + */ +function tableCalcHeaderWidth (args) { + return longestColumn(Object.keys(args)) +} + +/** + * Function: printConfigTableRow + * + * @param {String} header: a key in the arguments object. + * @param {any} value: a value in the arguments object. + * @param {Number} headerColWidth: max string length of keys in + * arguments object plus padding. + * @param {String} tablePadding: A String representing the amount + * of right padding of the configuration value table. + * @returns {String} - A rendered row of config table. + * + */ +function printConfigTableRow (header, value, headerColWidth, tablePadding) { + const { valueMargin, headerMargin } = + tableCalcRowMargin(headerColWidth, header, tablePadding) + + const val = formatPrintVariable(value, valueMargin) + const output = tablePadding + String(header) + ':' + headerMargin + val + '\n' + + return output +} + +/** + * Function: tableCalcRowMargin + * + * @param {Number} headerWidth: The width of the header column. + * @param {String} headerText: The value of the header column. + * @param {String} tablePadding: A String representing the amount + * of right padding of the configuration value table. + * @returns {Object} - An object containing whitespace string + * padding for the value and header columns. + * + */ +function tableCalcRowMargin (headerWidth, headerText, tablePadding) { + const rowHeaderLength = headerWidth - headerText.length + const rowHeaderMargin = charString(rowHeaderLength) + + const rowValueMargin = charString(headerWidth) + tablePadding + + return { + valueMargin: rowValueMargin, + headerMargin: rowHeaderMargin + } +} + +/** + * Function: formatPrintVariable + * + * @param {any} variable: the variable to format. + * @param {String} space: a string containing a variable + * amount of blank spaces. + * @returns {String} - string representation of the variable. + * + * + */ +function formatPrintVariable (vars, space) { + let value + + // Todo: I feel this would be easier to read a switch statement + if (vars instanceof Array && vars.length >= 1) { + value = stringifyObject(vars, space, ']') + } else if (vars instanceof Array && vars.length === 0) { + value = '[]' + } else if (vars instanceof Object && Object.keys(vars).length >= 1) { + value = stringifyObject(vars, space, '}') + } else if (vars instanceof Object && Object.keys(vars).length === 0) { + value = '{}' + } else if (typeof vars === 'string' && vars) { + value = "'" + vars + "'" + } else if (typeof vars === 'string' && !vars) { + value = "''" + } else { + value = vars + } + + return value +} + +/** + * Function: stringifyObject + * + * @param {any} variable: the variable to format. + * @param {String} space: string containing a variable + * amount of blank spaces. + * @param {String} closingChar: single string character + * either a ']' or a '}'. + * @returns {String} - string representation of the variable. + * + * + */ +function stringifyObject (variable, space, closingChar) { + const calcTabs = (spaces) => { + // 8 and 3 seem lie arbitrary numbers. A tab should + // equal 4 characters on all platforms. + const numOfTabs = Math.floor(spaces.length / 8) + const numOfSpaces = spaces.length % 8 + const tabs = charString(numOfTabs, '\t') + const remainingSpaces = charString(numOfSpaces + 3) + return tabs + remainingSpaces + } + + const jsonTabs = calcTabs(space) + + const closeReg = new RegExp('\n' + closingChar, 'g') + const out = JSON.stringify(variable, null, jsonTabs) + .replace(closeReg, '\n' + space + ' ' + closingChar) + + return out +} + +/** + * Function: longestColumn + * + * @param {Array|String} text: a string containing linefeed + * characters or an array containing no linefeed characters. + * @returns {Number} - a number representing the longest column + * width. + * + */ +function longestColumn (text) { + const compute = (text instanceof Array) + ? [...text] + : [...text.split('\n')] + + return compute.map(x => String(x).length) + .reduce((curr, prev) => curr >= prev ? curr : prev) +} + +module.exports = { + printConfig, + formatPrintVariable, + cleanUpArgumentObject, + printConfigText, + longestColumn +} diff --git a/package-lock.json b/package-lock.json index e335c9c6..d75b33f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,6 +101,16 @@ "node": ">=12" } }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@eslint/eslintrc": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", @@ -267,13 +277,21 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" } }, "node_modules/@pkgjs/parseargs": { @@ -321,9 +339,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", - "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==", + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -357,9 +375,9 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz", - "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", "dev": true, "engines": { "node": ">=0.4.0" @@ -391,24 +409,25 @@ } }, "node_modules/ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", - "dev": true, + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dependencies": { - "color-convert": "^1.9.0" + "color-convert": "^2.0.1" }, "engines": { - "node": ">=4" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/anymatch": { @@ -633,9 +652,9 @@ } }, "node_modules/chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -677,6 +696,33 @@ "node": ">=4" } }, + "node_modules/chalk/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/chalk/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, "node_modules/chalk/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -751,19 +797,20 @@ } }, "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dependencies": { - "color-name": "1.1.3" + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/concat-map": { "version": "0.0.1", @@ -1316,18 +1363,6 @@ "node": ">=4" } }, - "node_modules/eslint-plugin-import/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint-plugin-import/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1396,18 +1431,6 @@ "node": ">= 4" } }, - "node_modules/eslint-plugin-node/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint-plugin-node/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1468,16 +1491,13 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-react/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/eslint-plugin-react/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, "engines": { - "node": "*" + "node": ">=4.0" } }, "node_modules/eslint-plugin-react/node_modules/resolve": { @@ -1510,15 +1530,6 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-scope/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/eslint-utils": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", @@ -1552,21 +1563,6 @@ "node": ">=10" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/eslint/node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -1592,24 +1588,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/eslint/node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -1623,18 +1601,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/espree": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", @@ -1683,6 +1649,15 @@ "node": ">=0.10" } }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -1695,7 +1670,7 @@ "node": ">=4.0" } }, - "node_modules/estraverse": { + "node_modules/esrecurse/node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", @@ -1704,6 +1679,15 @@ "node": ">=4.0" } }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -1946,15 +1930,14 @@ } }, "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -2747,21 +2730,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-symbols/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/log-symbols/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2778,24 +2746,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/log-symbols/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/log-symbols/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -2855,15 +2805,14 @@ "dev": true }, "node_modules/minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=10" + "node": "*" } }, "node_modules/minimist": { @@ -2970,6 +2919,50 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mocha/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/mocha/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -3604,6 +3597,42 @@ "ansi-styles": "^3.2.0" } }, + "node_modules/pretty-format/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pretty-format/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/pretty-format/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -3833,13 +3862,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", + "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -3871,15 +3900,18 @@ ] }, "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", + "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "is-regex": "^1.1.4" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3908,15 +3940,16 @@ } }, "node_modules/set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -3997,39 +4030,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -4665,15 +4665,6 @@ "node": ">=10.12.0" } }, - "node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -4967,6 +4958,18 @@ "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } } }, "@eslint/eslintrc": { @@ -5005,14 +5008,63 @@ "argparse": "^1.0.7", "esprima": "^4.0.0" } + } + } + }, + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "requires": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==" }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "requires": { - "brace-expansion": "^1.1.7" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "requires": { + "ansi-regex": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" } } } @@ -5091,13 +5143,12 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@pkgjs/parseargs": { @@ -5106,6 +5157,12 @@ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "optional": true }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -5142,9 +5199,9 @@ "dev": true }, "@types/node": { - "version": "20.10.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", - "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==", + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -5170,9 +5227,9 @@ "requires": {} }, "acorn-walk": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz", - "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", "dev": true }, "ajv": { @@ -5194,18 +5251,16 @@ "dev": true }, "ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", - "dev": true + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "requires": { - "color-convert": "^1.9.0" + "color-convert": "^2.0.1" } }, "anymatch": { @@ -5370,9 +5425,9 @@ "dev": true }, "chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", "dev": true, "requires": { "assertion-error": "^1.1.0", @@ -5405,6 +5460,30 @@ "supports-color": "^5.3.0" }, "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -5458,19 +5537,17 @@ } }, "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { - "color-name": "1.1.3" + "color-name": "~1.1.4" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "concat-map": { "version": "0.0.1", @@ -5758,15 +5835,6 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -5786,21 +5854,6 @@ "supports-color": "^7.1.0" } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -5810,15 +5863,6 @@ "argparse": "^1.0.7", "esprima": "^4.0.0" } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } } } }, @@ -5948,15 +5992,6 @@ "path-exists": "^3.0.0" } }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -6009,15 +6044,6 @@ "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -6063,14 +6089,11 @@ "esutils": "^2.0.2" } }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true }, "resolve": { "version": "2.0.0-next.5", @@ -6093,14 +6116,6 @@ "requires": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" - }, - "dependencies": { - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - } } }, "eslint-utils": { @@ -6158,6 +6173,14 @@ "dev": true, "requires": { "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } } }, "esrecurse": { @@ -6167,12 +6190,20 @@ "dev": true, "requires": { "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } } }, "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, "esutils": { @@ -6350,15 +6381,14 @@ } }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -6367,7 +6397,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6935,15 +6964,6 @@ "is-unicode-supported": "^0.1.0" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -6953,21 +6973,6 @@ "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true } } }, @@ -7018,10 +7023,9 @@ "dev": true }, "minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } @@ -7101,6 +7105,40 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "minimatch": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", + "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -7569,6 +7607,38 @@ "requires": { "ansi-regex": "^3.0.0", "ansi-styles": "^3.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + } } }, "progress": { @@ -7739,13 +7809,13 @@ } }, "safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", + "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "has-symbols": "^1.0.3", "isarray": "^2.0.5" } @@ -7757,13 +7827,13 @@ "dev": true }, "safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", + "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "is-regex": "^1.1.4" } }, @@ -7785,15 +7855,16 @@ } }, "set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", "dev": true, "requires": { "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.1" } }, "set-function-name": { @@ -7845,32 +7916,6 @@ "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } } }, "spdx-correct": { @@ -8013,6 +8058,14 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "requires": { "ansi-regex": "^5.0.1" }, @@ -8327,17 +8380,6 @@ "@jridgewell/trace-mapping": "^0.3.12", "@types/istanbul-lib-coverage": "^2.0.1", "convert-source-map": "^2.0.0" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", - "requires": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - } } }, "validate-npm-package-license": { @@ -8394,6 +8436,16 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", diff --git a/test/help-message-unix.js.snap b/test/help-message-unix.js.snap new file mode 100644 index 00000000..b42dfa8d --- /dev/null +++ b/test/help-message-unix.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`--print-config 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--print-configConfigFileLoaded:./.nycrcDerivedConfigurationfromCLIoptionsandconfigurationfile100:falseprint-config:truereporter:[\\"html\\",\\"text\\"]lines:95branches:82statements:95config:'./.nycrc'reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'./coverage/tmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'experimental-monocart:false"`; + +exports[`--print-config=false 1`] = `""`; + +exports[`--print-config=false 2`] = `"zeropositivenegative--------------|---------|----------|---------|---------|-------------------File|%Stmts|%Branch|%Funcs|%Lines|UncoveredLine#s--------------|---------|----------|---------|---------|-------------------Allfiles|64.28|66.66|50|64.28|vanilla|78.26|75|100|78.26|loaded.js|73.68|71.42|100|73.68|4-5,16-18main.js|100|100|100|100|vanilla/dir|0|0|0|0|unloaded.js|0|0|0|0|1-5--------------|---------|----------|---------|---------|-------------------"`; + +exports[`--print-config=true 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--print-config=trueConfigFileLoaded:./.nycrcDerivedConfigurationfromCLIoptionsandconfigurationfile100:falseprint-config:truereporter:[\\"html\\",\\"text\\"]lines:95branches:82statements:95config:'./.nycrc'reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'./coverage/tmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'experimental-monocart:false"`; + +exports[`ensure the help message is correct 1`] = `"c8.js[opts][script][opts]Commands:c8.jscheck-coveragecheckwhethercoverageiswithinthresholdsprovidedc8.jsreportreadV8coveragedatafromtempandoutputreportReportingoptions-r,--reportercoveragereporter(s)touse[default:\\"text\\"]-o,--reports-dir,--report-dirdirectorywherecoveragereportswillbeoutputto[default:\\"./coverage\\"]--allsupplying--allwillcausec8toconsiderallsrcfilesinthecurrentworkingdirectorywhenthedeterminingcoverage.Respectsinclude/exclude.[boolean][default:false]--srcsupplying--srcwilloverridecwdasthedefaultlocationwhere--alllooksforsrcfiles.--srccanbesuppliedmultipletimesandeachdirectorywillbeincluded.Thisallowsforworkspacesspanningmultipleprojects[string]-n,--includealistofspecificfilesthatshouldbecovered(globpatternsaresupported)[default:[]]-x,--excludealistofspecificfilesanddirectoriesthatshouldbeexcludedfromcoverage(globpatternsaresupported)[default:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]]-e,--extensionalistofspecificfileextensionsthatshouldbecovered[default:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]]-a,--exclude-after-remapapplyexcludelogictofilesaftertheyareremappedbyasource-map[boolean][default:false]--skip-fulldonotshowfileswith100%statement,branch,andfunctioncoverage[boolean][default:false]Coveragethresholds--check-coveragecheckwhethercoverageiswithinthresholdsprovided[boolean][default:false]--brancheswhat%ofbranchesmustbecovered?[number][default:0]--functionswhat%offunctionsmustbecovered?[number][default:0]--lineswhat%oflinesmustbecovered?[number][default:90]--statementswhat%ofstatementsmustbecovered?[number][default:0]--per-filecheckthresholdsperfile[boolean][default:false]--100shortcutfor--check-coverage--lines100--functions100--branches100--statements100[boolean][default:false]Options:--helpShowhelp[boolean]--versionShowversionnumber[boolean]-c,--configpathtoJSONconfigurationfile[default:(default)]--exclude-node-moduleswhetherornottoexcludeallnode_modulefolders(i.e.**/node_modules/**)bydefault[boolean][default:true]--temp-directorydirectoryV8coveragedataiswrittentoandreadfrom[default:\\"./coverage/tmp\\"]--cleanshouldtempfilesbedeletedbeforescriptexecution[boolean][default:true]--resolveresolvepathstoalternatebasedirectory[default:\\"\\"]--wrapper-lengthhowmanybytesisthewrapperprefixonexecutedJavaScript[number]--omit-relativeomitanypathsthatarenotabsolute,e.g.,internal/net.js[boolean][default:true]--allowExternalsupplying--allowExternalwillcausec8toallowfilesfromoutsideofyourcwd.Thisappliesbothtofilesdiscoveredincoveragetempfilesandalsosrcfilesdiscoveredifusingthe--allflag.[boolean][default:false]--merge-asyncsupplying--merge-asyncwillmergeallv8coveragereportsasynchronouslyandincrementally.ThisistoavoidOOMissueswithNode.jsruntime.[boolean][default:false]--print-configPrintthederivedconfigurationbetweencommandlineparametersandloadedconfigurationfile[boolean][default:false]--print-config-formatFormattoprinttheconfigurationin.Acceptedformatsareeithertextorjson[string][choices:\\"text\\",\\"json\\"][default:\\"text\\"]--experimental-monocartUseMonocartcoveragereports[boolean][default:false]visithttps://git.io/vHysAforlistofavailablereporters"`; + +exports[`ensure warning message 1`] = `""`; diff --git a/test/help-message-windows.js.snap b/test/help-message-windows.js.snap new file mode 100644 index 00000000..9743fdb9 --- /dev/null +++ b/test/help-message-windows.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`--print-config 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--print-configConfigFileLoaded:..nycrcDerivedConfigurationfromCLIoptionsandconfigurationfile100:falseprint-config:truereporter:[\\"html\\",\\"text\\"]lines:95branches:82statements:95config:'..nycrc'reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'.coveragetmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'"`; + +exports[`--print-config=false 1`] = `""`; + +exports[`--print-config=false 2`] = `"zeropositivenegative--------------|---------|----------|---------|---------|-------------------File|%Stmts|%Branch|%Funcs|%Lines|UncoveredLine#s--------------|---------|----------|---------|---------|-------------------Allfiles|64.28|66.66|50|64.28|vanilla|78.26|75|100|78.26|loaded.js|73.68|71.42|100|73.68|4-5,16-18main.js|100|100|100|100|vanilla/dir|0|0|0|0|unloaded.js|0|0|0|0|1-5--------------|---------|----------|---------|---------|-------------------"`; + +exports[`--print-config=true 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--print-config=trueConfigFileLoaded:..nycrcDerivedConfigurationfromCLIoptionsandconfigurationfile100:falseprint-config:truereporter:[\\"html\\",\\"text\\"]lines:95branches:82statements:95config:'..nycrc'reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'.coveragetmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'"`; + +exports[`ensure the help message is correct 1`] = `"c8.js[opts][script][opts]Commands:c8.jscheck-coveragecheckwhethercoverageiswithinthresholdsprovidedc8.jsreportreadV8coveragedatafromtempandoutputreportReportingoptions-r,--reportercoveragereporter(s)touse[default:\\"text\\"]-o,--reports-dir,--report-dirdirectorywherecoveragereportswillbeoutputto[default:\\"./coverage\\"]--allsupplying--allwillcausec8toconsiderallsrcfilesinthecurrentworkingdirectorywhenthedeterminingcoverage.Respectsinclude/exclude.[boolean][default:false]--srcsupplying--srcwilloverridecwdasthedefaultlocationwhere--alllooksforsrcfiles.--srccanbesuppliedmultipletimesandeachdirectorywillbeincluded.Thisallowsforworkspacesspanningmultipleprojects[string]-n,--includealistofspecificfilesthatshouldbecovered(globpatternsaresupported)[default:[]]-x,--excludealistofspecificfilesanddirectoriesthatshouldbeexcludedfromcoverage(globpatternsaresupported)[default:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]]-e,--extensionalistofspecificfileextensionsthatshouldbecovered[default:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]]-a,--exclude-after-remapapplyexcludelogictofilesaftertheyareremappedbyasource-map[boolean][default:false]--skip-fulldonotshowfileswith100%statement,branch,andfunctioncoverage[boolean][default:false]Coveragethresholds--check-coveragecheckwhethercoverageiswithinthresholdsprovided[boolean][default:false]--brancheswhat%ofbranchesmustbecovered?[number][default:0]--functionswhat%offunctionsmustbecovered?[number][default:0]--lineswhat%oflinesmustbecovered?[number][default:90]--statementswhat%ofstatementsmustbecovered?[number][default:0]--per-filecheckthresholdsperfile[boolean][default:false]--100shortcutfor--check-coverage--lines100--functions100--branches100--statements100[boolean][default:false]Options:--helpShowhelp[boolean]--versionShowversionnumber[boolean]-c,--configpathtoJSONconfigurationfile[default:(default)]--exclude-node-moduleswhetherornottoexcludeallnode_modulefolders(i.e.**/node_modules/**)bydefault[boolean][default:true]--temp-directorydirectoryV8coveragedataiswrittentoandreadfrom[default:\\".coveragetmp\\"]--cleanshouldtempfilesbedeletedbeforescriptexecution[boolean][default:true]--resolveresolvepathstoalternatebasedirectory[default:\\"\\"]--wrapper-lengthhowmanybytesisthewrapperprefixonexecutedJavaScript[number]--omit-relativeomitanypathsthatarenotabsolute,e.g.,internal/net.js[boolean][default:true]--allowExternalsupplying--allowExternalwillcausec8toallowfilesfromoutsideofyourcwd.Thisappliesbothtofilesdiscoveredincoveragetempfilesandalsosrcfilesdiscoveredifusingthe--allflag.[boolean][default:false]--merge-asyncsupplying--merge-asyncwillmergeallv8coveragereportsasynchronouslyandincrementally.ThisistoavoidOOMissueswithNode.jsruntime.[boolean][default:false]--print-configPrintthederivedconfigurationbetweencommandlineparametersandloadedconfigurationfile[boolean][default:false]--print-config-formatFormattoprinttheconfigurationin.Acceptedformatsareeithertextorjson[string][choices:\\"text\\",\\"json\\"][default:\\"text\\"]visithttps://git.io/vHysAforlistofavailablereporters"`; + +exports[`ensure warning message 1`] = `""`; diff --git a/test/help-message.js b/test/help-message.js new file mode 100644 index 00000000..ef8474fc --- /dev/null +++ b/test/help-message.js @@ -0,0 +1,151 @@ +/* global describe, before, it */ + +const { rm } = require('fs') +const os = require('os') +const chaiJestSnapshot = require('chai-jest-snapshot') + +const { runc8 } = require('./test-helpers') +const { expect } = require('chai') + +require('chai') + .use(chaiJestSnapshot) + +const shouldCompressSnapShot = true +const isWin = (os.platform() === 'win32') +const OsStr = (isWin) ? 'windows' : 'unix' + +describe(`Help Message - ${OsStr}`, function () { + before(cb => rm('tmp', { recursive: true, force: true }, cb)) + /** + * Test: Ensure Help Message is Correct + * Command: c8 --help + * + * Runs the hep option and compares to a snapshot + */ + it('ensure the help message is correct', function () { + chaiJestSnapshot.setTestName('ensure the help message is correct') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot + }) + const output = runc8('--help', opts) + + expect(output).to.matchSnapshot() + }) + + describe('should demand arguments', function () { + /** + * Test: Ensure 'not enough non-option arguments' warning message + * Command: c8 + * + * Runs c8 with incorrect options to make sure it produces a warning + * + */ + it('ensure warning message', function () { + chaiJestSnapshot.setTestName('ensure warning message') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot + }) + const output = runc8('', opts) + + expect(output).to.matchSnapshot() + }) + + /** + * + * Test: should demand arguments: --print-config=false + * Command: c8 --print-config=false + * + */ + it('--print-config=false', function () { + chaiJestSnapshot.setTestName('--print-config=false') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot + }) + const output = runc8('--print-config=false', opts) + expect(output).to.matchSnapshot() + }) + }) + + describe('should not demand arguments', function () { + /** + * + * Test: should not demand any arguments: --print-config=true + * Command: c8 --print-config=true + * + * if print-config is true, c8 shouldn't demand any arguments + * + */ + it('--print-config=true', function () { + chaiJestSnapshot.setTestName('--print-config=true') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot, + removeBannerDivider: true + }) + + const output = runc8('--print-config=true', opts) + expect(output).to.matchSnapshot() + }) + + /** + * + * Test: should not demand any arguments: --print-config + * Command: c8 --print-config + * + * Other variation of if print-config is true, c8 shouldn't + * demand any arguments + * + */ + it('--print-config', function () { + chaiJestSnapshot.setTestName('--print-config') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot, + removeBannerDivider: true + }) + + const output = runc8('--print-config', opts) + expect(output).to.matchSnapshot() + }) + + /** + * + * Test: should not demand arguments: --print-config=false + * Command: c8 --print-config=false --temp-directory=tmp/vanilla-all \ + * --clean=false --all=true --include=test/fixtures/all/vanilla/**\/*.js + * --exclude=**\/*.ts node ./fixtures/all/vanilla/main + * + */ + it('--print-config=false', function () { + const nodePath = process.execPath + + chaiJestSnapshot.setTestName('--print-config=false') + chaiJestSnapshot.setFilename(`./test/help-message-${OsStr}.js.snap`) + const args = [ + '--print-config=false', + '--temp-directory=tmp/vanilla-all', + '--clean=false', + '--all=true', + '--include=test/fixtures/all/vanilla/**/*.js', + '--exclude=**/*.ts', // add an exclude to avoid default excludes of test/** + nodePath, + require.resolve('./fixtures/all/vanilla/main') + ] + + const opts = Object.freeze({ + stripWhiteSpace: shouldCompressSnapShot + }) + + const output = runc8(args, opts) + expect(output).to.matchSnapshot() + }) + }) +}) diff --git a/test/integration.js.snap b/test/integration.js.snap index fdbce704..fad09939 100644 --- a/test/integration.js.snap +++ b/test/integration.js.snap @@ -156,7 +156,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.21 | 12.24 | 6.38 | 3.21 | +All files | 2.62 | 12 | 6.25 | 2.62 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -166,7 +166,8 @@ All files | 3.21 | 12.24 | 6.38 | 3.21 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - parse-args.js | 0 | 0 | 0 | 0 | 1-229 + parse-args.js | 0 | 0 | 0 | 0 | 1-246 + print-config.js | 0 | 0 | 0 | 0 | 1-382 report.js | 0 | 0 | 0 | 0 | 1-542 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 | @@ -522,7 +523,7 @@ hey ---------------------------------------|---------|----------|---------|---------|------------------------ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------------------------|---------|----------|---------|---------|------------------------ -All files | 3.21 | 12.24 | 6.38 | 3.21 | +All files | 2.62 | 12 | 6.25 | 2.62 | c8 | 0 | 0 | 0 | 0 | index.js | 0 | 0 | 0 | 0 | 1 c8/bin | 0 | 0 | 0 | 0 | @@ -532,7 +533,8 @@ All files | 3.21 | 12.24 | 6.38 | 3.21 prettify.js | 0 | 0 | 0 | 0 | 1-2 sorter.js | 0 | 0 | 0 | 0 | 1-196 c8/lib | 0 | 0 | 0 | 0 | - parse-args.js | 0 | 0 | 0 | 0 | 1-229 + parse-args.js | 0 | 0 | 0 | 0 | 1-246 + print-config.js | 0 | 0 | 0 | 0 | 1-382 report.js | 0 | 0 | 0 | 0 | 1-542 source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100 c8/lib/commands | 0 | 0 | 0 | 0 | diff --git a/test/print-config-unix.js.snap b/test/print-config-unix.js.snap new file mode 100644 index 00000000..a5677044 --- /dev/null +++ b/test/print-config-unix.js.snap @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ensure config prints without a config file 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--config=\\"\\"--print-config--lines100ConfigFileLoaded:DerivedConfigurationfromCLIoptionsandconfigurationfile100:falseconfig:''print-config:truelines:100reporter:[\\"html\\",\\"text\\"]branches:82statements:95reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'./coverage/tmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'experimental-monocart:false"`; + +exports[`ensure valid json 1`] = ` +Object { + "100": false, + "all": false, + "allow-external": false, + "branches": 82, + "check-coverage": false, + "clean": true, + "config": "./.nycrc", + "exclude": Array [ + "coverage/**", + "packages/*/test{,s}/**", + "**/*.d.ts", + "test{,s}/**", + "test{,-*}.{js,cjs,mjs,ts,tsx,jsx}", + "**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}", + "**/__tests__/**", + "**/{ava,babel,nyc}.config.{js,cjs,mjs}", + "**/jest.config.{js,cjs,mjs,ts}", + "**/{karma,rollup,webpack}.config.js", + "**/.{eslint,mocha}rc.{js,cjs}", + ], + "exclude-after-remap": false, + "exclude-node-modules": true, + "experimental-monocart": false, + "extension": Array [ + ".js", + ".cjs", + ".mjs", + ".ts", + ".tsx", + ".jsx", + ], + "functions": 0, + "include": Array [], + "lines": 95, + "merge-async": false, + "omit-relative": true, + "per-file": false, + "print-config": true, + "print-config-format": "json", + "report-dir": "./coverage", + "reporter": Array [ + "html", + "text", + ], + "reports-dir": "./coverage", + "resolve": "", + "skip-full": false, + "statements": 95, + "temp-directory": "./coverage/tmp", +} +`; diff --git a/test/print-config-windows.js.snap b/test/print-config-windows.js.snap new file mode 100644 index 00000000..7c765fc6 --- /dev/null +++ b/test/print-config-windows.js.snap @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ensure config prints without a config file 1`] = `"/*________/______/____*//*_____/////////_____////////__*//*___//_____________/_____/__*//*__/_______________////___*//*_/________________////////__*//*_//______________/______//_*//*__///___________//______/__*//*____////___////___*//*_______/////////______/////////_____*/CommandIssued:c8--config=\\"\\"--print-config--lines100ConfigFileLoaded:DerivedConfigurationfromCLIoptionsandconfigurationfile100:falseconfig:''print-config:truelines:100reporter:[\\"html\\",\\"text\\"]branches:82statements:95reports-dir:'./coverage'report-dir:'./coverage'all:falsesrc:undefinedexclude-node-modules:trueinclude:[]exclude:[\\"coverage/**\\",\\"packages/*/test{,s}/**\\",\\"**/*.d.ts\\",\\"test{,s}/**\\",\\"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}\\",\\"**/__tests__/**\\",\\"**/{ava,babel,nyc}.config.{js,cjs,mjs}\\",\\"**/jest.config.{js,cjs,mjs,ts}\\",\\"**/{karma,rollup,webpack}.config.js\\",\\"**/.{eslint,mocha}rc.{js,cjs}\\"]extension:[\\".js\\",\\".cjs\\",\\".mjs\\",\\".ts\\",\\".tsx\\",\\".jsx\\"]exclude-after-remap:falseskip-full:falsecheck-coverage:falsefunctions:0per-file:falsetemp-directory:'.coveragetmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'"`; + +exports[`ensure valid json 1`] = ` +Object { + "100": false, + "all": false, + "allow-external": false, + "branches": 82, + "check-coverage": false, + "clean": true, + "config": ".\\\\.nycrc", + "exclude": Array [ + "coverage/**", + "packages/*/test{,s}/**", + "**/*.d.ts", + "test{,s}/**", + "test{,-*}.{js,cjs,mjs,ts,tsx,jsx}", + "**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}", + "**/__tests__/**", + "**/{ava,babel,nyc}.config.{js,cjs,mjs}", + "**/jest.config.{js,cjs,mjs,ts}", + "**/{karma,rollup,webpack}.config.js", + "**/.{eslint,mocha}rc.{js,cjs}", + ], + "exclude-after-remap": false, + "exclude-node-modules": true, + "extension": Array [ + ".js", + ".cjs", + ".mjs", + ".ts", + ".tsx", + ".jsx", + ], + "functions": 0, + "include": Array [], + "lines": 95, + "merge-async": false, + "omit-relative": true, + "per-file": false, + "print-config": true, + "print-config-format": "json", + "report-dir": "./coverage", + "reporter": Array [ + "html", + "text", + ], + "reports-dir": "./coverage", + "resolve": "", + "skip-full": false, + "statements": 95, + "temp-directory": ".\\\\coverage\\\\tmp", +} +`; diff --git a/test/print-config.js b/test/print-config.js new file mode 100644 index 00000000..663cea91 --- /dev/null +++ b/test/print-config.js @@ -0,0 +1,288 @@ +/* global describe, before, it */ + +const { rm } = require('fs') +const os = require('os') +const { expect } = require('chai') +const { resolve } = require('path') +const chaiJestSnapshot = require('chai-jest-snapshot') + +const { + runc8, + textGetConfigKey +} = require('./test-helpers') + +const { + formatPrintVariable, + cleanUpArgumentObject, + longestColumn +} = require('../lib/print-config') + +const { buildYargs } = require('../lib/parse-args') + +require('chai') + .use(chaiJestSnapshot) + +const isWin = (os.platform() === 'win32') +const OsStr = (isWin) ? 'windows' : 'unix' +describe(`print derived configuration CLI option - ${OsStr}`, function () { + before(cb => rm('tmp', { recursive: true, force: true }, cb)) + /** + * + * Test: Ensure Valid JSON + * Command: c8 --print-config --print-config-format=json + * + * ensure --print-config-format=json prints valid json document + */ + it('ensure valid json', function () { + chaiJestSnapshot.setTestName('ensure valid json') + chaiJestSnapshot.setFilename(`./test/print-config-${OsStr}.js.snap`) + + const opts = Object.freeze({ + expectedOutput: 'json' + }) + const out = runc8(['--print-config', '--print-config-format=json'], opts) + expect(out).to.matchSnapshot() + }) + + /** + * + * Test: Ensure comma delimited values transform into an array + * Command: C8 --reporter=lcov,text --print-config --print-config-format=json + * + * Todo: There is a bug in yargs where this is not transformed into an array + * Skipping test for now + */ + it.skip('ensure comma delimited values transform into an array', function () { + const opts = Object.freeze({ + expectedOutput: 'json' + }) + const out = runc8([ + '--reporter=lcov,text', + '--print-config', + '--print-config-format=json' + ], opts) + + expect(Object.keys(out).includes('reporter')).to.equal(true) + expect(out.reporter).to.eql(['lcov', 'text']) + }) + + /** + * + * Test: Ensure default project configuration file is loaded + * Command: c8 --print-config + * + */ + it('ensure default project configuration file is loaded', function () { + const opts = Object.freeze({ + expectedOutput: 'json' + }) + const out = runc8(['--print-config', '--print-config-format=json'], opts) + + expect(Object.keys(out).includes('config')).to.equal(true) + out.config.endsWith('.nycrc') + }) + + ;['text', 'json'].forEach((format) => { + describe(`${format} format option`, function () { + const textParam = format === 'text' + + /** + * + * Test: ensure loads config file from cli + * Command: c8 -c ./test/fixtures/config/.c8rc.json --print-config --print-config-format=json|text + * + */ + it('ensure loads config file from cli', function () { + // Can I shorten this line? + const configFile = './test/fixtures/config/.c8rc.json' + const opts = Object.freeze({ + expectedOutput: textParam ? 'text' : 'json' + }) + + const out = runc8([ + `--config=${configFile}`, + '--print-config', + `--print-config-format=${format}` + ], opts) + + let value + if (format === 'json') { + expect(Object.keys(out) + .includes('config')).to.equal(true) + value = out.config + } else { + value = textGetConfigKey(out, 'config') + } + + if (!value) { + expect + .fail('couldn\'t find configuration value for option --config') + } + + expect(value).to.eql(configFile) + }) + + /** + * + * Test: Ensure loads reporter option from cli + * Command: c8 --reporter=lcov --print-config + * + */ + it('ensure loads reporter option from cli', function () { + const opts = Object.freeze({ + expectedOutput: textParam ? 'text' : 'json' + }) + + const out = runc8([ + '--reporter=lcov', + '--print-config', + `--print-config-format=${format}` + ], opts) + + let value + if (format === 'json') { + expect(Object.keys(out) + .includes('reporter')).to.equal(true) + value = out.reporter + } else { + value = textGetConfigKey(out, 'reporter') + } + + if (!value) { + expect + .fail('couldn\'t find configuration value for option --reporter') + } + + // Todo: when the load comma delimited text array bug is fixed, need to adjust this line + expect(value).to.eql('lcov') + }) + }) + }) + + /** + * Test: ensure objects can be printed in derived config display + * + * a unit test to ensure coverage of printed objects + */ + it('ensure objects can be printed in derived config display', function () { + let testObject = { + a: 'str1', + b: 4, + c: false, + d: undefined, + e: null, + f: ['one', 'two', 'three'], + g: { + five: 'six', + seven: false, + eight: [ + { + nine: 9, + ten: '10' + }, + { + eleven: true, + twelve: null + } + ] + } + } + + let output = formatPrintVariable(testObject, '').replace(/\s+/g, '') + let expected = '{"a":"str1","b":4,"c":false,"e":null,"f":["one","two","three"],' + + '"g":{"five":"six","seven":false,"eight":[{"nine":9,"ten":"10"},' + + '{"eleven":true,"twelve":null}]}}' + + expect(output).to.equal(expected) + + testObject = {} + output = formatPrintVariable(testObject, '').replace(/\s+/g, '') + expected = '{}' + expect(output).to.equal(expected) + }) + + /** + * Test: testing cleanUpArgumentObject function + * + * Just a unit test that helped develop the function + */ + it('testing cleanUpArgumentObject function', function () { + const args = Object.freeze([ + 'node', + 'c8', + '--print-config', + '--lines', + '100', + '--config', + require.resolve('./fixtures/config/.c8rc.json') + ]) + const argsv = buildYargs().parse(args) + const cleanArgs = cleanUpArgumentObject(argsv) + + const configPath = resolve('./test/fixtures/config/.c8rc.json') + + expect(cleanArgs.config).to.equal(configPath) + + const noCamelCaseKeys = Object.keys(cleanArgs) + .map(v => [...v.matchAll(/([A-Z])/g)].length === 0) + .reduce((prev, curr) => prev && curr) + + expect(noCamelCaseKeys).to.eql(true) + }) + + /** + * Test: ensure config prints without a config file + * + * Run the printConfigText function with an empty string + * assigned to the config key and expect the configuration + * to still print. + * + */ + it('ensure config prints without a config file', function () { + chaiJestSnapshot.setTestName('ensure config prints without a config file') + chaiJestSnapshot.setFilename(`./test/print-config-${OsStr}.js.snap`) + + const args = Object.freeze([ + '--config=""', + '--print-config', + '--lines', + '100' + ]) + + const opts = Object.freeze({ + stripWhiteSpace: true, + removeBannerDivider: true + }) + + // run the process, get the output and remove + // items that are dynamically formatted. + const output = runc8(args, opts) + + expect(output).to.matchSnapshot() + }) + + /** + * Test: ensure longestColumn can be passed an array + * + */ + it('ensure longestColumn can be passed an array', function () { + const args = Object.freeze([ + '--config=""', + '--print-config', + '--lines', + '100' + ]) + + const opts = Object.freeze({ + stripWhiteSpace: false, + removeBannerDivider: true + }) + + // run the process, get the output and remove + // items that are dynamically formatted. + const output = runc8(args, opts) + + const width = longestColumn(output.split('\n')) + expect(width).to.be.gte(62) + }) +}) diff --git a/test/test-helpers.js b/test/test-helpers.js new file mode 100644 index 00000000..2a09ef96 --- /dev/null +++ b/test/test-helpers.js @@ -0,0 +1,175 @@ +const { spawnSync } = require('child_process') +const os = require('os') + +const isWin = (os.platform() === 'win32') +const pwd = process.cwd() +const whiteSpaceReg = /[\\\s]/g + +/** + * Function: runc8 + * + * @param {Array|String} args: an array of arguments or a string argument + * to pass to child spawned process. + * @param {Object} options: an Object with the following key-values + * {Object} spawnSyncOptions: The options object found here. http://tinyurl.com/66ztyx9b + * {String} expectedOutput: either 'text' or 'json' - default 'json' + * {Boolean} stripWhiteSpace: Should the output returned be stripped of all whitespace. + * - default false + * {Boolean} removeBannerDivider: Should remove the divider line below the config + * report banner - default false + * @returns {String} out: a string representing the stdout + * of the child process + * + * + */ +const runc8 = (args, options) => { + const nodePath = process.execPath + const c8Path = require.resolve('../bin/c8') + const argsv = (typeof args === 'string') + ? [c8Path, args] + : [c8Path, ...args] + + return runSpawn(nodePath, argsv, options) +} + +/** + * Function: runSpawn + * + * @param {String} cmd: A string representing the prompt command + * @param {Array|String} args: An array of arguments or a string argument + * to pass to child spawned process. + * @param {Object} options: an Object with the following key-values + * {Object} spawnSyncOptions: The options object found here. http://tinyurl.com/66ztyx9b + * {String} expectedOutput: either 'text' or 'json' - default 'json' + * {Boolean} stripWhiteSpace: Should the output returned be stripped of all whitespace. + * - default false + * {Boolean} removeBannerDivider: Should remove the divider line below the config + * report banner - default false + * @returns {String} out: a string representing the stdout + * of the child process + * + * A wrapper function around spawnSync. + * Node.js Docs: http://tinyurl.com/66ztyx9b + * + * Todo: Whitespace for snapshots is showing up in + * different amounts on different os platforms. + * + * I am concern about this issue in the chai-snapshot + * package. + * + * Issue described in jest + * https://github.com/jestjs/jest/pull/9203 + * + * Last time chai-jest-snapshot was publish was 6 + * years ago. + * + * https://www.npmjs.com/package/chai-jest-snapshot?activeTab=versions + * + * Alternative packages that might work. + * + * https://www.npmjs.com/package/mocha-chai-jest-snapshot + * + * https://www.npmjs.com/package/chai-snapshot-matcher/v/2.0.2 + * + */ +const runSpawn = (cmd, args, options = {}) => { + const opts = Object.freeze(Object.assign({ + expectedOutput: 'text', + stripWhiteSpace: false, + removeBannerDivider: false, + spawnSyncOptions: {} + }, options)) + + const { + expectedOutput, + stripWhiteSpace, + spawnSyncOptions, + removeBannerDivider + } = opts + const text = expectedOutput === 'text' + + const { output, status } = spawnSync(cmd, args, spawnSyncOptions) + + const pwdReg = new RegExp(pwd, 'g') + + let out = (!status) + ? output[1].toString('utf8') + : '' + + out = (isWin) + ? windowsPathProcessing(out, text) + : out.replace(pwdReg, '.') + + if (!text) { + out = JSON.parse(out) + } + + if (stripWhiteSpace) { + out = out.replace(whiteSpaceReg, '') + } + + if (text && removeBannerDivider) { + out = out.replace(/-{3,}/g, '') + } + + return out +} + +/** + * Function: windowsPathProcessing + * + * @param {String} output + * @param {Boolean} text=false + * @returns {String} - output with windows specific absolute paths + * replaced with relative paths to the project's directory + * + * Replace all occurrences of the projects absolute path + * with a relative directory path. + * + */ +const windowsPathProcessing = (output, text = false) => { + let jsonPwd = pwd.replace(/\\/g, '\\\\') + + // Replace once more because the json is already escaped + if (!text) { + jsonPwd = jsonPwd.replace(/\\/g, '\\\\') + } + + // match the escaped absolute project's directory + const jsonPwdReg = new RegExp(jsonPwd, 'g') + // replace with a relative path + return output.replace(jsonPwdReg, '.') +} + +/** + * Function: textGetConfigKey + * + * @param {String} out: utf-8 formatted output from + * child process of c8 with --print-config flag. + * @param {String} key: of configuration setting + * to return. + * @returns {String|null}: value of key, if + * found or null. + * + * Get a value of a configuration key from text input. + * + */ +const textGetConfigKey = (out, key) => { + const newLineReturn = (isWin) ? '\r\n' : '\n' + const newLineRegEx = new RegExp(newLineReturn, 'g') + + let value = null + const keyReg = new RegExp(key + ':.+', 'g') + const matches = [...out.matchAll(keyReg)] + if (matches.length > 0 && typeof matches[0][0] === 'string') { + const fileName = matches[0][0].replace(newLineRegEx, '') + .replace(key + ':', '') + .replace(whiteSpaceReg, '') + .replace(/'/g, '') + value = fileName + } + + return value +} + +module.exports = { runc8, textGetConfigKey }