gemini-coverage
Advanced tools
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| 'use strict'; | ||
| var inherit = require('inherit'), | ||
| BaseReporter = require('./base-reporter'); | ||
| module.exports = inherit(BaseReporter, { | ||
| print: function(diff) { | ||
| console.log(this.get(diff)); | ||
| }, | ||
| get: function(diff) { | ||
| return { | ||
| covered: diff.covered.length, | ||
| total: diff.notCovered.length + diff.covered.length | ||
| }; | ||
| } | ||
| }); |
+3
-2
| 'use strict'; | ||
| var PATH = require('path'), | ||
| mkReport = require('./'), | ||
| coverage = require('./'), | ||
| reporters = require('./reporters'); | ||
@@ -39,3 +39,4 @@ | ||
| .act(function(opts, args) { | ||
| return mkReport(args.path, opts.reporter); | ||
| return coverage.mkReport(args.path, opts.reporter) | ||
| .thenResolve('Done.'); | ||
| }); |
+11
-2
@@ -12,5 +12,14 @@ 'use strict'; | ||
| */ | ||
| module.exports = function(path, reporter) { | ||
| exports.mkReport = function(path, reporter) { | ||
| reporter = reporter || reporters.default(); | ||
| return new Scanner(path).resolve(reporters.mk(reporter)); | ||
| } | ||
| }; | ||
| /** | ||
| * Get summary for passed coverage statistics | ||
| * @param {Object} coverage | ||
| * @return {Object} coverage summary | ||
| */ | ||
| exports.summarizeCoverage = function(coverage) { | ||
| return reporters.mk('summary').get(coverage); | ||
| }; |
@@ -8,5 +8,9 @@ 'use strict'; | ||
| print: function(diff) { | ||
| throw 'Method "print()" must be overridden!'; | ||
| throw 'Method "print()" not implemented!'; | ||
| }, | ||
| get: function(diff) { | ||
| throw 'Method "get()" not implemented!'; | ||
| } | ||
| }); |
@@ -29,5 +29,5 @@ 'use strict'; | ||
| return resultFilePath; | ||
| console.log(resultFilePath); | ||
| } | ||
| }); |
@@ -6,3 +6,4 @@ 'use strict'; | ||
| number: './number-reporter', | ||
| html: './html-reporter' | ||
| html: './html-reporter', | ||
| summary: './summary-reporter' | ||
| }; | ||
@@ -13,3 +14,3 @@ | ||
| return Object.keys(REPORTERS); | ||
| } | ||
| }; | ||
@@ -19,3 +20,3 @@ /// | ||
| return 'std'; | ||
| } | ||
| }; | ||
@@ -30,2 +31,2 @@ /// | ||
| return new Reporter(); | ||
| } | ||
| }; |
@@ -6,14 +6,11 @@ 'use strict'; | ||
| BaseReporter = require('./base-reporter'); | ||
| SummaryReporter = require('./summary-reporter'); | ||
| module.exports = inherit(BaseReporter, { | ||
| module.exports = inherit(SummaryReporter, { | ||
| print: function(diff) { | ||
| return format( | ||
| '%s/%s', | ||
| diff.covered.length, | ||
| diff.notCovered.length + diff.covered.length | ||
| ); | ||
| get: function(diff) { | ||
| var summary = this.__base(diff); | ||
| return format('%s/%s', summary.covered, summary.total); | ||
| } | ||
| }); |
@@ -28,5 +28,5 @@ 'use strict'; | ||
| return covered.concat(notCovered).join('\n'); | ||
| console.log(covered.concat(notCovered).join('\n')); | ||
| } | ||
| }); |
+4
-1
@@ -154,3 +154,6 @@ 'use strict'; | ||
| .flow() | ||
| .then(reporter.print.bind(reporter)); | ||
| .then(function(coverage) { | ||
| reporter.print(coverage); | ||
| return coverage; | ||
| }); | ||
| } | ||
@@ -157,0 +160,0 @@ |
+1
-1
| { | ||
| "author": "Tikvach Alexander <unlok@yandex-team.ru>", | ||
| "name": "gemini-coverage", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
+5
-2
@@ -23,5 +23,8 @@ # Simple gemini coverage | ||
| ```js | ||
| var mkReport = require('gemini-coverage'); | ||
| var geminiCoverage = require('gemini-coverage'); | ||
| ... | ||
| return mkReport(path_to_bem_library, reporter); | ||
| return geminiCoverage.mkReport(path_to_bem_library, reporter) | ||
| .then(function(coverage) { | ||
| console.log(geminiCoverage.summarizeCoverage(coverage)); | ||
| }); | ||
| ``` |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
38421
73.87%24
14.29%580
4.88%30
11.11%0
-100%