-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fabian Wiles
committed
Sep 13, 2019
1 parent
9072ddb
commit 3b565be
Showing
37 changed files
with
8,985 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
const path = require('path') | ||
const fs = require('fs'); | ||
|
||
const sourcemap_support_package = path.resolve(process.cwd(), '../build_bazel_rules_nodejs/third_party/npm/node_modules/v8-coverage'); | ||
|
||
const covDir = process.env.NODE_V8_COVERAGE; | ||
|
||
const reportReadDir = path.join(covDir, 'tmp') | ||
const files = fs.readdirSync(covDir); | ||
if(!fs.existsSync(reportReadDir)) { | ||
fs.mkdirSync(reportReadDir) | ||
} | ||
|
||
//TODO: get inputs from manifest file | ||
const allowed = ['file:///private/var/tmp/_bazel_fabianwiles/ccf98a8a2c7e81be5a82a567664db09b/execroot/build_bazel_rules_nodejs/bazel-out/darwin-fastbuild/bin/internal/node/test/coverage/coverage.sh.runfiles/build_bazel_rules_nodejs/internal/node/test/coverage/produces-coverage.js']; | ||
const Report = require(sourcemap_support_package); | ||
const report = new Report(process.env.NODE_V8_COVERAGE, ['text-summary']); | ||
|
||
// Only store the files we acataully want coverage for | ||
// Also convert them to instanbul format | ||
for(const filelPath of files) { | ||
const fullPath = path.join(covDir, filelPath); | ||
if(fs.statSync(fullPath).isFile()) { | ||
const file = fs.readFileSync(fullPath); | ||
const result = JSON.parse(file); | ||
|
||
const filteredResult = result.result.filter(s => allowed.includes(s.url)) | ||
|
||
// when we store them like this it also converts them to istanbul format | ||
report.store(filteredResult) | ||
} | ||
} | ||
|
||
report.generateReport(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
load("//:defs.bzl", "nodejs_binary", "nodejs_test") | ||
|
||
nodejs_binary( | ||
name = "coverage", | ||
data = ["produces-coverage.js"], | ||
entry_point = ":produces-coverage.js", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function doMath(input) { | ||
return input + 3; | ||
} | ||
|
||
console.log(doMath(3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.