Skip to content

Commit ee3f09a

Browse files
committed
Revert "feat: add support to exclude files on coverage report generation (istanbuljs#982)"
This reverts commit 509c6aa.
1 parent a161d23 commit ee3f09a

3 files changed

Lines changed: 22 additions & 70 deletions

File tree

index.js

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ const glob = require('glob')
1111
const Hash = require('./lib/hash')
1212
const libCoverage = require('istanbul-lib-coverage')
1313
const libHook = require('istanbul-lib-hook')
14+
const libReport = require('istanbul-lib-report')
1415
const mkdirp = require('make-dir')
1516
const Module = require('module')
1617
const onExit = require('signal-exit')
1718
const path = require('path')
19+
const reports = require('istanbul-reports')
1820
const resolveFrom = require('resolve-from')
1921
const rimraf = require('rimraf')
2022
const SourceMaps = require('./lib/source-maps')
2123
const testExclude = require('test-exclude')
2224
const uuid = require('uuid/v4')
23-
const api = require('istanbul-api')
2425

2526
const debugLog = util.debuglog('nyc')
2627

@@ -83,12 +84,6 @@ function NYC (config) {
8384
this.rootId = this.processInfo.root || this.generateUniqueID()
8485

8586
this.hashCache = {}
86-
87-
this.config.reporting = config.reporting || {}
88-
this.config.reporting['dir'] = this.reportDirectory()
89-
this.config.reporting['report-config'] = this._reportConfig()
90-
this.config.reporting['summarizer'] = this._reportSummarizer()
91-
this.config.reporting['watermarks'] = this._reportWatermarks()
9287
}
9388

9489
NYC.prototype._createTransform = function (ext) {
@@ -440,12 +435,21 @@ NYC.prototype.getCoverageMapFromAllCoverageFiles = function (baseDirectory) {
440435
}
441436

442437
NYC.prototype.report = function () {
443-
const config = api.config.loadObject(this.config)
444-
const reporter = api.createReporter(config)
445-
const map = this.getCoverageMapFromAllCoverageFiles()
438+
var tree
439+
var map = this.getCoverageMapFromAllCoverageFiles()
440+
var context = libReport.createContext({
441+
dir: this.reportDirectory(),
442+
watermarks: this.config.watermarks
443+
})
446444

447-
reporter.addAll(this.reporter)
448-
reporter.write(map)
445+
tree = libReport.summarizers.pkg(map)
446+
447+
this.reporter.forEach((_reporter) => {
448+
tree.visit(reports.create(_reporter, {
449+
skipEmpty: this.config.skipEmpty,
450+
skipFull: this.config.skipFull
451+
}), context)
452+
})
449453

450454
if (this._showProcessTree) {
451455
this.showProcessTree()
@@ -553,25 +557,4 @@ NYC.prototype.processInfoDirectory = function () {
553557
return path.resolve(this.tempDirectory(), 'processinfo')
554558
}
555559

556-
NYC.prototype._reportConfig = function () {
557-
const config = {}
558-
559-
this.reporter.forEach(_reporter => {
560-
config[_reporter] = {
561-
skipEmpty: this.config.skipEmpty,
562-
skipFull: this.config.skipFull
563-
}
564-
})
565-
566-
return config
567-
}
568-
569-
NYC.prototype._reportSummarizer = function () {
570-
return 'pkg'
571-
}
572-
573-
NYC.prototype._reportWatermarks = function () {
574-
return this.config.watermarks
575-
}
576-
577560
module.exports = NYC

package-lock.json

Lines changed: 6 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
"find-up": "^3.0.0",
7777
"foreground-child": "^1.5.6",
7878
"glob": "^7.1.3",
79-
"istanbul-api": "^2.1.0",
8079
"istanbul-lib-coverage": "^2.0.3",
8180
"istanbul-lib-hook": "^2.0.3",
8281
"istanbul-lib-instrument": "^3.1.0",

0 commit comments

Comments
 (0)