Skip to content

Commit

Permalink
Revert "feat: add support to exclude files on coverage report generat…
Browse files Browse the repository at this point in the history
…ion (istanbuljs#982)"

This reverts commit 509c6aa.
  • Loading branch information
coreyfarrell committed Mar 6, 2019
1 parent a161d23 commit ee3f09a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 70 deletions.
49 changes: 16 additions & 33 deletions index.js
Expand Up @@ -11,16 +11,17 @@ const glob = require('glob')
const Hash = require('./lib/hash')
const libCoverage = require('istanbul-lib-coverage')
const libHook = require('istanbul-lib-hook')
const libReport = require('istanbul-lib-report')
const mkdirp = require('make-dir')
const Module = require('module')
const onExit = require('signal-exit')
const path = require('path')
const reports = require('istanbul-reports')
const resolveFrom = require('resolve-from')
const rimraf = require('rimraf')
const SourceMaps = require('./lib/source-maps')
const testExclude = require('test-exclude')
const uuid = require('uuid/v4')
const api = require('istanbul-api')

const debugLog = util.debuglog('nyc')

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

this.hashCache = {}

this.config.reporting = config.reporting || {}
this.config.reporting['dir'] = this.reportDirectory()
this.config.reporting['report-config'] = this._reportConfig()
this.config.reporting['summarizer'] = this._reportSummarizer()
this.config.reporting['watermarks'] = this._reportWatermarks()
}

NYC.prototype._createTransform = function (ext) {
Expand Down Expand Up @@ -440,12 +435,21 @@ NYC.prototype.getCoverageMapFromAllCoverageFiles = function (baseDirectory) {
}

NYC.prototype.report = function () {
const config = api.config.loadObject(this.config)
const reporter = api.createReporter(config)
const map = this.getCoverageMapFromAllCoverageFiles()
var tree
var map = this.getCoverageMapFromAllCoverageFiles()
var context = libReport.createContext({
dir: this.reportDirectory(),
watermarks: this.config.watermarks
})

reporter.addAll(this.reporter)
reporter.write(map)
tree = libReport.summarizers.pkg(map)

this.reporter.forEach((_reporter) => {
tree.visit(reports.create(_reporter, {
skipEmpty: this.config.skipEmpty,
skipFull: this.config.skipFull
}), context)
})

if (this._showProcessTree) {
this.showProcessTree()
Expand Down Expand Up @@ -553,25 +557,4 @@ NYC.prototype.processInfoDirectory = function () {
return path.resolve(this.tempDirectory(), 'processinfo')
}

NYC.prototype._reportConfig = function () {
const config = {}

this.reporter.forEach(_reporter => {
config[_reporter] = {
skipEmpty: this.config.skipEmpty,
skipFull: this.config.skipFull
}
})

return config
}

NYC.prototype._reportSummarizer = function () {
return 'pkg'
}

NYC.prototype._reportWatermarks = function () {
return this.config.watermarks
}

module.exports = NYC
42 changes: 6 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -76,7 +76,6 @@
"find-up": "^3.0.0",
"foreground-child": "^1.5.6",
"glob": "^7.1.3",
"istanbul-api": "^2.1.0",
"istanbul-lib-coverage": "^2.0.3",
"istanbul-lib-hook": "^2.0.3",
"istanbul-lib-instrument": "^3.1.0",
Expand Down

0 comments on commit ee3f09a

Please sign in to comment.