Skip to content

Commit

Permalink
Simplify IGNORED_PATHS handling
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyGu committed Dec 1, 2017
1 parent bbdaaab commit f19fb4b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bin/c8.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
'use strict'

const {isAbsolute} = require('path')
const argv = require('yargs').parse()
const CRI = require('chrome-remote-interface')
const spawn = require('../lib/spawn')
Expand Down Expand Up @@ -57,12 +58,8 @@ async function outputCoverage (Profiler) {
/node-spawn-wrap/
]
let {result} = await Profiler.takePreciseCoverage()
result = result.filter(coverage => {
for (var ignored, i = 0; (ignored = IGNORED_PATHS[i]) !== undefined; i++) {
if (ignored.test(coverage.url)) return false
}
if (!/^\//.test(coverage.url)) return false
else return true
})
result = result.filter(({url}) => {
return isAbsolute(url) && IGNORED_PATHS.every(ignored => !ignored.test(url))
});
console.log(JSON.stringify(result, null, 2))
}

0 comments on commit f19fb4b

Please sign in to comment.