Skip to content

Commit

Permalink
refactor: remove isAbsolute and replace with path.isAbsolute (#405)
Browse files Browse the repository at this point in the history
path.isAbsolute added in node v0.11.2
  • Loading branch information
anthony-redFox committed Mar 23, 2020
1 parent 83bafc3 commit fc6e289
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/reporter.js
Expand Up @@ -20,14 +20,6 @@ var globalCoverageMap = require('./coverage-map')
var reports = require('./report-creator')
const hasOwnProperty = Object.prototype.hasOwnProperty

function isAbsolute (file) {
if (path.isAbsolute) {
return path.isAbsolute(file)
}

return path.resolve(file) === path.normalize(file)
}

// TODO(vojta): inject only what required (config.basePath, config.coverageReporter)
var CoverageReporter = function (rootConfig, helper, logger, emitter) {
var log = logger.create('coverage')
Expand Down Expand Up @@ -58,7 +50,7 @@ var CoverageReporter = function (rootConfig, helper, logger, emitter) {

function normalize (key) {
// Exclude keys will always be relative, but covObj keys can be absolute or relative
var excludeKey = isAbsolute(key) ? path.relative(basePath, key) : key
var excludeKey = path.isAbsolute(key) ? path.relative(basePath, key) : key
// Also normalize for files that start with `./`, etc.
excludeKey = path.normalize(excludeKey)

Expand Down

0 comments on commit fc6e289

Please sign in to comment.