From 1fb7f860c95afae36ddd0d5b507437544a1f135a Mon Sep 17 00:00:00 2001 From: Oleg Gomozov Date: Wed, 2 Dec 2020 19:34:23 -0800 Subject: [PATCH] feat: Add --summarizer=flat|nested|pkg option --- README.md | 14 ++++++++++++++ index.js | 1 + 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index f76f8fed..8af9f68b 100644 --- a/README.md +++ b/README.md @@ -366,6 +366,20 @@ If you opt to pre-instrument your source-code (rather than using a just-in-time _Important: If you are using nyc with a project that pre-instruments its code, run nyc with the configuration option `--exclude-after-remap` set to `false`. Otherwise nyc's reports will exclude any files that source-maps remap to folders covered under exclude rules._ +### Changing files tree structure in report + +Instanbul is able to show report files in different ways. Option `--summarizer` defines 4 ways to do so: +`flat` - all files are reported as one flat list with full path +`nested` - all files are reported as one nested tree list, which shows folders and files +`pkg` - files are reported in collapsed list similar to file explorers showing only current folder's children +`defaultSummarizer` - default summarizer defined in `istanbul-lib-report` package. So far it is `pkg` + +```json +{ + "summarizer": "flat" +} +``` + ## [Integrating with coveralls](./docs/setup-coveralls.md) ## [Integrating with codecov](./docs/setup-codecov.md) diff --git a/index.js b/index.js index 3ebf3555..f5fe5645 100755 --- a/index.js +++ b/index.js @@ -448,6 +448,7 @@ class NYC { const reports = require('istanbul-reports') const context = libReport.createContext({ + defaultSummarizer: this.config.summarizer, dir: this.reportDirectory(), watermarks: this.config.watermarks, coverageMap: await this.getCoverageMapFromAllCoverageFiles()