Updating NPM dependencies
This commit is contained in:
106
node_modules/istanbul-reports/CHANGELOG.md
generated
vendored
106
node_modules/istanbul-reports/CHANGELOG.md
generated
vendored
@@ -3,23 +3,121 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.2.7]
|
||||
## [3.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.1...istanbul-reports@3.0.2) (2020-04-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Remove handlebars ([#503](https://github.com/istanbuljs/istanbuljs/issues/503))
|
||||
* Ignore insignificant lines when coalesce ([#525](https://github.com/istanbuljs/istanbuljs/issues/525)) ([d7d7cfa](https://github.com/istanbuljs/istanbuljs/commit/d7d7cfa1301f0dde2ff19078c31235ffd55c01ef))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.6]
|
||||
## [3.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0...istanbul-reports@3.0.1) (2020-03-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **istanbul-reports:** Revert to istanbul-reports@2.2.4
|
||||
* cobertura should escape invalid characters ([#534](https://github.com/istanbuljs/istanbuljs/issues/534)) ([4fd5114](https://github.com/istanbuljs/istanbuljs/commit/4fd5114a0926d20e4e1e3055323c44281f0af6cd))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.6...istanbul-reports@3.0.0) (2019-12-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **text:** Coalesce ranges of missing lines ([#511](https://github.com/istanbuljs/istanbuljs/issues/511)) ([54636fc](https://github.com/istanbuljs/istanbuljs/commit/54636fc9acbb53e5724fe9018837d0d205413194))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.5...istanbul-reports@3.0.0-alpha.6) (2019-12-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add favicon to html report ([#493](https://github.com/istanbuljs/istanbuljs/issues/493)) ([5afe203](https://github.com/istanbuljs/istanbuljs/commit/5afe20347dd3ae954b31707a67f381f87920797f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.4...istanbul-reports@3.0.0-alpha.5) (2019-11-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add support for projectRoot option ([#492](https://github.com/istanbuljs/istanbuljs/issues/492)) ([177fd45](https://github.com/istanbuljs/istanbuljs/commit/177fd45ebd7e505e79120995d937d40f965bad79))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.3...istanbul-reports@3.0.0-alpha.4) (2019-11-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Remove handlebars ([#503](https://github.com/istanbuljs/istanbuljs/issues/503)) ([aa8ae7f](https://github.com/istanbuljs/istanbuljs/commit/aa8ae7fe42ef9c8aeaa193309bafb22ad725bc3d)), closes [#476](https://github.com/istanbuljs/istanbuljs/issues/476)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.2...istanbul-reports@3.0.0-alpha.3) (2019-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing dependency on istanbul-lib-report ([#490](https://github.com/istanbuljs/istanbuljs/issues/490)) ([95a2b2f](https://github.com/istanbuljs/istanbuljs/commit/95a2b2f)), closes [istanbuljs/nyc#1204](https://github.com/istanbuljs/nyc/issues/1204)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.1...istanbul-reports@3.0.0-alpha.2) (2019-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Use path.posix.relative to generate URL's for html reports ([#472](https://github.com/istanbuljs/istanbuljs/issues/472)) ([05dc22c](https://github.com/istanbuljs/istanbuljs/commit/05dc22c))
|
||||
* **html-spa:** Filter only exact paths ([#431](https://github.com/istanbuljs/istanbuljs/issues/431)) ([bbc85f6](https://github.com/istanbuljs/istanbuljs/commit/bbc85f6)), closes [#426](https://github.com/istanbuljs/istanbuljs/issues/426)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@3.0.0-alpha.0...istanbul-reports@3.0.0-alpha.1) (2019-06-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Set `opts.file = '-'` on text-lcov ([#424](https://github.com/istanbuljs/istanbuljs/issues/424)) ([4be56b2](https://github.com/istanbuljs/istanbuljs/commit/4be56b2))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-reports@2.2.5...istanbul-reports@3.0.0-alpha.0) (2019-06-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Refactor istanbul-lib-report so report can choose summarizer ([#408](https://github.com/istanbuljs/istanbuljs/issues/408)) ([0f328fd](https://github.com/istanbuljs/istanbuljs/commit/0f328fd))
|
||||
* **text report:** Optimize output to show more missing lines ([#341](https://github.com/istanbuljs/istanbuljs/issues/341)) ([c4e8b8e](https://github.com/istanbuljs/istanbuljs/commit/c4e8b8e))
|
||||
* Modern html report ([#345](https://github.com/istanbuljs/istanbuljs/issues/345)) ([95ebaf1](https://github.com/istanbuljs/istanbuljs/commit/95ebaf1))
|
||||
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Existing istanbul-lib-report API's have been changed
|
||||
* Node.js 8 is now required
|
||||
|
||||
|
||||
|
||||
|
||||
5
node_modules/istanbul-reports/index.js
generated
vendored
5
node_modules/istanbul-reports/index.js
generated
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
@@ -11,6 +12,10 @@ module.exports = {
|
||||
try {
|
||||
Cons = require(path.join(__dirname, 'lib', name));
|
||||
} catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
|
||||
Cons = require(name);
|
||||
}
|
||||
|
||||
|
||||
289
node_modules/istanbul-reports/lib/clover/index.js
generated
vendored
289
node_modules/istanbul-reports/lib/clover/index.js
generated
vendored
@@ -1,12 +1,152 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
function CloverReport(opts) {
|
||||
this.cw = null;
|
||||
this.xml = null;
|
||||
this.projectRoot = opts.projectRoot || process.cwd();
|
||||
this.file = opts.file || 'clover.xml';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
class CloverReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
this.cw = null;
|
||||
this.xml = null;
|
||||
this.projectRoot = opts.projectRoot || process.cwd();
|
||||
this.file = opts.file || 'clover.xml';
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.xml = context.getXMLWriter(this.cw);
|
||||
this.writeRootStats(root, context);
|
||||
}
|
||||
|
||||
onEnd() {
|
||||
this.xml.closeAll();
|
||||
this.cw.close();
|
||||
}
|
||||
|
||||
getTreeStats(node, context) {
|
||||
const state = {
|
||||
packages: 0,
|
||||
files: 0,
|
||||
classes: 0
|
||||
};
|
||||
const visitor = {
|
||||
onSummary(node, state) {
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (metrics) {
|
||||
state.packages += 1;
|
||||
}
|
||||
},
|
||||
onDetail(node, state) {
|
||||
state.classes += 1;
|
||||
state.files += 1;
|
||||
}
|
||||
};
|
||||
node.visit(context.getVisitor(visitor), state);
|
||||
return state;
|
||||
}
|
||||
|
||||
writeRootStats(node, context) {
|
||||
this.cw.println('<?xml version="1.0" encoding="UTF-8"?>');
|
||||
this.xml.openTag('coverage', {
|
||||
generated: Date.now().toString(),
|
||||
clover: '3.2.0'
|
||||
});
|
||||
|
||||
this.xml.openTag('project', {
|
||||
timestamp: Date.now().toString(),
|
||||
name: 'All files'
|
||||
});
|
||||
|
||||
const metrics = node.getCoverageSummary();
|
||||
this.xml.inlineTag('metrics', {
|
||||
statements: metrics.lines.total,
|
||||
coveredstatements: metrics.lines.covered,
|
||||
conditionals: metrics.branches.total,
|
||||
coveredconditionals: metrics.branches.covered,
|
||||
methods: metrics.functions.total,
|
||||
coveredmethods: metrics.functions.covered,
|
||||
elements:
|
||||
metrics.lines.total +
|
||||
metrics.branches.total +
|
||||
metrics.functions.total,
|
||||
coveredelements:
|
||||
metrics.lines.covered +
|
||||
metrics.branches.covered +
|
||||
metrics.functions.covered,
|
||||
complexity: 0,
|
||||
loc: metrics.lines.total,
|
||||
ncloc: metrics.lines.total, // what? copied as-is from old report
|
||||
...this.getTreeStats(node, context)
|
||||
});
|
||||
}
|
||||
|
||||
writeMetrics(metrics) {
|
||||
this.xml.inlineTag('metrics', {
|
||||
statements: metrics.lines.total,
|
||||
coveredstatements: metrics.lines.covered,
|
||||
conditionals: metrics.branches.total,
|
||||
coveredconditionals: metrics.branches.covered,
|
||||
methods: metrics.functions.total,
|
||||
coveredmethods: metrics.functions.covered
|
||||
});
|
||||
}
|
||||
|
||||
onSummary(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (!metrics) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.xml.openTag('package', {
|
||||
name: asJavaPackage(node)
|
||||
});
|
||||
this.writeMetrics(metrics);
|
||||
}
|
||||
|
||||
onSummaryEnd(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.xml.closeTag('package');
|
||||
}
|
||||
|
||||
onDetail(node) {
|
||||
const fileCoverage = node.getFileCoverage();
|
||||
const metrics = node.getCoverageSummary();
|
||||
const branchByLine = fileCoverage.getBranchCoverageByLine();
|
||||
|
||||
this.xml.openTag('file', {
|
||||
name: asClassName(node),
|
||||
path: fileCoverage.path
|
||||
});
|
||||
|
||||
this.writeMetrics(metrics);
|
||||
|
||||
const lines = fileCoverage.getLineCoverage();
|
||||
Object.entries(lines).forEach(([k, count]) => {
|
||||
const attrs = {
|
||||
num: k,
|
||||
count,
|
||||
type: 'stmt'
|
||||
};
|
||||
const branchDetail = branchByLine[k];
|
||||
|
||||
if (branchDetail) {
|
||||
attrs.type = 'cond';
|
||||
attrs.truecount = branchDetail.covered;
|
||||
attrs.falsecount = branchDetail.total - branchDetail.covered;
|
||||
}
|
||||
this.xml.inlineTag('line', attrs);
|
||||
});
|
||||
|
||||
this.xml.closeTag('file');
|
||||
}
|
||||
}
|
||||
|
||||
function asJavaPackage(node) {
|
||||
@@ -21,143 +161,4 @@ function asClassName(node) {
|
||||
return node.getRelativeName().replace(/.*[\\/]/, '');
|
||||
}
|
||||
|
||||
CloverReport.prototype.onStart = function(root, context) {
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.xml = context.getXMLWriter(this.cw);
|
||||
this.writeRootStats(root, context);
|
||||
};
|
||||
|
||||
CloverReport.prototype.onEnd = function() {
|
||||
this.xml.closeAll();
|
||||
this.cw.close();
|
||||
};
|
||||
|
||||
CloverReport.prototype.getTreeStats = function(node, context) {
|
||||
const state = {
|
||||
packages: 0,
|
||||
files: 0,
|
||||
classes: 0
|
||||
};
|
||||
const visitor = {
|
||||
onSummary(node, state) {
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (metrics) {
|
||||
state.packages += 1;
|
||||
}
|
||||
},
|
||||
onDetail(node, state) {
|
||||
state.classes += 1;
|
||||
state.files += 1;
|
||||
}
|
||||
};
|
||||
node.visit(context.getVisitor(visitor), state);
|
||||
return state;
|
||||
};
|
||||
|
||||
CloverReport.prototype.writeRootStats = function(node, context) {
|
||||
const metrics = node.getCoverageSummary();
|
||||
const attrs = {
|
||||
statements: metrics.lines.total,
|
||||
coveredstatements: metrics.lines.covered,
|
||||
conditionals: metrics.branches.total,
|
||||
coveredconditionals: metrics.branches.covered,
|
||||
methods: metrics.functions.total,
|
||||
coveredmethods: metrics.functions.covered,
|
||||
elements:
|
||||
metrics.lines.total +
|
||||
metrics.branches.total +
|
||||
metrics.functions.total,
|
||||
coveredelements:
|
||||
metrics.lines.covered +
|
||||
metrics.branches.covered +
|
||||
metrics.functions.covered,
|
||||
complexity: 0,
|
||||
loc: metrics.lines.total,
|
||||
ncloc: metrics.lines.total // what? copied as-is from old report
|
||||
};
|
||||
|
||||
this.cw.println('<?xml version="1.0" encoding="UTF-8"?>');
|
||||
this.xml.openTag('coverage', {
|
||||
generated: Date.now().toString(),
|
||||
clover: '3.2.0'
|
||||
});
|
||||
|
||||
this.xml.openTag('project', {
|
||||
timestamp: Date.now().toString(),
|
||||
name: 'All files'
|
||||
});
|
||||
|
||||
const treeStats = this.getTreeStats(node, context);
|
||||
Object.keys(treeStats).forEach(k => {
|
||||
attrs[k] = treeStats[k];
|
||||
});
|
||||
|
||||
this.xml.inlineTag('metrics', attrs);
|
||||
};
|
||||
|
||||
CloverReport.prototype.writeMetrics = function(metrics) {
|
||||
this.xml.inlineTag('metrics', {
|
||||
statements: metrics.lines.total,
|
||||
coveredstatements: metrics.lines.covered,
|
||||
conditionals: metrics.branches.total,
|
||||
coveredconditionals: metrics.branches.covered,
|
||||
methods: metrics.functions.total,
|
||||
coveredmethods: metrics.functions.covered
|
||||
});
|
||||
};
|
||||
|
||||
CloverReport.prototype.onSummary = function(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (!metrics) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.xml.openTag('package', {
|
||||
name: asJavaPackage(node)
|
||||
});
|
||||
this.writeMetrics(metrics);
|
||||
};
|
||||
|
||||
CloverReport.prototype.onSummaryEnd = function(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.xml.closeTag('package');
|
||||
};
|
||||
|
||||
CloverReport.prototype.onDetail = function(node) {
|
||||
const fileCoverage = node.getFileCoverage();
|
||||
const metrics = node.getCoverageSummary();
|
||||
const branchByLine = fileCoverage.getBranchCoverageByLine();
|
||||
|
||||
this.xml.openTag('file', {
|
||||
name: asClassName(node),
|
||||
path: fileCoverage.path
|
||||
});
|
||||
|
||||
this.writeMetrics(metrics);
|
||||
|
||||
const lines = fileCoverage.getLineCoverage();
|
||||
Object.keys(lines).forEach(k => {
|
||||
const attrs = {
|
||||
num: k,
|
||||
count: lines[k],
|
||||
type: 'stmt'
|
||||
};
|
||||
const branchDetail = branchByLine[k];
|
||||
|
||||
if (branchDetail) {
|
||||
attrs.type = 'cond';
|
||||
attrs.truecount = branchDetail.covered;
|
||||
attrs.falsecount = branchDetail.total - branchDetail.covered;
|
||||
}
|
||||
this.xml.inlineTag('line', attrs);
|
||||
});
|
||||
|
||||
this.xml.closeTag('file');
|
||||
};
|
||||
|
||||
module.exports = CloverReport;
|
||||
|
||||
253
node_modules/istanbul-reports/lib/cobertura/index.js
generated
vendored
253
node_modules/istanbul-reports/lib/cobertura/index.js
generated
vendored
@@ -1,13 +1,138 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const path = require('path');
|
||||
function CoberturaReport(opts) {
|
||||
this.cw = null;
|
||||
this.xml = null;
|
||||
this.projectRoot = opts.projectRoot || process.cwd();
|
||||
this.file = opts.file || 'cobertura-coverage.xml';
|
||||
const { escape } = require('html-escaper');
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
class CoberturaReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
this.cw = null;
|
||||
this.xml = null;
|
||||
this.projectRoot = opts.projectRoot || process.cwd();
|
||||
this.file = opts.file || 'cobertura-coverage.xml';
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.xml = context.getXMLWriter(this.cw);
|
||||
this.writeRootStats(root);
|
||||
}
|
||||
|
||||
onEnd() {
|
||||
this.xml.closeAll();
|
||||
this.cw.close();
|
||||
}
|
||||
|
||||
writeRootStats(node) {
|
||||
const metrics = node.getCoverageSummary();
|
||||
this.cw.println('<?xml version="1.0" ?>');
|
||||
this.cw.println(
|
||||
'<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">'
|
||||
);
|
||||
this.xml.openTag('coverage', {
|
||||
'lines-valid': metrics.lines.total,
|
||||
'lines-covered': metrics.lines.covered,
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branches-valid': metrics.branches.total,
|
||||
'branches-covered': metrics.branches.covered,
|
||||
'branch-rate': metrics.branches.pct / 100.0,
|
||||
timestamp: Date.now().toString(),
|
||||
complexity: '0',
|
||||
version: '0.1'
|
||||
});
|
||||
this.xml.openTag('sources');
|
||||
this.xml.inlineTag('source', null, this.projectRoot);
|
||||
this.xml.closeTag('sources');
|
||||
this.xml.openTag('packages');
|
||||
}
|
||||
|
||||
onSummary(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (!metrics) {
|
||||
return;
|
||||
}
|
||||
this.xml.openTag('package', {
|
||||
name: escape(asJavaPackage(node)),
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branch-rate': metrics.branches.pct / 100.0
|
||||
});
|
||||
this.xml.openTag('classes');
|
||||
}
|
||||
|
||||
onSummaryEnd(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.xml.closeTag('classes');
|
||||
this.xml.closeTag('package');
|
||||
}
|
||||
|
||||
onDetail(node) {
|
||||
const fileCoverage = node.getFileCoverage();
|
||||
const metrics = node.getCoverageSummary();
|
||||
const branchByLine = fileCoverage.getBranchCoverageByLine();
|
||||
|
||||
this.xml.openTag('class', {
|
||||
name: escape(asClassName(node)),
|
||||
filename: path.relative(this.projectRoot, fileCoverage.path),
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branch-rate': metrics.branches.pct / 100.0
|
||||
});
|
||||
|
||||
this.xml.openTag('methods');
|
||||
const fnMap = fileCoverage.fnMap;
|
||||
Object.entries(fnMap).forEach(([k, { name, decl }]) => {
|
||||
const hits = fileCoverage.f[k];
|
||||
this.xml.openTag('method', {
|
||||
name: escape(name),
|
||||
hits,
|
||||
signature: '()V' //fake out a no-args void return
|
||||
});
|
||||
this.xml.openTag('lines');
|
||||
//Add the function definition line and hits so that jenkins cobertura plugin records method hits
|
||||
this.xml.inlineTag('line', {
|
||||
number: decl.start.line,
|
||||
hits
|
||||
});
|
||||
this.xml.closeTag('lines');
|
||||
this.xml.closeTag('method');
|
||||
});
|
||||
this.xml.closeTag('methods');
|
||||
|
||||
this.xml.openTag('lines');
|
||||
const lines = fileCoverage.getLineCoverage();
|
||||
Object.entries(lines).forEach(([k, hits]) => {
|
||||
const attrs = {
|
||||
number: k,
|
||||
hits,
|
||||
branch: 'false'
|
||||
};
|
||||
const branchDetail = branchByLine[k];
|
||||
|
||||
if (branchDetail) {
|
||||
attrs.branch = true;
|
||||
attrs['condition-coverage'] =
|
||||
branchDetail.coverage +
|
||||
'% (' +
|
||||
branchDetail.covered +
|
||||
'/' +
|
||||
branchDetail.total +
|
||||
')';
|
||||
}
|
||||
this.xml.inlineTag('line', attrs);
|
||||
});
|
||||
|
||||
this.xml.closeTag('lines');
|
||||
this.xml.closeTag('class');
|
||||
}
|
||||
}
|
||||
|
||||
function asJavaPackage(node) {
|
||||
@@ -22,122 +147,4 @@ function asClassName(node) {
|
||||
return node.getRelativeName().replace(/.*[\\/]/, '');
|
||||
}
|
||||
|
||||
CoberturaReport.prototype.onStart = function(root, context) {
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.xml = context.getXMLWriter(this.cw);
|
||||
this.writeRootStats(root);
|
||||
};
|
||||
|
||||
CoberturaReport.prototype.onEnd = function() {
|
||||
this.xml.closeAll();
|
||||
this.cw.close();
|
||||
};
|
||||
|
||||
CoberturaReport.prototype.writeRootStats = function(node) {
|
||||
const metrics = node.getCoverageSummary();
|
||||
this.cw.println('<?xml version="1.0" ?>');
|
||||
this.cw.println(
|
||||
'<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">'
|
||||
);
|
||||
this.xml.openTag('coverage', {
|
||||
'lines-valid': metrics.lines.total,
|
||||
'lines-covered': metrics.lines.covered,
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branches-valid': metrics.branches.total,
|
||||
'branches-covered': metrics.branches.covered,
|
||||
'branch-rate': metrics.branches.pct / 100.0,
|
||||
timestamp: Date.now().toString(),
|
||||
complexity: '0',
|
||||
version: '0.1'
|
||||
});
|
||||
this.xml.openTag('sources');
|
||||
this.xml.inlineTag('source', null, this.projectRoot);
|
||||
this.xml.closeTag('sources');
|
||||
this.xml.openTag('packages');
|
||||
};
|
||||
|
||||
CoberturaReport.prototype.onSummary = function(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
const metrics = node.getCoverageSummary(true);
|
||||
if (!metrics) {
|
||||
return;
|
||||
}
|
||||
this.xml.openTag('package', {
|
||||
name: asJavaPackage(node),
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branch-rate': metrics.branches.pct / 100.0
|
||||
});
|
||||
this.xml.openTag('classes');
|
||||
};
|
||||
|
||||
CoberturaReport.prototype.onSummaryEnd = function(node) {
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.xml.closeTag('classes');
|
||||
this.xml.closeTag('package');
|
||||
};
|
||||
|
||||
CoberturaReport.prototype.onDetail = function(node) {
|
||||
const fileCoverage = node.getFileCoverage();
|
||||
const metrics = node.getCoverageSummary();
|
||||
const branchByLine = fileCoverage.getBranchCoverageByLine();
|
||||
|
||||
this.xml.openTag('class', {
|
||||
name: asClassName(node),
|
||||
filename: path.relative(this.projectRoot, fileCoverage.path),
|
||||
'line-rate': metrics.lines.pct / 100.0,
|
||||
'branch-rate': metrics.branches.pct / 100.0
|
||||
});
|
||||
|
||||
this.xml.openTag('methods');
|
||||
const fnMap = fileCoverage.fnMap;
|
||||
Object.keys(fnMap).forEach(k => {
|
||||
const name = fnMap[k].name;
|
||||
const hits = fileCoverage.f[k];
|
||||
this.xml.openTag('method', {
|
||||
name,
|
||||
hits,
|
||||
signature: '()V' //fake out a no-args void return
|
||||
});
|
||||
this.xml.openTag('lines');
|
||||
//Add the function definition line and hits so that jenkins cobertura plugin records method hits
|
||||
this.xml.inlineTag('line', {
|
||||
number: fnMap[k].decl.start.line,
|
||||
hits
|
||||
});
|
||||
this.xml.closeTag('lines');
|
||||
this.xml.closeTag('method');
|
||||
});
|
||||
this.xml.closeTag('methods');
|
||||
|
||||
this.xml.openTag('lines');
|
||||
const lines = fileCoverage.getLineCoverage();
|
||||
Object.keys(lines).forEach(k => {
|
||||
const attrs = {
|
||||
number: k,
|
||||
hits: lines[k],
|
||||
branch: 'false'
|
||||
};
|
||||
const branchDetail = branchByLine[k];
|
||||
|
||||
if (branchDetail) {
|
||||
attrs.branch = true;
|
||||
attrs['condition-coverage'] =
|
||||
branchDetail.coverage +
|
||||
'% (' +
|
||||
branchDetail.covered +
|
||||
'/' +
|
||||
branchDetail.total +
|
||||
')';
|
||||
}
|
||||
this.xml.inlineTag('line', attrs);
|
||||
});
|
||||
|
||||
this.xml.closeTag('lines');
|
||||
this.xml.closeTag('class');
|
||||
};
|
||||
|
||||
module.exports = CoberturaReport;
|
||||
|
||||
3
node_modules/istanbul-reports/lib/html-spa/.babelrc
generated
vendored
Normal file
3
node_modules/istanbul-reports/lib/html-spa/.babelrc
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": [["@babel/preset-env", { "modules": "commonjs" }], "@babel/preset-react"]
|
||||
}
|
||||
30
node_modules/istanbul-reports/lib/html-spa/assets/bundle.js
generated
vendored
Normal file
30
node_modules/istanbul-reports/lib/html-spa/assets/bundle.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
node_modules/istanbul-reports/lib/html-spa/assets/sort-arrow-sprite.png
generated
vendored
Normal file
BIN
node_modules/istanbul-reports/lib/html-spa/assets/sort-arrow-sprite.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 209 B |
298
node_modules/istanbul-reports/lib/html-spa/assets/spa.css
generated
vendored
Normal file
298
node_modules/istanbul-reports/lib/html-spa/assets/spa.css
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
/* Base */
|
||||
|
||||
body,
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #333;
|
||||
background-color: #fcfcfc;
|
||||
font: 14px/14px -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
|
||||
Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 0;
|
||||
border: none;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
*,
|
||||
*:after,
|
||||
*:before {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Typography */
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0074d9;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.quiet {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Colors */
|
||||
|
||||
.low {
|
||||
background: #fce1e5;
|
||||
}
|
||||
|
||||
.low--dark {
|
||||
background: #c21f39;
|
||||
}
|
||||
|
||||
.medium {
|
||||
background: #fff4c2;
|
||||
}
|
||||
|
||||
.medium--dark {
|
||||
background: #f9cd0b;
|
||||
}
|
||||
|
||||
.high {
|
||||
background: rgb(230, 245, 208);
|
||||
}
|
||||
|
||||
.high--dark {
|
||||
background: rgb(77, 146, 33);
|
||||
}
|
||||
|
||||
/* App */
|
||||
|
||||
.app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
|
||||
.layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.layout__section {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
.layout__section--fill {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.layout__section + .layout__section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.col3 {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.hide-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Toolbar */
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.toolbar__item {
|
||||
margin-right: 40px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Toggle */
|
||||
|
||||
.toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.toggle__label {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
.toggle__options {
|
||||
display: inline-block;
|
||||
border: 1px solid #0074d9;
|
||||
border-radius: 4px;
|
||||
color: #0074d9;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.toggle__option {
|
||||
padding: 4px 8px;
|
||||
background: #fcfcfc;
|
||||
}
|
||||
|
||||
.toggle__option + .toggle__option {
|
||||
border-left: 1px solid #0074d9;
|
||||
}
|
||||
|
||||
.toggle__option.is-toggled {
|
||||
color: #fff;
|
||||
background: #0074d9;
|
||||
border-left-color: #fcfcfc;
|
||||
}
|
||||
|
||||
/* Expand */
|
||||
|
||||
.expandbutton {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
margin-right: 0.25em;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Fraction */
|
||||
|
||||
.fraction {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Coverage */
|
||||
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.coverage-summary tbody tr {
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
|
||||
.coverage-summary td,
|
||||
.coverage-summary th {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.coverage-summary th {
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.coverage-summary th.file {
|
||||
min-width: 300px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.coverage-summary td.file {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.coverage-summary td.pct {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.coverage-summary td.abs {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.coverage-summary td.empty {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.coverage-summary .headercell {
|
||||
border-top: 1px solid #eee;
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.coverage-summary .headercell:nth-child(4n - 2),
|
||||
.coverage-summary td:nth-child(4n - 2) {
|
||||
border-left: 2px solid #fcfcfc;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.filetab {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
/* Sorter */
|
||||
|
||||
.sorter {
|
||||
display: inline-block;
|
||||
width: 7px;
|
||||
height: 10px;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
|
||||
.sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
|
||||
.sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
|
||||
.sortable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Bar */
|
||||
|
||||
.bar {
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.bar__data {
|
||||
height: 100%;
|
||||
}
|
||||
175
node_modules/istanbul-reports/lib/html-spa/index.js
generated
vendored
Normal file
175
node_modules/istanbul-reports/lib/html-spa/index.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
const HtmlReport = require('../html');
|
||||
|
||||
const standardLinkMapper = {
|
||||
getPath(node) {
|
||||
if (typeof node === 'string') {
|
||||
return node;
|
||||
}
|
||||
let filePath = node.getQualifiedName();
|
||||
if (node.isSummary()) {
|
||||
if (filePath !== '') {
|
||||
filePath += '/index.html';
|
||||
} else {
|
||||
filePath = 'index.html';
|
||||
}
|
||||
} else {
|
||||
filePath += '.html';
|
||||
}
|
||||
return filePath;
|
||||
},
|
||||
|
||||
relativePath(source, target) {
|
||||
const targetPath = this.getPath(target);
|
||||
const sourcePath = path.dirname(this.getPath(source));
|
||||
return path.relative(sourcePath, targetPath);
|
||||
},
|
||||
|
||||
assetPath(node, name) {
|
||||
return this.relativePath(this.getPath(node), name);
|
||||
}
|
||||
};
|
||||
|
||||
class HtmlSpaReport extends ReportBase {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
// force the summarizer to nested for html-spa
|
||||
summarizer: 'nested'
|
||||
});
|
||||
|
||||
this.verbose = opts.verbose || false;
|
||||
this.linkMapper = opts.linkMapper || standardLinkMapper;
|
||||
this.subdir = opts.subdir || '';
|
||||
this.date = Date();
|
||||
this.skipEmpty = opts.skipEmpty;
|
||||
this.htmlReport = new HtmlReport(opts);
|
||||
this.htmlReport.getBreadcrumbHtml = function() {
|
||||
return '<a href="javascript:history.back()">Back</a>';
|
||||
};
|
||||
|
||||
this.metricsToShow = opts.metricsToShow || [
|
||||
'lines',
|
||||
'branches',
|
||||
'functions'
|
||||
];
|
||||
}
|
||||
|
||||
getWriter(context) {
|
||||
if (!this.subdir) {
|
||||
return context.writer;
|
||||
}
|
||||
return context.writer.writerForDir(this.subdir);
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.htmlReport.onStart(root, context);
|
||||
|
||||
const writer = this.getWriter(context);
|
||||
const srcDir = path.resolve(__dirname, './assets');
|
||||
fs.readdirSync(srcDir).forEach(f => {
|
||||
const resolvedSource = path.resolve(srcDir, f);
|
||||
const resolvedDestination = '.';
|
||||
const stat = fs.statSync(resolvedSource);
|
||||
let dest;
|
||||
|
||||
if (stat.isFile()) {
|
||||
dest = resolvedDestination + '/' + f;
|
||||
if (this.verbose) {
|
||||
console.log('Write asset: ' + dest);
|
||||
}
|
||||
writer.copyFile(resolvedSource, dest);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDetail(node, context) {
|
||||
this.htmlReport.onDetail(node, context);
|
||||
}
|
||||
|
||||
getMetric(metric, type, context) {
|
||||
const isEmpty = metric.total === 0;
|
||||
return {
|
||||
total: metric.total,
|
||||
covered: metric.covered,
|
||||
skipped: metric.skipped,
|
||||
pct: isEmpty ? 0 : metric.pct,
|
||||
classForPercent: isEmpty
|
||||
? 'empty'
|
||||
: context.classForPercent(type, metric.pct)
|
||||
};
|
||||
}
|
||||
|
||||
toDataStructure(node, context) {
|
||||
const coverageSummary = node.getCoverageSummary();
|
||||
const metrics = {
|
||||
statements: this.getMetric(
|
||||
coverageSummary.statements,
|
||||
'statements',
|
||||
context
|
||||
),
|
||||
branches: this.getMetric(
|
||||
coverageSummary.branches,
|
||||
'branches',
|
||||
context
|
||||
),
|
||||
functions: this.getMetric(
|
||||
coverageSummary.functions,
|
||||
'functions',
|
||||
context
|
||||
),
|
||||
lines: this.getMetric(coverageSummary.lines, 'lines', context)
|
||||
};
|
||||
|
||||
return {
|
||||
file: node.getRelativeName(),
|
||||
isEmpty: coverageSummary.isEmpty(),
|
||||
metrics,
|
||||
children:
|
||||
node.isSummary() &&
|
||||
node
|
||||
.getChildren()
|
||||
.map(child => this.toDataStructure(child, context))
|
||||
};
|
||||
}
|
||||
|
||||
onEnd(rootNode, context) {
|
||||
const data = this.toDataStructure(rootNode, context);
|
||||
|
||||
const cw = this.getWriter(context).writeFile(
|
||||
this.linkMapper.getPath(rootNode)
|
||||
);
|
||||
|
||||
cw.write(
|
||||
`<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="spa.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" class="app"></div>
|
||||
<script>
|
||||
window.data = ${JSON.stringify(data)};
|
||||
window.generatedDatetime = ${JSON.stringify(
|
||||
String(Date())
|
||||
)};
|
||||
window.metricsToShow = ${JSON.stringify(
|
||||
this.metricsToShow
|
||||
)};
|
||||
</script>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
</html>`
|
||||
);
|
||||
cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HtmlSpaReport;
|
||||
31
node_modules/istanbul-reports/lib/html-spa/src/fileBreadcrumbs.js
generated
vendored
Normal file
31
node_modules/istanbul-reports/lib/html-spa/src/fileBreadcrumbs.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
const React = require('react');
|
||||
|
||||
module.exports = function FileBreadcrumbs({ fileFilter = '', setFileFilter }) {
|
||||
const parts = fileFilter.split('/');
|
||||
const breadcrumbs = [
|
||||
{
|
||||
path: '',
|
||||
name: 'all files'
|
||||
},
|
||||
...parts.map((part, i) => ({
|
||||
path: parts.slice(0, i + 1).join('/'),
|
||||
name: part
|
||||
}))
|
||||
];
|
||||
|
||||
return breadcrumbs.map(({ path, name }) =>
|
||||
path === fileFilter ? (
|
||||
name
|
||||
) : (
|
||||
<>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onClick={() => setFileFilter(path)}
|
||||
>
|
||||
{name}
|
||||
</a>
|
||||
/
|
||||
</>
|
||||
)
|
||||
);
|
||||
};
|
||||
50
node_modules/istanbul-reports/lib/html-spa/src/filterToggle.js
generated
vendored
Normal file
50
node_modules/istanbul-reports/lib/html-spa/src/filterToggle.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
const React = require('react');
|
||||
|
||||
function ToggleOption({ children, filter, activeFilters, setFilters }) {
|
||||
return (
|
||||
<button
|
||||
className={
|
||||
'toggle__option ' + (activeFilters[filter] ? 'is-toggled' : '')
|
||||
}
|
||||
onClick={() =>
|
||||
setFilters({
|
||||
...activeFilters,
|
||||
[filter]: !activeFilters[filter]
|
||||
})
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = function FilterToggle({ activeFilters, setFilters }) {
|
||||
return (
|
||||
<div className="toggle">
|
||||
<div className="toggle__label">Filter:</div>
|
||||
<div className="toggle__options">
|
||||
<ToggleOption
|
||||
filter="low"
|
||||
activeFilters={activeFilters}
|
||||
setFilters={setFilters}
|
||||
>
|
||||
Low
|
||||
</ToggleOption>
|
||||
<ToggleOption
|
||||
filter="medium"
|
||||
activeFilters={activeFilters}
|
||||
setFilters={setFilters}
|
||||
>
|
||||
Medium
|
||||
</ToggleOption>
|
||||
<ToggleOption
|
||||
filter="high"
|
||||
activeFilters={activeFilters}
|
||||
setFilters={setFilters}
|
||||
>
|
||||
High
|
||||
</ToggleOption>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
25
node_modules/istanbul-reports/lib/html-spa/src/flattenToggle.js
generated
vendored
Normal file
25
node_modules/istanbul-reports/lib/html-spa/src/flattenToggle.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
const React = require('react');
|
||||
|
||||
module.exports = function FlattenButton({ setIsFlat, isFlat }) {
|
||||
return (
|
||||
<div className="toggle">
|
||||
<div className="toggle__label">Files:</div>
|
||||
<div className="toggle__options">
|
||||
<button
|
||||
onClick={() => setIsFlat(!isFlat)}
|
||||
className={
|
||||
'toggle__option ' + (!isFlat ? 'is-toggled' : '')
|
||||
}
|
||||
>
|
||||
Tree
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setIsFlat(!isFlat)}
|
||||
className={'toggle__option ' + (isFlat ? 'is-toggled' : '')}
|
||||
>
|
||||
Flat
|
||||
</button>
|
||||
</div>{' '}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
155
node_modules/istanbul-reports/lib/html-spa/src/getChildData.js
generated
vendored
Normal file
155
node_modules/istanbul-reports/lib/html-spa/src/getChildData.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
function addPath(node, parentPath) {
|
||||
if (!parentPath) {
|
||||
return node;
|
||||
}
|
||||
return { ...node, file: parentPath + '/' + node.file };
|
||||
}
|
||||
|
||||
function flatten(nodes, parentPath) {
|
||||
let children = [];
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const child = nodes[i];
|
||||
if (child.children) {
|
||||
children = [
|
||||
...children,
|
||||
...flatten(
|
||||
child.children,
|
||||
(parentPath ? parentPath + '/' : '') + child.file
|
||||
)
|
||||
];
|
||||
} else {
|
||||
children.push(addPath(child, parentPath));
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
function filterByFile(nodes, fileFilter, parentPath) {
|
||||
let children = [];
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const child = nodes[i];
|
||||
const childFullPath = (parentPath ? parentPath + '/' : '') + child.file;
|
||||
|
||||
const isChildUnderFilter =
|
||||
fileFilter === childFullPath ||
|
||||
fileFilter.indexOf(childFullPath + '/') === 0;
|
||||
const isChildAboveFilter =
|
||||
childFullPath.indexOf(fileFilter + '/') === 0;
|
||||
|
||||
if (isChildUnderFilter) {
|
||||
// flatten and continue looking underneath
|
||||
children = [
|
||||
...children,
|
||||
...filterByFile(child.children, fileFilter, childFullPath)
|
||||
];
|
||||
} else if (isChildAboveFilter) {
|
||||
// remove the parent path and add everything underneath
|
||||
const charsToRemoveFromFile =
|
||||
fileFilter.length - (parentPath ? parentPath.length : 0);
|
||||
let childFilename = child.file.slice(charsToRemoveFromFile);
|
||||
if (childFilename[0] === '/') {
|
||||
childFilename = childFilename.slice(1);
|
||||
}
|
||||
children.push({
|
||||
...child,
|
||||
file: childFilename
|
||||
});
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
function sort(childData, activeSort) {
|
||||
const top = activeSort.order === 'asc' ? 1 : -1;
|
||||
const bottom = activeSort.order === 'asc' ? -1 : 1;
|
||||
childData.sort((a, b) => {
|
||||
let valueA;
|
||||
let valueB;
|
||||
if (activeSort.sortKey === 'file') {
|
||||
valueA = a.file;
|
||||
valueB = b.file;
|
||||
} else {
|
||||
const [metricType, valueType] = activeSort.sortKey.split('.');
|
||||
valueA = a.metrics[metricType][valueType];
|
||||
valueB = b.metrics[metricType][valueType];
|
||||
}
|
||||
|
||||
if (valueA === valueB) {
|
||||
return 0;
|
||||
}
|
||||
return valueA < valueB ? top : bottom;
|
||||
});
|
||||
|
||||
for (let i = 0; i < childData.length; i++) {
|
||||
const child = childData[i];
|
||||
if (child.children) {
|
||||
childData[i] = {
|
||||
...child,
|
||||
children: sort(child.children, activeSort)
|
||||
};
|
||||
}
|
||||
}
|
||||
return childData;
|
||||
}
|
||||
|
||||
function filter(nodes, metricsMap, activeFilters) {
|
||||
const children = [];
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
let child = nodes[i];
|
||||
if (child.children) {
|
||||
const newSubChildren = filter(
|
||||
child.children,
|
||||
metricsMap,
|
||||
activeFilters
|
||||
);
|
||||
if (newSubChildren.length) {
|
||||
child = { ...child, children: newSubChildren };
|
||||
children.push(child);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
(metricsMap.statements &&
|
||||
activeFilters[child.metrics.statements.classForPercent]) ||
|
||||
(metricsMap.branches &&
|
||||
activeFilters[child.metrics.branches.classForPercent]) ||
|
||||
(metricsMap.functions &&
|
||||
activeFilters[child.metrics.functions.classForPercent]) ||
|
||||
(metricsMap.lines &&
|
||||
activeFilters[child.metrics.lines.classForPercent])
|
||||
) {
|
||||
children.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
module.exports = function getChildData(
|
||||
sourceData,
|
||||
metricsToShow,
|
||||
activeSort,
|
||||
isFlat,
|
||||
activeFilters,
|
||||
fileFilter
|
||||
) {
|
||||
let childData = sourceData.children;
|
||||
|
||||
if (isFlat) {
|
||||
childData = flatten(childData.slice(0));
|
||||
}
|
||||
|
||||
if (fileFilter) {
|
||||
childData = filterByFile(childData, fileFilter);
|
||||
}
|
||||
|
||||
if (activeFilters.low) {
|
||||
activeFilters = { ...activeFilters, empty: true };
|
||||
}
|
||||
childData = filter(childData, metricsToShow, activeFilters);
|
||||
|
||||
if (activeSort) {
|
||||
childData = sort(childData, activeSort);
|
||||
}
|
||||
return childData;
|
||||
};
|
||||
156
node_modules/istanbul-reports/lib/html-spa/src/index.js
generated
vendored
Normal file
156
node_modules/istanbul-reports/lib/html-spa/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
// The index file for the spa running on the summary page
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const SummaryTableHeader = require('./summaryTableHeader');
|
||||
const SummaryTableLine = require('./summaryTableLine');
|
||||
const SummaryHeader = require('./summaryHeader');
|
||||
const getChildData = require('./getChildData');
|
||||
const FlattenToggle = require('./flattenToggle');
|
||||
const FilterToggle = require('./filterToggle');
|
||||
const FileBreadcrumbs = require('./fileBreadcrumbs');
|
||||
const { setLocation, decodeLocation } = require('./routing');
|
||||
|
||||
const { useState, useMemo, useEffect } = React;
|
||||
|
||||
const sourceData = window.data;
|
||||
const metricsToShow = {};
|
||||
for (let i = 0; i < window.metricsToShow.length; i++) {
|
||||
metricsToShow[window.metricsToShow[i]] = true;
|
||||
}
|
||||
|
||||
let firstMount = true;
|
||||
|
||||
function App() {
|
||||
const routingDefaults = decodeLocation();
|
||||
|
||||
const [activeSort, setSort] = useState(
|
||||
(routingDefaults && routingDefaults.activeSort) || {
|
||||
sortKey: 'file',
|
||||
order: 'desc'
|
||||
}
|
||||
);
|
||||
const [isFlat, setIsFlat] = useState(
|
||||
(routingDefaults && routingDefaults.isFlat) || false
|
||||
);
|
||||
const [activeFilters, setFilters] = useState(
|
||||
(routingDefaults && routingDefaults.activeFilters) || {
|
||||
low: true,
|
||||
medium: true,
|
||||
high: true
|
||||
}
|
||||
);
|
||||
const [expandedLines, setExpandedLines] = useState(
|
||||
(routingDefaults && routingDefaults.expandedLines) || []
|
||||
);
|
||||
const [fileFilter, setFileFilter] = useState(
|
||||
(routingDefaults && routingDefaults.fileFilter) || ''
|
||||
);
|
||||
const childData = useMemo(
|
||||
() =>
|
||||
getChildData(
|
||||
sourceData,
|
||||
metricsToShow,
|
||||
activeSort,
|
||||
isFlat,
|
||||
activeFilters,
|
||||
fileFilter
|
||||
),
|
||||
[activeSort, isFlat, activeFilters, fileFilter]
|
||||
);
|
||||
const overallMetrics = sourceData.metrics;
|
||||
|
||||
useEffect(() => {
|
||||
setLocation(
|
||||
firstMount,
|
||||
activeSort,
|
||||
isFlat,
|
||||
activeFilters,
|
||||
fileFilter,
|
||||
expandedLines
|
||||
);
|
||||
firstMount = false;
|
||||
}, [activeSort, isFlat, activeFilters, fileFilter, expandedLines]);
|
||||
|
||||
useEffect(() => {
|
||||
window.onpopstate = () => {
|
||||
const routingState = decodeLocation();
|
||||
if (routingState) {
|
||||
// make sure all the state is set before rendering to avoid url updates
|
||||
// alternative is to merge all the states into one so it can be set in one go
|
||||
// https://github.com/facebook/react/issues/14259
|
||||
ReactDOM.unstable_batchedUpdates(() => {
|
||||
setFilters(routingState.activeFilters);
|
||||
setSort(routingState.activeSort);
|
||||
setIsFlat(routingState.isFlat);
|
||||
setExpandedLines(routingState.expandedLines);
|
||||
setFileFilter(routingState.fileFilter);
|
||||
});
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="layout">
|
||||
<div className="layout__section">
|
||||
<SummaryHeader
|
||||
metrics={overallMetrics}
|
||||
metricsToShow={metricsToShow}
|
||||
/>
|
||||
</div>
|
||||
<div className="layout__section">
|
||||
<div className="toolbar">
|
||||
<div className="toolbar__item">
|
||||
<FlattenToggle setIsFlat={setIsFlat} isFlat={isFlat} />
|
||||
</div>
|
||||
<div className="toolbar__item">
|
||||
<FilterToggle
|
||||
activeFilters={activeFilters}
|
||||
setFilters={setFilters}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="layout__section">
|
||||
<h1>
|
||||
<FileBreadcrumbs
|
||||
fileFilter={fileFilter}
|
||||
setFileFilter={setFileFilter}
|
||||
/>
|
||||
</h1>
|
||||
</div>
|
||||
<div className="layout__section layout__section--fill">
|
||||
<table className="coverage-summary">
|
||||
<SummaryTableHeader
|
||||
onSort={newSort => {
|
||||
setSort(newSort);
|
||||
}}
|
||||
activeSort={activeSort}
|
||||
metricsToShow={metricsToShow}
|
||||
/>
|
||||
<tbody>
|
||||
{childData.map(child => (
|
||||
<SummaryTableLine
|
||||
{...child}
|
||||
key={child.file}
|
||||
metricsToShow={metricsToShow}
|
||||
expandedLines={expandedLines}
|
||||
setExpandedLines={setExpandedLines}
|
||||
fileFilter={fileFilter}
|
||||
setFileFilter={setFileFilter}
|
||||
/>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="layout__section center small quiet">
|
||||
Code coverage generated by{' '}
|
||||
<a href="https://istanbul.js.org/" target="_blank">
|
||||
istanbul
|
||||
</a>{' '}
|
||||
at {window.generatedDatetime}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('app'));
|
||||
52
node_modules/istanbul-reports/lib/html-spa/src/routing.js
generated
vendored
Normal file
52
node_modules/istanbul-reports/lib/html-spa/src/routing.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
exports.setLocation = function setLocation(
|
||||
isReplace,
|
||||
activeSort,
|
||||
isFlat,
|
||||
activeFilters,
|
||||
fileFilter,
|
||||
expandedLines
|
||||
) {
|
||||
const params = [
|
||||
activeSort.sortKey,
|
||||
activeSort.order,
|
||||
isFlat,
|
||||
activeFilters.low,
|
||||
activeFilters.medium,
|
||||
activeFilters.high,
|
||||
encodeURIComponent(fileFilter),
|
||||
expandedLines.map(encodeURIComponent).join(',')
|
||||
];
|
||||
const newUrl = `#${params.join('/')}`;
|
||||
|
||||
if (newUrl === location.hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.history[isReplace ? 'replaceState' : 'pushState'](null, '', newUrl);
|
||||
};
|
||||
|
||||
exports.decodeLocation = function decodeLocation() {
|
||||
const items = location.hash.substr(1).split('/');
|
||||
if (items.length !== 8) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return {
|
||||
activeSort: {
|
||||
sortKey: items[0],
|
||||
order: items[1]
|
||||
},
|
||||
isFlat: JSON.parse(items[2]),
|
||||
activeFilters: {
|
||||
low: JSON.parse(items[3]),
|
||||
medium: JSON.parse(items[4]),
|
||||
high: JSON.parse(items[5])
|
||||
},
|
||||
fileFilter: decodeURIComponent(items[6]),
|
||||
expandedLines: items[7].split(',').map(decodeURIComponent)
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
63
node_modules/istanbul-reports/lib/html-spa/src/summaryHeader.js
generated
vendored
Normal file
63
node_modules/istanbul-reports/lib/html-spa/src/summaryHeader.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
const React = require('react');
|
||||
|
||||
function Ignores({ metrics, metricsToShow }) {
|
||||
const metricKeys = Object.keys(metricsToShow);
|
||||
const result = [];
|
||||
|
||||
for (let i = 0; i < metricKeys.length; i++) {
|
||||
const metricKey = metricKeys[i];
|
||||
if (metricsToShow[metricKey]) {
|
||||
const skipped = metrics[metricKey].skipped;
|
||||
if (skipped > 0) {
|
||||
result.push(
|
||||
`${skipped} ${metricKey}${
|
||||
skipped === 1 ? '' : metricKey === 'branch' ? 'es' : 's'
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="toolbar__item">
|
||||
<span className="strong">{result.join(', ')}</span>
|
||||
<span className="quiet">Ignored</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function StatusMetric({ data, name }) {
|
||||
return (
|
||||
<div className="toolbar__item">
|
||||
<span className="strong">{data.pct}%</span>{' '}
|
||||
<span className="quiet">{name}</span>{' '}
|
||||
<span className={'fraction ' + data.classForPercent}>
|
||||
{data.covered}/{data.total}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = function SummaryHeader({ metrics, metricsToShow }) {
|
||||
return (
|
||||
<div className="toolbar">
|
||||
{metricsToShow.statements && (
|
||||
<StatusMetric data={metrics.statements} name="Statements" />
|
||||
)}
|
||||
{metricsToShow.branches && (
|
||||
<StatusMetric data={metrics.branches} name="Branches" />
|
||||
)}
|
||||
{metricsToShow.functions && (
|
||||
<StatusMetric data={metrics.functions} name="Functions" />
|
||||
)}
|
||||
{metricsToShow.lines && (
|
||||
<StatusMetric data={metrics.lines} name="Lines" />
|
||||
)}
|
||||
<Ignores metrics={metrics} metricsToShow={metricsToShow} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
124
node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js
generated
vendored
Normal file
124
node_modules/istanbul-reports/lib/html-spa/src/summaryTableHeader.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
const React = require('react');
|
||||
|
||||
function getSortDetails(sortKey, activeSort) {
|
||||
let newSort = { sortKey, order: 'desc' };
|
||||
let sortClass = '';
|
||||
if (activeSort && activeSort.sortKey === sortKey) {
|
||||
sortClass = 'sorted';
|
||||
if (activeSort.order === 'desc') {
|
||||
sortClass += '-desc';
|
||||
newSort.order = 'asc';
|
||||
} else {
|
||||
if (sortKey !== 'file') {
|
||||
newSort = { sortKey: 'file', order: 'desc' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
newSort,
|
||||
sortClass
|
||||
};
|
||||
}
|
||||
|
||||
function SummaryTableHeaderCell({ name, onSort, sortKey, activeSort }) {
|
||||
const { newSort, sortClass } = getSortDetails(sortKey, activeSort);
|
||||
return (
|
||||
<th
|
||||
className={'sortable headercell ' + sortClass}
|
||||
onClick={() => onSort(newSort)}
|
||||
>
|
||||
{name}
|
||||
<span className="sorter" />
|
||||
</th>
|
||||
);
|
||||
}
|
||||
|
||||
function FileHeaderCell({ onSort, activeSort }) {
|
||||
const { newSort, sortClass } = getSortDetails('file', activeSort);
|
||||
|
||||
return (
|
||||
<th
|
||||
className={'sortable file ' + sortClass}
|
||||
onClick={() => onSort(newSort)}
|
||||
>
|
||||
File
|
||||
<span className="sorter" />
|
||||
</th>
|
||||
);
|
||||
}
|
||||
|
||||
function SubHeadings({ sortKeyPrefix, onSort, activeSort }) {
|
||||
return (
|
||||
<>
|
||||
<SummaryTableHeaderCell
|
||||
name="%"
|
||||
onSort={onSort}
|
||||
sortKey={sortKeyPrefix + '.pct'}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
<th className="headercell"></th>
|
||||
<SummaryTableHeaderCell
|
||||
name="Covered"
|
||||
onSort={onSort}
|
||||
sortKey={sortKeyPrefix + '.covered'}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
<SummaryTableHeaderCell
|
||||
name="Total"
|
||||
onSort={onSort}
|
||||
sortKey={sortKeyPrefix + '.total'}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = function SummaryTableHeader({
|
||||
onSort,
|
||||
activeSort,
|
||||
metricsToShow
|
||||
}) {
|
||||
return (
|
||||
<thead>
|
||||
<tr className="topheading">
|
||||
<th></th>
|
||||
{metricsToShow.statements && <th colSpan={4}>Statements</th>}
|
||||
{metricsToShow.branches && <th colSpan={4}>Branches</th>}
|
||||
{metricsToShow.functions && <th colSpan={4}>Functions</th>}
|
||||
{metricsToShow.lines && <th colSpan={4}>Lines</th>}
|
||||
</tr>
|
||||
<tr className="subheading">
|
||||
<FileHeaderCell onSort={onSort} activeSort={activeSort} />
|
||||
{metricsToShow.statements && (
|
||||
<SubHeadings
|
||||
sortKeyPrefix="statements"
|
||||
onSort={onSort}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
)}
|
||||
{metricsToShow.branches && (
|
||||
<SubHeadings
|
||||
sortKeyPrefix="branches"
|
||||
onSort={onSort}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
)}
|
||||
{metricsToShow.functions && (
|
||||
<SubHeadings
|
||||
sortKeyPrefix="functions"
|
||||
onSort={onSort}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
)}
|
||||
{metricsToShow.lines && (
|
||||
<SubHeadings
|
||||
sortKeyPrefix="lines"
|
||||
onSort={onSort}
|
||||
activeSort={activeSort}
|
||||
/>
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
);
|
||||
};
|
||||
158
node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js
generated
vendored
Normal file
158
node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
const React = require('react');
|
||||
|
||||
function MetricCells({ metrics }) {
|
||||
const { classForPercent, pct, covered, total } = metrics;
|
||||
|
||||
return (
|
||||
<>
|
||||
<td className={'pct ' + classForPercent}>{Math.round(pct)}% </td>
|
||||
<td className={classForPercent}>
|
||||
<div className="bar">
|
||||
<div
|
||||
className={`bar__data ${classForPercent} ${classForPercent}--dark`}
|
||||
style={{ width: pct + '%' }}
|
||||
></div>
|
||||
</div>
|
||||
</td>
|
||||
<td className={'abs ' + classForPercent}>{covered}</td>
|
||||
<td className={'abs ' + classForPercent}>{total}</td>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function FileCell({
|
||||
file,
|
||||
prefix,
|
||||
expandedLines,
|
||||
setExpandedLines,
|
||||
hasChildren,
|
||||
setFileFilter
|
||||
}) {
|
||||
if (hasChildren) {
|
||||
const expandedIndex = expandedLines.indexOf(prefix + file);
|
||||
const isExpanded = expandedIndex >= 0;
|
||||
const newExpandedLines = isExpanded
|
||||
? [
|
||||
...expandedLines.slice(0, expandedIndex),
|
||||
...expandedLines.slice(expandedIndex + 1)
|
||||
]
|
||||
: [...expandedLines, prefix + file];
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setExpandedLines(newExpandedLines)}
|
||||
className="expandbutton"
|
||||
>
|
||||
{isExpanded ? String.fromCharCode(0x2013) : '+'}
|
||||
</button>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onClick={() => setFileFilter(prefix + file)}
|
||||
>
|
||||
{file}
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return <a href={`./${prefix}${file}.html`}>{file}</a>;
|
||||
}
|
||||
}
|
||||
|
||||
function getWorstMetricClassForPercent(metricsToShow, metrics) {
|
||||
let classForPercent = 'none';
|
||||
for (const metricToShow in metricsToShow) {
|
||||
if (metricsToShow[metricToShow]) {
|
||||
const metricClassForPercent = metrics[metricToShow].classForPercent;
|
||||
|
||||
// ignore none metrics so they don't change whats shown
|
||||
if (metricClassForPercent === 'none') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if the metric low or lower than whats currently being used, replace it
|
||||
if (
|
||||
metricClassForPercent == 'low' ||
|
||||
(metricClassForPercent === 'medium' &&
|
||||
classForPercent !== 'low') ||
|
||||
(metricClassForPercent === 'high' &&
|
||||
classForPercent !== 'low' &&
|
||||
classForPercent !== 'medium')
|
||||
) {
|
||||
classForPercent = metricClassForPercent;
|
||||
}
|
||||
}
|
||||
}
|
||||
return classForPercent;
|
||||
}
|
||||
|
||||
module.exports = function SummaryTableLine({
|
||||
prefix,
|
||||
metrics,
|
||||
file,
|
||||
children,
|
||||
tabSize,
|
||||
metricsToShow,
|
||||
expandedLines,
|
||||
setExpandedLines,
|
||||
fileFilter,
|
||||
setFileFilter
|
||||
}) {
|
||||
tabSize = tabSize || 0;
|
||||
if (children && tabSize > 0) {
|
||||
tabSize--;
|
||||
}
|
||||
prefix = (fileFilter ? fileFilter + '/' : '') + (prefix || '');
|
||||
|
||||
return (
|
||||
<>
|
||||
<tr>
|
||||
<td
|
||||
className={
|
||||
'file ' +
|
||||
getWorstMetricClassForPercent(metricsToShow, metrics)
|
||||
}
|
||||
>
|
||||
{/* eslint-disable-line prefer-spread */ Array.apply(null, {
|
||||
length: tabSize
|
||||
}).map((nothing, index) => (
|
||||
<span className="filetab" key={index} />
|
||||
))}
|
||||
<FileCell
|
||||
file={file}
|
||||
prefix={prefix}
|
||||
expandedLines={expandedLines}
|
||||
setExpandedLines={setExpandedLines}
|
||||
hasChildren={Boolean(children)}
|
||||
setFileFilter={setFileFilter}
|
||||
/>
|
||||
</td>
|
||||
{metricsToShow.statements && (
|
||||
<MetricCells metrics={metrics.statements} />
|
||||
)}
|
||||
{metricsToShow.branches && (
|
||||
<MetricCells metrics={metrics.branches} />
|
||||
)}
|
||||
{metricsToShow.functions && (
|
||||
<MetricCells metrics={metrics.functions} />
|
||||
)}
|
||||
{metricsToShow.lines && <MetricCells metrics={metrics.lines} />}
|
||||
</tr>
|
||||
{children &&
|
||||
expandedLines.indexOf(prefix + file) >= 0 &&
|
||||
children.map(child => (
|
||||
<SummaryTableLine
|
||||
{...child}
|
||||
tabSize={tabSize + 2}
|
||||
key={child.file}
|
||||
prefix={prefix + file + '/'}
|
||||
metricsToShow={metricsToShow}
|
||||
expandedLines={expandedLines}
|
||||
setExpandedLines={setExpandedLines}
|
||||
setFileFilter={setFileFilter}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
22
node_modules/istanbul-reports/lib/html-spa/webpack.config.js
generated
vendored
Normal file
22
node_modules/istanbul-reports/lib/html-spa/webpack.config.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, 'src/index.js'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'assets'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
12
node_modules/istanbul-reports/lib/html/annotator.js
generated
vendored
12
node_modules/istanbul-reports/lib/html/annotator.js
generated
vendored
@@ -34,8 +34,7 @@ function annotateLines(fileCoverage, structuredText) {
|
||||
if (!lineStats) {
|
||||
return;
|
||||
}
|
||||
Object.keys(lineStats).forEach(lineNumber => {
|
||||
const count = lineStats[lineNumber];
|
||||
Object.entries(lineStats).forEach(([lineNumber, count]) => {
|
||||
if (structuredText[lineNumber]) {
|
||||
structuredText[lineNumber].covered = count > 0 ? 'yes' : 'no';
|
||||
structuredText[lineNumber].hits = count;
|
||||
@@ -46,8 +45,7 @@ function annotateLines(fileCoverage, structuredText) {
|
||||
function annotateStatements(fileCoverage, structuredText) {
|
||||
const statementStats = fileCoverage.s;
|
||||
const statementMeta = fileCoverage.statementMap;
|
||||
Object.keys(statementStats).forEach(stName => {
|
||||
const count = statementStats[stName];
|
||||
Object.entries(statementStats).forEach(([stName, count]) => {
|
||||
const meta = statementMeta[stName];
|
||||
const type = count > 0 ? 'yes' : 'no';
|
||||
const startCol = meta.start.column;
|
||||
@@ -85,8 +83,7 @@ function annotateFunctions(fileCoverage, structuredText) {
|
||||
if (!fnStats) {
|
||||
return;
|
||||
}
|
||||
Object.keys(fnStats).forEach(fName => {
|
||||
const count = fnStats[fName];
|
||||
Object.entries(fnStats).forEach(([fName, count]) => {
|
||||
const meta = fnMeta[fName];
|
||||
const type = count > 0 ? 'yes' : 'no';
|
||||
const startCol = meta.decl.start.column;
|
||||
@@ -125,8 +122,7 @@ function annotateBranches(fileCoverage, structuredText) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(branchStats).forEach(branchName => {
|
||||
const branchArray = branchStats[branchName];
|
||||
Object.entries(branchStats).forEach(([branchName, branchArray]) => {
|
||||
const sumCount = branchArray.reduce((p, n) => p + n, 0);
|
||||
const metaArray = branchMeta[branchName].locations;
|
||||
let i;
|
||||
|
||||
BIN
node_modules/istanbul-reports/lib/html/assets/favicon.png
generated
vendored
Normal file
BIN
node_modules/istanbul-reports/lib/html/assets/favicon.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 540 B |
14
node_modules/istanbul-reports/lib/html/index.js
generated
vendored
14
node_modules/istanbul-reports/lib/html/index.js
generated
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
@@ -5,6 +6,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const html = require('html-escaper');
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
const annotator = require('./annotator');
|
||||
|
||||
function htmlHead(details) {
|
||||
@@ -14,7 +16,10 @@ function htmlHead(details) {
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="${html.escape(details.prettify.css)}" />
|
||||
<link rel="stylesheet" href="${html.escape(details.base.css)}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="${html.escape(
|
||||
details.favicon
|
||||
)}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(${html.escape(details.sorter.image)});
|
||||
@@ -230,7 +235,7 @@ const standardLinkMapper = {
|
||||
relativePath(source, target) {
|
||||
const targetPath = this.getPath(target);
|
||||
const sourcePath = path.dirname(this.getPath(source));
|
||||
return path.relative(sourcePath, targetPath);
|
||||
return path.posix.relative(sourcePath, targetPath);
|
||||
},
|
||||
|
||||
assetPath(node, name) {
|
||||
@@ -245,8 +250,10 @@ function fixPct(metrics) {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
class HtmlReport {
|
||||
class HtmlReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
this.verbose = opts.verbose;
|
||||
this.linkMapper = opts.linkMapper || standardLinkMapper;
|
||||
this.subdir = opts.subdir || '';
|
||||
@@ -299,6 +306,7 @@ class HtmlReport {
|
||||
js: linkMapper.assetPath(node, 'prettify.js'),
|
||||
css: linkMapper.assetPath(node, 'prettify.css')
|
||||
};
|
||||
templateData.favicon = linkMapper.assetPath(node, 'favicon.png');
|
||||
}
|
||||
|
||||
getTemplateData() {
|
||||
|
||||
1
node_modules/istanbul-reports/lib/html/insertion-text.js
generated
vendored
1
node_modules/istanbul-reports/lib/html/insertion-text.js
generated
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
|
||||
86
node_modules/istanbul-reports/lib/json-summary/index.js
generated
vendored
86
node_modules/istanbul-reports/lib/json-summary/index.js
generated
vendored
@@ -3,46 +3,54 @@
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
function JsonSummaryReport(opts) {
|
||||
this.file = opts.file || 'coverage-summary.json';
|
||||
this.contentWriter = null;
|
||||
this.first = true;
|
||||
class JsonSummaryReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
this.file = opts.file || 'coverage-summary.json';
|
||||
this.contentWriter = null;
|
||||
this.first = true;
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
this.contentWriter.write('{');
|
||||
}
|
||||
|
||||
writeSummary(filePath, sc) {
|
||||
const cw = this.contentWriter;
|
||||
if (this.first) {
|
||||
this.first = false;
|
||||
} else {
|
||||
cw.write(',');
|
||||
}
|
||||
cw.write(JSON.stringify(filePath));
|
||||
cw.write(': ');
|
||||
cw.write(JSON.stringify(sc));
|
||||
cw.println('');
|
||||
}
|
||||
|
||||
onSummary(node) {
|
||||
if (!node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.writeSummary('total', node.getCoverageSummary());
|
||||
}
|
||||
|
||||
onDetail(node) {
|
||||
this.writeSummary(
|
||||
node.getFileCoverage().path,
|
||||
node.getCoverageSummary()
|
||||
);
|
||||
}
|
||||
|
||||
onEnd() {
|
||||
const cw = this.contentWriter;
|
||||
cw.println('}');
|
||||
cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
JsonSummaryReport.prototype.onStart = function(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
this.contentWriter.write('{');
|
||||
};
|
||||
|
||||
JsonSummaryReport.prototype.writeSummary = function(filePath, sc) {
|
||||
const cw = this.contentWriter;
|
||||
if (this.first) {
|
||||
this.first = false;
|
||||
} else {
|
||||
cw.write(',');
|
||||
}
|
||||
cw.write(JSON.stringify(filePath));
|
||||
cw.write(': ');
|
||||
cw.write(JSON.stringify(sc));
|
||||
cw.println('');
|
||||
};
|
||||
|
||||
JsonSummaryReport.prototype.onSummary = function(node) {
|
||||
if (!node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
this.writeSummary('total', node.getCoverageSummary());
|
||||
};
|
||||
|
||||
JsonSummaryReport.prototype.onDetail = function(node) {
|
||||
this.writeSummary(node.getFileCoverage().path, node.getCoverageSummary());
|
||||
};
|
||||
|
||||
JsonSummaryReport.prototype.onEnd = function() {
|
||||
const cw = this.contentWriter;
|
||||
cw.println('}');
|
||||
cw.close();
|
||||
};
|
||||
|
||||
module.exports = JsonSummaryReport;
|
||||
|
||||
65
node_modules/istanbul-reports/lib/json/index.js
generated
vendored
65
node_modules/istanbul-reports/lib/json/index.js
generated
vendored
@@ -3,37 +3,42 @@
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
function JsonReport(opts) {
|
||||
this.file = opts.file || 'coverage-final.json';
|
||||
this.first = true;
|
||||
class JsonReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
this.file = opts.file || 'coverage-final.json';
|
||||
this.first = true;
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
this.contentWriter.write('{');
|
||||
}
|
||||
|
||||
onDetail(node) {
|
||||
const fc = node.getFileCoverage();
|
||||
const key = fc.path;
|
||||
const cw = this.contentWriter;
|
||||
|
||||
if (this.first) {
|
||||
this.first = false;
|
||||
} else {
|
||||
cw.write(',');
|
||||
}
|
||||
cw.write(JSON.stringify(key));
|
||||
cw.write(': ');
|
||||
cw.write(JSON.stringify(fc));
|
||||
cw.println('');
|
||||
}
|
||||
|
||||
onEnd() {
|
||||
const cw = this.contentWriter;
|
||||
cw.println('}');
|
||||
cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
JsonReport.prototype.onStart = function(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
this.contentWriter.write('{');
|
||||
};
|
||||
|
||||
JsonReport.prototype.onDetail = function(node) {
|
||||
const fc = node.getFileCoverage();
|
||||
const key = fc.path;
|
||||
const cw = this.contentWriter;
|
||||
|
||||
if (this.first) {
|
||||
this.first = false;
|
||||
} else {
|
||||
cw.write(',');
|
||||
}
|
||||
cw.write(JSON.stringify(key));
|
||||
cw.write(': ');
|
||||
cw.write(JSON.stringify(fc));
|
||||
cw.println('');
|
||||
};
|
||||
|
||||
JsonReport.prototype.onEnd = function() {
|
||||
const cw = this.contentWriter;
|
||||
cw.println('}');
|
||||
cw.close();
|
||||
};
|
||||
|
||||
module.exports = JsonReport;
|
||||
|
||||
11
node_modules/istanbul-reports/lib/lcov/index.js
generated
vendored
11
node_modules/istanbul-reports/lib/lcov/index.js
generated
vendored
@@ -1,13 +1,18 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
const LcovOnlyReport = require('../lcovonly');
|
||||
const HtmlReport = require('../html');
|
||||
|
||||
function LcovReport() {
|
||||
this.lcov = new LcovOnlyReport({ file: 'lcov.info' });
|
||||
this.html = new HtmlReport({ subdir: 'lcov-report' });
|
||||
class LcovReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
this.lcov = new LcovOnlyReport({ file: 'lcov.info', ...opts });
|
||||
this.html = new HtmlReport({ subdir: 'lcov-report' });
|
||||
}
|
||||
}
|
||||
|
||||
['Start', 'End', 'Summary', 'SummaryEnd', 'Detail'].forEach(what => {
|
||||
|
||||
118
node_modules/istanbul-reports/lib/lcovonly/index.js
generated
vendored
118
node_modules/istanbul-reports/lib/lcovonly/index.js
generated
vendored
@@ -3,66 +3,66 @@
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
function LcovOnlyReport(opts) {
|
||||
this.file = opts.file || 'lcov.info';
|
||||
this.contentWriter = null;
|
||||
class LcovOnlyReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
this.file = opts.file || 'lcov.info';
|
||||
this.projectRoot = opts.projectRoot || process.cwd();
|
||||
this.contentWriter = null;
|
||||
}
|
||||
|
||||
onStart(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
}
|
||||
|
||||
onDetail(node) {
|
||||
const fc = node.getFileCoverage();
|
||||
const writer = this.contentWriter;
|
||||
const functions = fc.f;
|
||||
const functionMap = fc.fnMap;
|
||||
const lines = fc.getLineCoverage();
|
||||
const branches = fc.b;
|
||||
const branchMap = fc.branchMap;
|
||||
const summary = node.getCoverageSummary();
|
||||
const path = require('path');
|
||||
|
||||
writer.println('TN:'); //no test nam
|
||||
writer.println('SF:' + path.relative(this.projectRoot, fc.path));
|
||||
|
||||
Object.values(functionMap).forEach(meta => {
|
||||
writer.println('FN:' + [meta.decl.start.line, meta.name].join(','));
|
||||
});
|
||||
writer.println('FNF:' + summary.functions.total);
|
||||
writer.println('FNH:' + summary.functions.covered);
|
||||
|
||||
Object.entries(functionMap).forEach(([key, meta]) => {
|
||||
const stats = functions[key];
|
||||
writer.println('FNDA:' + [stats, meta.name].join(','));
|
||||
});
|
||||
|
||||
Object.entries(lines).forEach(entry => {
|
||||
writer.println('DA:' + entry.join(','));
|
||||
});
|
||||
writer.println('LF:' + summary.lines.total);
|
||||
writer.println('LH:' + summary.lines.covered);
|
||||
|
||||
Object.entries(branches).forEach(([key, branchArray]) => {
|
||||
const meta = branchMap[key];
|
||||
const { line } = meta.loc.start;
|
||||
branchArray.forEach((b, i) => {
|
||||
writer.println('BRDA:' + [line, key, i, b].join(','));
|
||||
});
|
||||
});
|
||||
writer.println('BRF:' + summary.branches.total);
|
||||
writer.println('BRH:' + summary.branches.covered);
|
||||
writer.println('end_of_record');
|
||||
}
|
||||
|
||||
onEnd() {
|
||||
this.contentWriter.close();
|
||||
}
|
||||
}
|
||||
|
||||
LcovOnlyReport.prototype.onStart = function(root, context) {
|
||||
this.contentWriter = context.writer.writeFile(this.file);
|
||||
};
|
||||
|
||||
LcovOnlyReport.prototype.onDetail = function(node) {
|
||||
const fc = node.getFileCoverage();
|
||||
const writer = this.contentWriter;
|
||||
const functions = fc.f;
|
||||
const functionMap = fc.fnMap;
|
||||
const lines = fc.getLineCoverage();
|
||||
const branches = fc.b;
|
||||
const branchMap = fc.branchMap;
|
||||
const summary = node.getCoverageSummary();
|
||||
|
||||
writer.println('TN:'); //no test name
|
||||
writer.println('SF:' + fc.path);
|
||||
|
||||
Object.keys(functionMap).forEach(key => {
|
||||
const meta = functionMap[key];
|
||||
writer.println('FN:' + [meta.decl.start.line, meta.name].join(','));
|
||||
});
|
||||
writer.println('FNF:' + summary.functions.total);
|
||||
writer.println('FNH:' + summary.functions.covered);
|
||||
|
||||
Object.keys(functionMap).forEach(key => {
|
||||
const stats = functions[key];
|
||||
const meta = functionMap[key];
|
||||
writer.println('FNDA:' + [stats, meta.name].join(','));
|
||||
});
|
||||
|
||||
Object.keys(lines).forEach(key => {
|
||||
const stat = lines[key];
|
||||
writer.println('DA:' + [key, stat].join(','));
|
||||
});
|
||||
writer.println('LF:' + summary.lines.total);
|
||||
writer.println('LH:' + summary.lines.covered);
|
||||
|
||||
Object.keys(branches).forEach(key => {
|
||||
const branchArray = branches[key];
|
||||
const meta = branchMap[key];
|
||||
const line = meta.loc.start.line;
|
||||
let i = 0;
|
||||
branchArray.forEach(b => {
|
||||
writer.println('BRDA:' + [line, key, i, b].join(','));
|
||||
i += 1;
|
||||
});
|
||||
});
|
||||
writer.println('BRF:' + summary.branches.total);
|
||||
writer.println('BRH:' + summary.branches.covered);
|
||||
writer.println('end_of_record');
|
||||
};
|
||||
|
||||
LcovOnlyReport.prototype.onEnd = function() {
|
||||
this.contentWriter.close();
|
||||
};
|
||||
|
||||
module.exports = LcovOnlyReport;
|
||||
|
||||
5
node_modules/istanbul-reports/lib/none/index.js
generated
vendored
5
node_modules/istanbul-reports/lib/none/index.js
generated
vendored
@@ -1,7 +1,10 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
function NoneReport() {}
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
class NoneReport extends ReportBase {}
|
||||
|
||||
module.exports = NoneReport;
|
||||
|
||||
83
node_modules/istanbul-reports/lib/teamcity/index.js
generated
vendored
83
node_modules/istanbul-reports/lib/teamcity/index.js
generated
vendored
@@ -3,11 +3,55 @@
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
function TeamcityReport(opts) {
|
||||
opts = opts || {};
|
||||
this.file = opts.file || null;
|
||||
this.blockName = opts.blockName || 'Code Coverage Summary';
|
||||
class TeamcityReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
opts = opts || {};
|
||||
this.file = opts.file || null;
|
||||
this.blockName = opts.blockName || 'Code Coverage Summary';
|
||||
}
|
||||
|
||||
onStart(node, context) {
|
||||
const metrics = node.getCoverageSummary();
|
||||
const cw = context.writer.writeFile(this.file);
|
||||
|
||||
cw.println('');
|
||||
cw.println("##teamcity[blockOpened name='" + this.blockName + "']");
|
||||
|
||||
//Statements Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.statements.covered, 'CodeCoverageAbsBCovered')
|
||||
);
|
||||
cw.println(
|
||||
lineForKey(metrics.statements.total, 'CodeCoverageAbsBTotal')
|
||||
);
|
||||
|
||||
//Branches Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.branches.covered, 'CodeCoverageAbsRCovered')
|
||||
);
|
||||
cw.println(lineForKey(metrics.branches.total, 'CodeCoverageAbsRTotal'));
|
||||
|
||||
//Functions Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.functions.covered, 'CodeCoverageAbsMCovered')
|
||||
);
|
||||
cw.println(
|
||||
lineForKey(metrics.functions.total, 'CodeCoverageAbsMTotal')
|
||||
);
|
||||
|
||||
//Lines Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.lines.covered, 'CodeCoverageAbsLCovered')
|
||||
);
|
||||
cw.println(lineForKey(metrics.lines.total, 'CodeCoverageAbsLTotal'));
|
||||
|
||||
cw.println("##teamcity[blockClosed name='" + this.blockName + "']");
|
||||
cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
function lineForKey(value, teamcityVar) {
|
||||
@@ -20,35 +64,4 @@ function lineForKey(value, teamcityVar) {
|
||||
);
|
||||
}
|
||||
|
||||
TeamcityReport.prototype.onStart = function(node, context) {
|
||||
const metrics = node.getCoverageSummary();
|
||||
const cw = context.writer.writeFile(this.file);
|
||||
|
||||
cw.println('');
|
||||
cw.println("##teamcity[blockOpened name='" + this.blockName + "']");
|
||||
|
||||
//Statements Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.statements.covered, 'CodeCoverageAbsBCovered')
|
||||
);
|
||||
cw.println(lineForKey(metrics.statements.total, 'CodeCoverageAbsBTotal'));
|
||||
|
||||
//Branches Covered
|
||||
cw.println(lineForKey(metrics.branches.covered, 'CodeCoverageAbsRCovered'));
|
||||
cw.println(lineForKey(metrics.branches.total, 'CodeCoverageAbsRTotal'));
|
||||
|
||||
//Functions Covered
|
||||
cw.println(
|
||||
lineForKey(metrics.functions.covered, 'CodeCoverageAbsMCovered')
|
||||
);
|
||||
cw.println(lineForKey(metrics.functions.total, 'CodeCoverageAbsMTotal'));
|
||||
|
||||
//Lines Covered
|
||||
cw.println(lineForKey(metrics.lines.covered, 'CodeCoverageAbsLCovered'));
|
||||
cw.println(lineForKey(metrics.lines.total, 'CodeCoverageAbsLTotal'));
|
||||
|
||||
cw.println("##teamcity[blockClosed name='" + this.blockName + "']");
|
||||
cw.close();
|
||||
};
|
||||
|
||||
module.exports = TeamcityReport;
|
||||
|
||||
13
node_modules/istanbul-reports/lib/text-lcov/index.js
generated
vendored
13
node_modules/istanbul-reports/lib/text-lcov/index.js
generated
vendored
@@ -1,14 +1,17 @@
|
||||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const util = require('util');
|
||||
const LcovOnly = require('../lcovonly');
|
||||
|
||||
function TextLcov(opts) {
|
||||
opts.file = '-';
|
||||
LcovOnly.call(this, opts);
|
||||
class TextLcov extends LcovOnly {
|
||||
constructor(opts) {
|
||||
super({
|
||||
...opts,
|
||||
file: '-'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
util.inherits(TextLcov, LcovOnly);
|
||||
module.exports = TextLcov;
|
||||
|
||||
57
node_modules/istanbul-reports/lib/text-summary/index.js
generated
vendored
57
node_modules/istanbul-reports/lib/text-summary/index.js
generated
vendored
@@ -3,10 +3,38 @@
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
function TextSummaryReport(opts) {
|
||||
opts = opts || {};
|
||||
this.file = opts.file || null;
|
||||
class TextSummaryReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
opts = opts || {};
|
||||
this.file = opts.file || null;
|
||||
}
|
||||
|
||||
onStart(node, context) {
|
||||
const summary = node.getCoverageSummary();
|
||||
const cw = context.writer.writeFile(this.file);
|
||||
const printLine = function(key) {
|
||||
const str = lineForKey(summary, key);
|
||||
const clazz = context.classForPercent(key, summary[key].pct);
|
||||
cw.println(cw.colorize(str, clazz));
|
||||
};
|
||||
|
||||
cw.println('');
|
||||
cw.println(
|
||||
'=============================== Coverage summary ==============================='
|
||||
);
|
||||
printLine('statements');
|
||||
printLine('branches');
|
||||
printLine('functions');
|
||||
printLine('lines');
|
||||
cw.println(
|
||||
'================================================================================'
|
||||
);
|
||||
cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
function lineForKey(summary, key) {
|
||||
@@ -31,27 +59,4 @@ function lineForKey(summary, key) {
|
||||
return result;
|
||||
}
|
||||
|
||||
TextSummaryReport.prototype.onStart = function(node, context) {
|
||||
const summary = node.getCoverageSummary();
|
||||
const cw = context.writer.writeFile(this.file);
|
||||
const printLine = function(key) {
|
||||
const str = lineForKey(summary, key);
|
||||
const clazz = context.classForPercent(key, summary[key].pct);
|
||||
cw.println(cw.colorize(str, clazz));
|
||||
};
|
||||
|
||||
cw.println('');
|
||||
cw.println(
|
||||
'=============================== Coverage summary ==============================='
|
||||
);
|
||||
printLine('statements');
|
||||
printLine('branches');
|
||||
printLine('functions');
|
||||
printLine('lines');
|
||||
cw.println(
|
||||
'================================================================================'
|
||||
);
|
||||
cw.close();
|
||||
};
|
||||
|
||||
module.exports = TextSummaryReport;
|
||||
|
||||
259
node_modules/istanbul-reports/lib/text/index.js
generated
vendored
259
node_modules/istanbul-reports/lib/text/index.js
generated
vendored
@@ -1,14 +1,16 @@
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE
|
||||
file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
const { ReportBase } = require('istanbul-lib-report');
|
||||
|
||||
const PCT_COLS = 9;
|
||||
const MISSING_COL = 18;
|
||||
const NAME_COL = 4;
|
||||
const PCT_COLS = 7;
|
||||
const MISSING_COL = 17;
|
||||
const TAB_SIZE = 1;
|
||||
const DELIM = ' |';
|
||||
const COL_DELIM = '-|';
|
||||
const DELIM = ' | ';
|
||||
|
||||
function padding(num, ch) {
|
||||
let str = '';
|
||||
@@ -28,17 +30,21 @@ function fill(str, width, right, tabs) {
|
||||
const remaining = width - leadingSpaces;
|
||||
const leader = padding(leadingSpaces);
|
||||
let fmtStr = '';
|
||||
let fillStr;
|
||||
const strlen = str.length;
|
||||
|
||||
if (remaining > 0) {
|
||||
const strlen = str.length;
|
||||
let fillStr;
|
||||
|
||||
if (remaining >= strlen) {
|
||||
fillStr = padding(remaining - strlen);
|
||||
fmtStr = right ? fillStr + str : str + fillStr;
|
||||
} else {
|
||||
fmtStr = str.substring(strlen - remaining);
|
||||
fmtStr = '... ' + fmtStr.substring(4);
|
||||
fillStr = '...';
|
||||
const length = remaining - fillStr.length;
|
||||
|
||||
str = str.substring(strlen - length);
|
||||
right = true;
|
||||
}
|
||||
fmtStr = right ? fillStr + str : str + fillStr;
|
||||
}
|
||||
|
||||
return leader + fmtStr;
|
||||
@@ -52,6 +58,53 @@ function formatPct(pct, width) {
|
||||
return fill(pct, width || PCT_COLS, true, 0);
|
||||
}
|
||||
|
||||
function nodeMissing(node) {
|
||||
if (node.isSummary()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const metrics = node.getCoverageSummary();
|
||||
const isEmpty = metrics.isEmpty();
|
||||
const lines = isEmpty ? 0 : metrics.lines.pct;
|
||||
|
||||
let coveredLines;
|
||||
|
||||
const fileCoverage = node.getFileCoverage();
|
||||
if (lines === 100) {
|
||||
const branches = fileCoverage.getBranchCoverageByLine();
|
||||
coveredLines = Object.entries(branches).map(([key, { coverage }]) => [
|
||||
key,
|
||||
coverage === 100
|
||||
]);
|
||||
} else {
|
||||
coveredLines = Object.entries(fileCoverage.getLineCoverage());
|
||||
}
|
||||
|
||||
let newRange = true;
|
||||
const ranges = coveredLines
|
||||
.reduce((acum, [line, hit]) => {
|
||||
if (hit) newRange = true;
|
||||
else {
|
||||
line = parseInt(line);
|
||||
if (newRange) {
|
||||
acum.push([line]);
|
||||
newRange = false;
|
||||
} else acum[acum.length - 1][1] = line;
|
||||
}
|
||||
|
||||
return acum;
|
||||
}, [])
|
||||
.map(range => {
|
||||
const { length } = range;
|
||||
|
||||
if (length === 1) return range[0];
|
||||
|
||||
return `${range[0]}-${range[1]}`;
|
||||
});
|
||||
|
||||
return [].concat(...ranges).join(',');
|
||||
}
|
||||
|
||||
function nodeName(node) {
|
||||
return node.getRelativeName() || 'All files';
|
||||
}
|
||||
@@ -66,67 +119,49 @@ function depthFor(node) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function findNameWidth(node, context) {
|
||||
function nullDepthFor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function findWidth(node, context, nodeExtractor, depthFor = nullDepthFor) {
|
||||
let last = 0;
|
||||
const compareWidth = function(node) {
|
||||
const depth = depthFor(node);
|
||||
const idealWidth = TAB_SIZE * depth + nodeName(node).length;
|
||||
if (idealWidth > last) {
|
||||
last = idealWidth;
|
||||
}
|
||||
};
|
||||
function compareWidth(node) {
|
||||
last = Math.max(
|
||||
last,
|
||||
TAB_SIZE * depthFor(node) + nodeExtractor(node).length
|
||||
);
|
||||
}
|
||||
const visitor = {
|
||||
onSummary(node) {
|
||||
compareWidth(node);
|
||||
},
|
||||
onDetail(node) {
|
||||
compareWidth(node);
|
||||
}
|
||||
onSummary: compareWidth,
|
||||
onDetail: compareWidth
|
||||
};
|
||||
node.visit(context.getVisitor(visitor));
|
||||
return last;
|
||||
}
|
||||
|
||||
function makeLine(nameWidth) {
|
||||
function makeLine(nameWidth, missingWidth) {
|
||||
const name = padding(nameWidth, '-');
|
||||
const pct = padding(PCT_COLS, '-');
|
||||
const elements = [];
|
||||
|
||||
elements.push(name);
|
||||
elements.push(pct);
|
||||
elements.push(padding(PCT_COLS + 1, '-'));
|
||||
elements.push(pct);
|
||||
elements.push(pct);
|
||||
elements.push(pct);
|
||||
elements.push(padding(MISSING_COL, '-'));
|
||||
return elements.join(COL_DELIM) + COL_DELIM;
|
||||
elements.push(padding(missingWidth, '-'));
|
||||
return elements.join(DELIM.replace(/ /g, '-')) + '-';
|
||||
}
|
||||
|
||||
function tableHeader(maxNameCols) {
|
||||
function tableHeader(maxNameCols, missingWidth) {
|
||||
const elements = [];
|
||||
elements.push(formatName('File', maxNameCols, 0));
|
||||
elements.push(formatPct('% Stmts'));
|
||||
elements.push(formatPct('% Branch'));
|
||||
elements.push(formatPct('% Branch', PCT_COLS + 1));
|
||||
elements.push(formatPct('% Funcs'));
|
||||
elements.push(formatPct('% Lines'));
|
||||
elements.push(formatPct('Uncovered Line #s', MISSING_COL));
|
||||
return elements.join(' |') + ' |';
|
||||
}
|
||||
|
||||
function missingLines(node, colorizer) {
|
||||
const missingLines = node.isSummary()
|
||||
? []
|
||||
: node.getFileCoverage().getUncoveredLines();
|
||||
return colorizer(formatPct(missingLines.join(','), MISSING_COL), 'low');
|
||||
}
|
||||
|
||||
function missingBranches(node, colorizer) {
|
||||
const branches = node.isSummary()
|
||||
? {}
|
||||
: node.getFileCoverage().getBranchCoverageByLine();
|
||||
const missingLines = Object.keys(branches)
|
||||
.filter(key => branches[key].coverage < 100)
|
||||
.map(key => key);
|
||||
return colorizer(formatPct(missingLines.join(','), MISSING_COL), 'medium');
|
||||
elements.push(formatName('Uncovered Line #s', missingWidth));
|
||||
return elements.join(DELIM) + ' ';
|
||||
}
|
||||
|
||||
function isFull(metrics) {
|
||||
@@ -145,7 +180,8 @@ function tableRow(
|
||||
maxNameCols,
|
||||
level,
|
||||
skipEmpty,
|
||||
skipFull
|
||||
skipFull,
|
||||
missingWidth
|
||||
) {
|
||||
const name = nodeName(node);
|
||||
const metrics = node.getCoverageSummary();
|
||||
@@ -174,66 +210,89 @@ function tableRow(
|
||||
|
||||
elements.push(colorize(formatName(name, maxNameCols, level), 'statements'));
|
||||
elements.push(colorize(formatPct(mm.statements), 'statements'));
|
||||
elements.push(colorize(formatPct(mm.branches), 'branches'));
|
||||
elements.push(colorize(formatPct(mm.branches, PCT_COLS + 1), 'branches'));
|
||||
elements.push(colorize(formatPct(mm.functions), 'functions'));
|
||||
elements.push(colorize(formatPct(mm.lines), 'lines'));
|
||||
if (mm.lines === 100) {
|
||||
elements.push(missingBranches(node, colorizer));
|
||||
} else {
|
||||
elements.push(missingLines(node, colorizer));
|
||||
elements.push(
|
||||
colorizer(
|
||||
formatName(nodeMissing(node), missingWidth),
|
||||
mm.lines === 100 ? 'medium' : 'low'
|
||||
)
|
||||
);
|
||||
|
||||
return elements.join(DELIM) + ' ';
|
||||
}
|
||||
|
||||
class TextReport extends ReportBase {
|
||||
constructor(opts) {
|
||||
super();
|
||||
|
||||
opts = opts || {};
|
||||
const { maxCols } = opts;
|
||||
|
||||
this.file = opts.file || null;
|
||||
this.maxCols = maxCols != null ? maxCols : process.stdout.columns || 80;
|
||||
this.cw = null;
|
||||
this.skipEmpty = opts.skipEmpty;
|
||||
this.skipFull = opts.skipFull;
|
||||
}
|
||||
return elements.join(DELIM) + DELIM;
|
||||
}
|
||||
|
||||
function TextReport(opts) {
|
||||
opts = opts || {};
|
||||
this.file = opts.file || null;
|
||||
this.maxCols = opts.maxCols || 0;
|
||||
this.cw = null;
|
||||
this.skipEmpty = opts.skipEmpty;
|
||||
this.skipFull = opts.skipFull;
|
||||
}
|
||||
onStart(root, context) {
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.nameWidth = Math.max(
|
||||
NAME_COL,
|
||||
findWidth(root, context, nodeName, depthFor)
|
||||
);
|
||||
this.missingWidth = Math.max(
|
||||
MISSING_COL,
|
||||
findWidth(root, context, nodeMissing)
|
||||
);
|
||||
|
||||
TextReport.prototype.onStart = function(root, context) {
|
||||
const statsWidth = 4 * (PCT_COLS + 2) + MISSING_COL;
|
||||
if (this.maxCols > 0) {
|
||||
const pct_cols = DELIM.length + 4 * (PCT_COLS + DELIM.length) + 2;
|
||||
|
||||
this.cw = context.writer.writeFile(this.file);
|
||||
this.nameWidth = findNameWidth(root, context);
|
||||
if (this.maxCols > 0) {
|
||||
const maxRemaining = this.maxCols - statsWidth - 2;
|
||||
if (this.nameWidth > maxRemaining) {
|
||||
this.nameWidth = maxRemaining;
|
||||
const maxRemaining = this.maxCols - (pct_cols + MISSING_COL);
|
||||
if (this.nameWidth > maxRemaining) {
|
||||
this.nameWidth = maxRemaining;
|
||||
this.missingWidth = MISSING_COL;
|
||||
} else if (this.nameWidth < maxRemaining) {
|
||||
const maxRemaining = this.maxCols - (this.nameWidth + pct_cols);
|
||||
if (this.missingWidth > maxRemaining) {
|
||||
this.missingWidth = maxRemaining;
|
||||
}
|
||||
}
|
||||
}
|
||||
const line = makeLine(this.nameWidth, this.missingWidth);
|
||||
this.cw.println(line);
|
||||
this.cw.println(tableHeader(this.nameWidth, this.missingWidth));
|
||||
this.cw.println(line);
|
||||
}
|
||||
|
||||
onSummary(node, context) {
|
||||
const nodeDepth = depthFor(node);
|
||||
const row = tableRow(
|
||||
node,
|
||||
context,
|
||||
this.cw.colorize.bind(this.cw),
|
||||
this.nameWidth,
|
||||
nodeDepth,
|
||||
this.skipEmpty,
|
||||
this.skipFull,
|
||||
this.missingWidth
|
||||
);
|
||||
if (row) {
|
||||
this.cw.println(row);
|
||||
}
|
||||
}
|
||||
const line = makeLine(this.nameWidth);
|
||||
this.cw.println(line);
|
||||
this.cw.println(tableHeader(this.nameWidth));
|
||||
this.cw.println(line);
|
||||
};
|
||||
|
||||
TextReport.prototype.onSummary = function(node, context) {
|
||||
const nodeDepth = depthFor(node);
|
||||
const row = tableRow(
|
||||
node,
|
||||
context,
|
||||
this.cw.colorize.bind(this.cw),
|
||||
this.nameWidth,
|
||||
nodeDepth,
|
||||
this.skipEmpty,
|
||||
this.skipFull
|
||||
);
|
||||
if (row) {
|
||||
this.cw.println(row);
|
||||
onDetail(node, context) {
|
||||
return this.onSummary(node, context);
|
||||
}
|
||||
};
|
||||
|
||||
TextReport.prototype.onDetail = function(node, context) {
|
||||
return this.onSummary(node, context);
|
||||
};
|
||||
|
||||
TextReport.prototype.onEnd = function() {
|
||||
this.cw.println(makeLine(this.nameWidth));
|
||||
this.cw.close();
|
||||
};
|
||||
onEnd() {
|
||||
this.cw.println(makeLine(this.nameWidth, this.missingWidth));
|
||||
this.cw.close();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TextReport;
|
||||
|
||||
58
node_modules/istanbul-reports/package.json
generated
vendored
58
node_modules/istanbul-reports/package.json
generated
vendored
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "istanbul-reports@^2.2.6",
|
||||
"_id": "istanbul-reports@2.2.7",
|
||||
"_from": "istanbul-reports@^3.0.2",
|
||||
"_id": "istanbul-reports@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==",
|
||||
"_integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==",
|
||||
"_location": "/istanbul-reports",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "istanbul-reports@^2.2.6",
|
||||
"raw": "istanbul-reports@^3.0.2",
|
||||
"name": "istanbul-reports",
|
||||
"escapedName": "istanbul-reports",
|
||||
"rawSpec": "^2.2.6",
|
||||
"rawSpec": "^3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.2.6"
|
||||
"fetchSpec": "^3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@jest/reporters"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz",
|
||||
"_shasum": "5d939f6237d7b48393cc0959eab40cd4fd056931",
|
||||
"_spec": "istanbul-reports@^2.2.6",
|
||||
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@jest/reporters",
|
||||
"_resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz",
|
||||
"_shasum": "d593210e5000683750cb09fc0644e4b6e27fd53b",
|
||||
"_spec": "istanbul-reports@^3.0.2",
|
||||
"_where": "/home/codespace/workspace/upload-google-play/node_modules/@jest/reporters",
|
||||
"author": {
|
||||
"name": "Krishnan Anantheswaran",
|
||||
"email": "kananthmail-github@yahoo.com"
|
||||
@@ -31,21 +31,34 @@
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"html-escaper": "^2.0.0"
|
||||
"html-escaper": "^2.0.0",
|
||||
"istanbul-lib-report": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "istanbul reports",
|
||||
"devDependencies": {
|
||||
"istanbul-lib-coverage": "^2.0.5",
|
||||
"istanbul-lib-report": "^2.0.8"
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/preset-env": "^7.7.5",
|
||||
"@babel/preset-react": "^7.7.4",
|
||||
"babel-loader": "^8.0.6",
|
||||
"chai": "^4.2.0",
|
||||
"is-windows": "^1.0.2",
|
||||
"istanbul-lib-coverage": "^3.0.0",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^15.0.0-beta.2",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "73c25ce79f91010d1ff073aa6ff3fd01114f90db",
|
||||
"homepage": "https://istanbul.js.org/",
|
||||
"keywords": [
|
||||
"istanbul",
|
||||
@@ -54,12 +67,23 @@
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"name": "istanbul-reports",
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"lib/html/assets/**",
|
||||
"lib/html-spa/assets/**",
|
||||
"lib/html-spa/rollup.config.js",
|
||||
"test/**"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git"
|
||||
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
|
||||
"directory": "packages/istanbul-reports"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --recursive"
|
||||
"prepare": "webpack --config lib/html-spa/webpack.config.js --mode production",
|
||||
"prepare:watch": "webpack --config lib/html-spa/webpack.config.js --watch --mode development",
|
||||
"test": "nyc --nycrc-path=../../monorepo-per-package-nycrc.json mocha --recursive"
|
||||
},
|
||||
"version": "2.2.7"
|
||||
"version": "3.0.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user