Skip to content

Commit

Permalink
Print Derived Configuration Report (bcoe#517)
Browse files Browse the repository at this point in the history
feat: print derived config variables
feat: print derived config variables in json
test: 16 new unit tests to support features
test: 1 skipped unit test for discovered bug in yargs with reports param
  • Loading branch information
mcknasty committed Jun 12, 2024
1 parent 64745db commit 9bbba24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/help-message-windows.js.snap
Original file line number Diff line number Diff line change
@@ -1,13 +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 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'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:'.coveragetmp'clean:trueresolve:''omit-relative:trueallow-external:falsemerge-async:falseprint-config-format:'text'"`;
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'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:\\".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 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\\"]--experimental-monocartUseMonocartcoveragereports[boolean][default:false]visithttps://git.io/vHysAforlistofavailablereporters"`;

exports[`ensure warning message 1`] = `""`;
3 changes: 2 additions & 1 deletion test/print-config-windows.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 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'experimental-monocart:false"`;

exports[`ensure valid json 1`] = `
Object {
Expand All @@ -26,6 +26,7 @@ Object {
],
"exclude-after-remap": false,
"exclude-node-modules": true,
"experimental-monocart": false,
"extension": Array [
".js",
".cjs",
Expand Down

0 comments on commit 9bbba24

Please sign in to comment.