refactor: move brother_node development artifact to dev/test-nodes subdirectory

Development Artifact Cleanup:
 BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location
- dev/test-nodes/brother_node/: Moved from root directory for better organization
- Contains development configuration, test logs, and test chain data
- No impact on production systems - purely development/testing artifact

 DEVELOPMENT ARTIFACTS IDENTIFIED:
- Chain ID: aitbc-brother-chain (test/development chain)
- Ports: 8010 (P2P) and 8011 (RPC) - different from production
- Environment: .env file with test configuration
- Logs: rpc.log and node.log from development testing session (March 15, 2026)

 ROOT DIRECTORY CLEANUP: Removed development clutter from production directory
- brother_node/ moved to dev/test-nodes/brother_node/
- Root directory now contains only production-ready components
- Development artifacts properly organized in dev/ subdirectory

DIRECTORY STRUCTURE IMPROVEMENT:
📁 dev/test-nodes/: Development and testing node configurations
🏗️ Root Directory: Clean production structure with only essential components
🧪 Development Isolation: Test environments separated from production

BENEFITS:
 Clean Production Directory: No development artifacts in root
 Better Organization: Development nodes grouped in dev/ subdirectory
 Clear Separation: Production vs development environments clearly distinguished
 Maintainability: Easier to identify and manage development components

RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
2026-03-30 17:09:06 +02:00
parent bf730dcb4a
commit 816e258d4c
11734 changed files with 2001707 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=copy-assets.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"copy-assets.d.ts","sourceRoot":"","sources":["../../src/copy-assets.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,11 @@
import { cp } from "node:fs/promises";
import path from "node:path";
async function copyFolder(from, to) {
const src = path.resolve(from);
const dest = path.resolve(to);
await cp(src, dest, { recursive: true, force: true });
console.log(`Copied folder from ${src} -> ${dest}`);
}
// eslint-disable-next-line no-restricted-syntax -- allow in this post build script
await copyFolder(path.resolve(process.cwd(), "src", "coverage-module", "istanbul-reports", "lib", "html", "assets"), path.resolve(process.cwd(), "dist", "src", "coverage-module", "istanbul-reports", "lib", "html", "assets"));
//# sourceMappingURL=copy-assets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"copy-assets.js","sourceRoot":"","sources":["../../src/copy-assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,EAAU;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAE9B,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,OAAO,IAAI,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,CACd,IAAI,CAAC,OAAO,CACV,OAAO,CAAC,GAAG,EAAE,EACb,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,QAAQ,CACT,EACD,IAAI,CAAC,OAAO,CACV,OAAO,CAAC,GAAG,EAAE,EACb,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,QAAQ,CACT,CACF,CAAC"}

View File

@@ -0,0 +1,25 @@
"use strict";
// Contains code copied from html-escaper (https://github.com/WebReflection/html-escaper).
// The link to the original license is in the VENDORED.md file in the parent directory.
const { replace } = "";
// escape
const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
const ca = /[&<>'"]/g;
const esca = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
"'": "&#39;",
'"': "&quot;",
};
const pe = (m) => esca[m];
/**
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
* @param {string} es the input to safely escape
* @returns {string} the escaped input, and it **throws** an error if
* the input type is unexpected, except for boolean and numbers,
* converted as string.
*/
const escape = (es) => replace.call(es, ca, pe);
exports.escape = escape;
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/coverage-module/html-escaper/index.cjs"],"names":[],"mappings":";AAAA,0FAA0F;AAC1F,uFAAuF;AAEvF,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAEvB,SAAS;AACT,MAAM,EAAE,GAAG,gDAAgD,CAAC;AAC5D,MAAM,EAAE,GAAG,UAAU,CAAC;AAEtB,MAAM,IAAI,GAAG;IACX,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,QAAQ;CACd,CAAC;AACF,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAChD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC"}

View File

@@ -0,0 +1,9 @@
/**
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
* @param {string} es the input to safely escape
* @returns {string} the escaped input, and it **throws** an error if
* the input type is unexpected, except for boolean and numbers,
* converted as string.
*/
export function escape(es: string): string;
//# sourceMappingURL=index.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/coverage-module/html-escaper/index.cjs"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,2BALW,MAAM,GACJ,MAAM,CAI4B"}

View File

@@ -0,0 +1,5 @@
import istanbulLibCoverage from "./istanbul-lib-coverage/index.cjs";
import istanbulLibReport from "./istanbul-lib-report/index.cjs";
import istanbulReports from "./istanbul-reports/index.cjs";
export { istanbulLibCoverage, istanbulLibReport, istanbulReports };
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/coverage-module/index.js"],"names":[],"mappings":"gCAAgC,mCAAmC;8BAGrC,iCAAiC;4BAGnC,8BAA8B"}

View File

@@ -0,0 +1,7 @@
import istanbulLibCoverage from "./istanbul-lib-coverage/index.cjs";
export { istanbulLibCoverage };
import istanbulLibReport from "./istanbul-lib-report/index.cjs";
export { istanbulLibReport };
import istanbulReports from "./istanbul-reports/index.cjs";
export { istanbulReports };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/coverage-module/index.js"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,CAAC"}

View File

@@ -0,0 +1,64 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
/**
* istanbul-lib-coverage exports an API that allows you to create and manipulate
* file coverage, coverage maps (a set of file coverage objects) and summary
* coverage objects. File coverage for the same file can be merged as can
* entire coverage maps.
*
* @module Exports
*/
const { FileCoverage } = require("./lib/file-coverage.cjs");
const { CoverageMap } = require("./lib/coverage-map.cjs");
const { CoverageSummary } = require("./lib/coverage-summary.cjs");
module.exports = {
/**
* creates a coverage summary object
* @param {Object} obj an argument with the same semantics
* as the one passed to the `CoverageSummary` constructor
* @returns {CoverageSummary}
*/
createCoverageSummary(obj) {
if (obj && obj instanceof CoverageSummary) {
return obj;
}
return new CoverageSummary(obj);
},
/**
* creates a CoverageMap object
* @param {Object} obj optional - an argument with the same semantics
* as the one passed to the CoverageMap constructor.
* @returns {CoverageMap}
*/
createCoverageMap(obj) {
if (obj && obj instanceof CoverageMap) {
return obj;
}
return new CoverageMap(obj);
},
/**
* creates a FileCoverage object
* @param {Object} obj optional - an argument with the same semantics
* as the one passed to the FileCoverage constructor.
* @returns {FileCoverage}
*/
createFileCoverage(obj) {
if (obj && obj instanceof FileCoverage) {
return obj;
}
return new FileCoverage(obj);
},
};
/** classes exported for reuse */
module.exports.classes = {
/**
* the file coverage constructor
*/
FileCoverage,
};
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-lib-coverage/index.cjs"],"names":[],"mappings":"AAAA,uIAAuI;AACvI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC5D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC1D,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAElE,MAAM,CAAC,OAAO,GAAG;IACf;;;;;OAKG;IACH,qBAAqB,CAAC,GAAG;QACvB,IAAI,GAAG,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;YAC1C,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD;;;;;OAKG;IACH,iBAAiB,CAAC,GAAG;QACnB,IAAI,GAAG,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;YACtC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD;;;;;OAKG;IACH,kBAAkB,CAAC,GAAG;QACpB,IAAI,GAAG,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;YACvC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC;AAEF,iCAAiC;AACjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG;IACvB;;OAEG;IACH,YAAY;CACb,CAAC"}

View File

@@ -0,0 +1,28 @@
import { CoverageSummary } from "./lib/coverage-summary.cjs";
import { CoverageMap } from "./lib/coverage-map.cjs";
import { FileCoverage } from "./lib/file-coverage.cjs";
/**
* creates a coverage summary object
* @param {Object} obj an argument with the same semantics
* as the one passed to the `CoverageSummary` constructor
* @returns {CoverageSummary}
*/
export function createCoverageSummary(obj: Object): CoverageSummary;
/**
* creates a CoverageMap object
* @param {Object} obj optional - an argument with the same semantics
* as the one passed to the CoverageMap constructor.
* @returns {CoverageMap}
*/
export function createCoverageMap(obj: Object): CoverageMap;
/**
* creates a FileCoverage object
* @param {Object} obj optional - an argument with the same semantics
* as the one passed to the FileCoverage constructor.
* @returns {FileCoverage}
*/
export function createFileCoverage(obj: Object): FileCoverage;
export namespace classes {
export { FileCoverage };
}
//# sourceMappingURL=index.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-lib-coverage/index.cjs"],"names":[],"mappings":";;;AAsBE;;;;;GAKG;AACH,2CAJW,MAAM,GAEJ,eAAe,CAO3B;AACD;;;;;GAKG;AACH,uCAJW,MAAM,GAEJ,WAAW,CAOvB;AACD;;;;;GAKG;AACH,wCAJW,MAAM,GAEJ,YAAY,CAOxB"}

View File

@@ -0,0 +1,117 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const { FileCoverage } = require("./file-coverage.cjs");
const { CoverageSummary } = require("./coverage-summary.cjs");
function maybeConstruct(obj, klass) {
if (obj instanceof klass) {
return obj;
}
return new klass(obj);
}
function loadMap(source) {
const data = Object.create(null);
if (!source) {
return data;
}
Object.entries(source).forEach(([k, cov]) => {
data[k] = maybeConstruct(cov, FileCoverage);
});
return data;
}
/** CoverageMap is a map of `FileCoverage` objects keyed by file paths. */
class CoverageMap {
/**
* @constructor
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
* map's contents. This can be the raw global coverage object.
*/
constructor(obj) {
if (obj instanceof CoverageMap) {
this.data = obj.data;
}
else {
this.data = loadMap(obj);
}
}
/**
* merges a second coverage map into this one
* @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged
* correctly for the same files and additional file coverage keys are created
* as needed.
*/
merge(obj) {
const other = maybeConstruct(obj, CoverageMap);
Object.values(other.data).forEach((fc) => {
this.addFileCoverage(fc);
});
}
/**
* filter the coveragemap based on the callback provided
* @param {Function (filename)} callback - Returns true if the path
* should be included in the coveragemap. False if it should be
* removed.
*/
filter(callback) {
Object.keys(this.data).forEach((k) => {
if (!callback(k)) {
delete this.data[k];
}
});
}
/**
* returns a JSON-serializable POJO for this coverage map
* @returns {Object}
*/
toJSON() {
return this.data;
}
/**
* returns an array for file paths for which this map has coverage
* @returns {Array{string}} - array of files
*/
files() {
return Object.keys(this.data);
}
/**
* returns the file coverage for the specified file.
* @param {String} file
* @returns {FileCoverage}
*/
fileCoverageFor(file) {
const fc = this.data[file];
if (!fc) {
throw new Error(`No file coverage available for: ${file}`);
}
return fc;
}
addFileCoverage(fc) {
const cov = new FileCoverage(fc);
const { path } = cov;
if (this.data[path]) {
this.data[path].merge(cov);
}
else {
this.data[path] = cov;
}
}
/**
* returns the coverage summary for all the file coverage objects in this map.
* @returns {CoverageSummary}
*/
getCoverageSummary() {
const ret = new CoverageSummary();
Object.values(this.data).forEach((fc) => {
ret.merge(fc.toSummary());
});
return ret;
}
}
module.exports = {
CoverageMap,
};
//# sourceMappingURL=coverage-map.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"coverage-map.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/coverage-map.cjs"],"names":[],"mappings":"AAAA,uIAAuI;AACvI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACxD,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE9D,SAAS,cAAc,CAAC,GAAG,EAAE,KAAK;IAChC,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,OAAO,CAAC,MAAM;IACrB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE;QAC1C,IAAI,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0EAA0E;AAC1E,MAAM,WAAW;IACf;;;;OAIG;IACH,YAAY,GAAG;QACb,IAAI,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,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QACrB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QACxB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,kBAAkB;QAChB,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACtC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG;IACf,WAAW;CACZ,CAAC"}

View File

@@ -0,0 +1,49 @@
/** CoverageMap is a map of `FileCoverage` objects keyed by file paths. */
export class CoverageMap {
/**
* @constructor
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
* map's contents. This can be the raw global coverage object.
*/
constructor(obj?: Object);
data: any;
/**
* merges a second coverage map into this one
* @param {CoverageMap} obj - a CoverageMap or its raw data. Coverage is merged
* correctly for the same files and additional file coverage keys are created
* as needed.
*/
merge(obj: CoverageMap): void;
/**
* filter the coveragemap based on the callback provided
* @param {Function (filename)} callback - Returns true if the path
* should be included in the coveragemap. False if it should be
* removed.
*/
filter(callback: any): void;
/**
* returns a JSON-serializable POJO for this coverage map
* @returns {Object}
*/
toJSON(): Object;
/**
* returns an array for file paths for which this map has coverage
* @returns {Array{string}} - array of files
*/
files(): any[];
/**
* returns the file coverage for the specified file.
* @param {String} file
* @returns {FileCoverage}
*/
fileCoverageFor(file: string): FileCoverage;
addFileCoverage(fc: any): void;
/**
* returns the coverage summary for all the file coverage objects in this map.
* @returns {CoverageSummary}
*/
getCoverageSummary(): CoverageSummary;
}
import { FileCoverage } from "./file-coverage.cjs";
import { CoverageSummary } from "./coverage-summary.cjs";
//# sourceMappingURL=coverage-map.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"coverage-map.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/coverage-map.cjs"],"names":[],"mappings":"AAiCA,0EAA0E;AAC1E;IACE;;;;OAIG;IACH,kBAHW,MAAM,EAShB;IAJG,UAAoB;IAMxB;;;;;OAKG;IACH,WAJW,WAAW,QASrB;IAED;;;;;OAKG;IACH,4BAMC;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,eAEC;IAED;;;;OAIG;IACH,+BAFa,YAAY,CAQxB;IAED,+BAQC;IAED;;;OAGG;IACH,sBAFa,eAAe,CAS3B;CACF"}

View File

@@ -0,0 +1,103 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const percent = require("./percent.cjs");
const dataProperties = require("./data-properties.cjs");
function blankSummary() {
const empty = () => ({
total: 0,
covered: 0,
skipped: 0,
pct: "Unknown",
});
return {
lines: empty(),
statements: empty(),
functions: empty(),
branches: empty(),
branchesTrue: empty(),
};
}
// asserts that a data object "looks like" a summary coverage object
function assertValidSummary(obj) {
const valid = obj && obj.lines && obj.statements && obj.functions && obj.branches;
if (!valid) {
throw new Error("Invalid summary coverage object, missing keys, found:" +
Object.keys(obj).join(","));
}
}
/**
* CoverageSummary provides a summary of code coverage . It exposes 4 properties,
* `lines`, `statements`, `branches`, and `functions`. Each of these properties
* is an object that has 4 keys `total`, `covered`, `skipped` and `pct`.
* `pct` is a percentage number (0-100).
*/
class CoverageSummary {
/**
* @constructor
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
* another coverage summary to initialize this object with.
*/
constructor(obj) {
if (!obj) {
this.data = blankSummary();
}
else if (obj instanceof CoverageSummary) {
this.data = obj.data;
}
else {
this.data = obj;
}
assertValidSummary(this.data);
}
/**
* merges a second summary coverage object into this one
* @param {CoverageSummary} obj - another coverage summary object
*/
merge(obj) {
const keys = [
"lines",
"statements",
"branches",
"functions",
"branchesTrue",
];
keys.forEach((key) => {
if (obj[key]) {
this[key].total += obj[key].total;
this[key].covered += obj[key].covered;
this[key].skipped += obj[key].skipped;
this[key].pct = percent(this[key].covered, this[key].total);
}
});
return this;
}
/**
* returns a POJO that is JSON serializable. May be used to get the raw
* summary object.
*/
toJSON() {
return this.data;
}
/**
* return true if summary has no lines of code
*/
isEmpty() {
return this.lines.total === 0;
}
}
dataProperties(CoverageSummary, [
"lines",
"statements",
"functions",
"branches",
"branchesTrue",
]);
module.exports = {
CoverageSummary,
};
//# sourceMappingURL=coverage-summary.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"coverage-summary.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/coverage-summary.cjs"],"names":[],"mappings":"AAAA,uIAAuI;AACvI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACzC,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAExD,SAAS,YAAY;IACnB,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC;QACnB,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,KAAK,EAAE;QACd,UAAU,EAAE,KAAK,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AAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC;IAChC,CAAC;CACF;AAED,cAAc,CAAC,eAAe,EAAE;IAC9B,OAAO;IACP,YAAY;IACZ,WAAW;IACX,UAAU;IACV,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG;IACf,eAAe;CAChB,CAAC"}

View File

@@ -0,0 +1,30 @@
/**
* CoverageSummary provides a summary of code coverage . It exposes 4 properties,
* `lines`, `statements`, `branches`, and `functions`. Each of these properties
* is an object that has 4 keys `total`, `covered`, `skipped` and `pct`.
* `pct` is a percentage number (0-100).
*/
export class CoverageSummary {
/**
* @constructor
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
* another coverage summary to initialize this object with.
*/
constructor(obj?: Object | CoverageSummary);
data: Object | undefined;
/**
* merges a second summary coverage object into this one
* @param {CoverageSummary} obj - another coverage summary object
*/
merge(obj: CoverageSummary): this;
/**
* returns a POJO that is JSON serializable. May be used to get the raw
* summary object.
*/
toJSON(): Object | undefined;
/**
* return true if summary has no lines of code
*/
isEmpty(): boolean;
}
//# sourceMappingURL=coverage-summary.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"coverage-summary.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/coverage-summary.cjs"],"names":[],"mappings":"AAyCA;;;;;GAKG;AACH;IACE;;;;OAIG;IACH,kBAHW,MAAM,GAAC,eAAe,EAYhC;IAPG,yBAA0B;IAS9B;;;OAGG;IACH,WAFW,eAAe,QAoBzB;IAED;;;OAGG;IACH,6BAEC;IAED;;OAEG;IACH,mBAEC;CACF"}

View File

@@ -0,0 +1,14 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
module.exports = function dataProperties(klass, properties) {
properties.forEach((p) => {
Object.defineProperty(klass.prototype, p, {
enumerable: true,
get() {
return this.data[p];
},
});
});
};
//# sourceMappingURL=data-properties.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"data-properties.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/data-properties.cjs"],"names":[],"mappings":"AAAA,uIAAuI;AACvI,uFAAuF;AAEvF,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,GAAG,SAAS,cAAc,CAAC,KAAK,EAAE,UAAU;IACxD,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE;YACxC,UAAU,EAAE,IAAI;YAChB,GAAG;gBACD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}

View File

@@ -0,0 +1,3 @@
declare function _exports(klass: any, properties: any): void;
export = _exports;
//# sourceMappingURL=data-properties.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"data-properties.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/data-properties.cjs"],"names":[],"mappings":"AAKiB,6DAShB"}

View File

@@ -0,0 +1,389 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const percent = require("./percent.cjs");
const dataProperties = require("./data-properties.cjs");
const { CoverageSummary } = require("./coverage-summary.cjs");
// returns a data object that represents empty coverage
function emptyCoverage(filePath, reportLogic) {
const cov = {
path: filePath,
statementMap: {},
fnMap: {},
branchMap: {},
s: {},
f: {},
b: {},
};
if (reportLogic)
cov.bT = {};
return cov;
}
// asserts that a data object "looks like" a coverage object
function assertValidObject(obj) {
const valid = obj &&
obj.path &&
obj.statementMap &&
obj.fnMap &&
obj.branchMap &&
obj.s &&
obj.f &&
obj.b;
if (!valid) {
throw new Error("Invalid file coverage object, missing keys, found:" +
Object.keys(obj).join(","));
}
}
const keyFromLoc = ({ start, end }) => `${start.line}|${start.column}|${end.line}|${end.column}`;
const isObj = (o) => !!o && typeof o === "object";
const isLineCol = (o) => isObj(o) && typeof o.line === "number" && typeof o.column === "number";
const isLoc = (o) => isObj(o) && isLineCol(o.start) && isLineCol(o.end);
const getLoc = (o) => (isLoc(o) ? o : isLoc(o.loc) ? o.loc : null);
// When merging, we can have a case where two ranges cover
// the same block of code with `hits=1`, and each carve out a
// different range with `hits=0` to indicate it's uncovered.
// Find the nearest container so that we can properly indicate
// that both sections are hit.
// Returns null if no containing item is found.
const findNearestContainer = (item, map) => {
const itemLoc = getLoc(item);
if (!itemLoc)
return null;
// the B item is not an identified range in the A set, BUT
// it may be contained by an identified A range. If so, then
// any hit of that containing A range counts as a hit of this
// B range as well. We have to find the *narrowest* containing
// range to be accurate, since ranges can be hit and un-hit
// in a nested fashion.
let nearestContainingItem = null;
let containerDistance = null;
let containerKey = null;
for (const [i, mapItem] of Object.entries(map)) {
const mapLoc = getLoc(mapItem);
if (!mapLoc)
continue;
// contained if all of line distances are > 0
// or line distance is 0 and col dist is >= 0
const distance = [
itemLoc.start.line - mapLoc.start.line,
itemLoc.start.column - mapLoc.start.column,
mapLoc.end.line - itemLoc.end.line,
mapLoc.end.column - itemLoc.end.column,
];
if (distance[0] < 0 ||
distance[2] < 0 ||
(distance[0] === 0 && distance[1] < 0) ||
(distance[2] === 0 && distance[3] < 0)) {
continue;
}
if (nearestContainingItem === null) {
containerDistance = distance;
nearestContainingItem = mapItem;
containerKey = i;
continue;
}
// closer line more relevant than closer column
const closerBefore = distance[0] < containerDistance[0] ||
(distance[0] === 0 && distance[1] < containerDistance[1]);
const closerAfter = distance[2] < containerDistance[2] ||
(distance[2] === 0 && distance[3] < containerDistance[3]);
if (closerBefore || closerAfter) {
// closer
containerDistance = distance;
nearestContainingItem = mapItem;
containerKey = i;
}
}
return containerKey;
};
// either add two numbers, or all matching entries in a number[]
const addHits = (aHits, bHits) => {
if (typeof aHits === "number" && typeof bHits === "number") {
return aHits + bHits;
}
else if (Array.isArray(aHits) && Array.isArray(bHits)) {
return aHits.map((a, i) => (a || 0) + (bHits[i] || 0));
}
return null;
};
const addNearestContainerHits = (item, itemHits, map, mapHits) => {
const container = findNearestContainer(item, map);
if (container) {
return addHits(itemHits, mapHits[container]);
}
else {
return itemHits;
}
};
const mergeProp = (aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => {
const aItems = {};
for (const [key, itemHits] of Object.entries(aHits)) {
const item = aMap[key];
aItems[itemKey(item)] = [itemHits, item];
}
const bItems = {};
for (const [key, itemHits] of Object.entries(bHits)) {
const item = bMap[key];
bItems[itemKey(item)] = [itemHits, item];
}
const mergedItems = {};
for (const [key, aValue] of Object.entries(aItems)) {
let aItemHits = aValue[0];
const aItem = aValue[1];
const bValue = bItems[key];
if (!bValue) {
// not an identified range in b, but might be contained by one
aItemHits = addNearestContainerHits(aItem, aItemHits, bMap, bHits);
}
else {
// is an identified range in b, so add the hits together
aItemHits = addHits(aItemHits, bValue[0]);
}
mergedItems[key] = [aItemHits, aItem];
}
// now find the items in b that are not in a. already added matches.
for (const [key, bValue] of Object.entries(bItems)) {
let bItemHits = bValue[0];
const bItem = bValue[1];
if (mergedItems[key])
continue;
// not an identified range in b, but might be contained by one
bItemHits = addNearestContainerHits(bItem, bItemHits, aMap, aHits);
mergedItems[key] = [bItemHits, bItem];
}
const hits = {};
const map = {};
Object.values(mergedItems).forEach(([itemHits, item], i) => {
hits[i] = itemHits;
map[i] = item;
});
return [hits, map];
};
/**
* provides a read-only view of coverage for a single file.
* The deep structure of this object is documented elsewhere. It has the following
* properties:
*
* * `path` - the file path for which coverage is being tracked
* * `statementMap` - map of statement locations keyed by statement index
* * `fnMap` - map of function metadata keyed by function index
* * `branchMap` - map of branch metadata keyed by branch index
* * `s` - hit counts for statements
* * `f` - hit count for functions
* * `b` - hit count for branches
*/
class FileCoverage {
/**
* @constructor
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
* and empty coverage object with the specified file path or a data object that
* has all the required properties for a file coverage object.
*/
constructor(pathOrObj, reportLogic = false) {
if (!pathOrObj) {
throw new Error("Coverage must be initialized with a path or an object");
}
if (typeof pathOrObj === "string") {
this.data = emptyCoverage(pathOrObj, reportLogic);
}
else if (pathOrObj instanceof FileCoverage) {
this.data = pathOrObj.data;
}
else if (typeof pathOrObj === "object") {
this.data = pathOrObj;
}
else {
throw new Error("Invalid argument to coverage constructor");
}
assertValidObject(this.data);
}
/**
* returns computed line coverage from statement coverage.
* This is a map of hits keyed by line number in the source.
*/
getLineCoverage() {
const statementMap = this.data.statementMap;
const statements = this.data.s;
const lineMap = Object.create(null);
Object.entries(statements).forEach(([st, count]) => {
/* istanbul ignore if: is this even possible? */
if (!statementMap[st]) {
return;
}
const { line } = statementMap[st].start;
const prevVal = lineMap[line];
if (prevVal === undefined || prevVal < count) {
lineMap[line] = count;
}
});
return lineMap;
}
/**
* returns an array of uncovered line numbers.
* @returns {Array} an array of line numbers for which no hits have been
* collected.
*/
getUncoveredLines() {
const lc = this.getLineCoverage();
const ret = [];
Object.entries(lc).forEach(([l, hits]) => {
if (hits === 0) {
ret.push(l);
}
});
return ret;
}
/**
* returns a map of branch coverage by source line number.
* @returns {Object} an object keyed by line number. Each object
* has a `covered`, `total` and `coverage` (percentage) property.
*/
getBranchCoverageByLine() {
const branchMap = this.branchMap;
const branches = this.b;
const ret = {};
Object.entries(branchMap).forEach(([k, map]) => {
const line = map.line || map.loc.start.line;
const branchData = branches[k];
ret[line] = ret[line] || [];
ret[line].push(...branchData);
});
Object.entries(ret).forEach(([k, dataArray]) => {
const covered = dataArray.filter((item) => item > 0);
const coverage = (covered.length / dataArray.length) * 100;
ret[k] = {
covered: covered.length,
total: dataArray.length,
coverage,
};
});
return ret;
}
/**
* return a JSON-serializable POJO for this file coverage object
*/
toJSON() {
return this.data;
}
/**
* merges a second coverage object into this one, updating hit counts
* @param {FileCoverage} other - the coverage object to be merged into this one.
* Note that the other object should have the same structure as this one (same file).
*/
merge(other) {
if (other.all === true) {
return;
}
if (this.all === true) {
this.data = other.data;
return;
}
let [hits, map] = mergeProp(this.s, this.statementMap, other.s, other.statementMap);
this.data.s = hits;
this.data.statementMap = map;
const keyFromLocProp = (x) => keyFromLoc(x.loc);
const keyFromLocationsProp = (x) => keyFromLoc(x.locations[0]);
[hits, map] = mergeProp(this.f, this.fnMap, other.f, other.fnMap, keyFromLocProp);
this.data.f = hits;
this.data.fnMap = map;
[hits, map] = mergeProp(this.b, this.branchMap, other.b, other.branchMap, keyFromLocationsProp);
this.data.b = hits;
this.data.branchMap = map;
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (this.bT && other.bT) {
[hits, map] = mergeProp(this.bT, this.branchMap, other.bT, other.branchMap, keyFromLocationsProp);
this.data.bT = hits;
}
}
computeSimpleTotals(property) {
let stats = this[property];
if (typeof stats === "function") {
stats = stats.call(this);
}
const ret = {
total: Object.keys(stats).length,
covered: Object.values(stats).filter((v) => !!v).length,
skipped: 0,
};
ret.pct = percent(ret.covered, ret.total);
return ret;
}
computeBranchTotals(property) {
const stats = this[property];
const ret = { total: 0, covered: 0, skipped: 0 };
Object.values(stats).forEach((branches) => {
ret.covered += branches.filter((hits) => hits > 0).length;
ret.total += branches.length;
});
ret.pct = percent(ret.covered, ret.total);
return ret;
}
/**
* resets hit counts for all statements, functions and branches
* in this coverage object resulting in zero coverage.
*/
resetHits() {
const statements = this.s;
const functions = this.f;
const branches = this.b;
const branchesTrue = this.bT;
Object.keys(statements).forEach((s) => {
statements[s] = 0;
});
Object.keys(functions).forEach((f) => {
functions[f] = 0;
});
Object.keys(branches).forEach((b) => {
branches[b].fill(0);
});
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (branchesTrue) {
Object.keys(branchesTrue).forEach((bT) => {
branchesTrue[bT].fill(0);
});
}
}
/**
* returns a CoverageSummary for this file coverage object
* @returns {CoverageSummary}
*/
toSummary() {
const ret = {};
ret.lines = this.computeSimpleTotals("getLineCoverage");
ret.functions = this.computeSimpleTotals("f", "fnMap");
ret.statements = this.computeSimpleTotals("s", "statementMap");
ret.branches = this.computeBranchTotals("b");
// Tracking additional information about branch truthiness
// can be optionally enabled:
if (this.bT) {
ret.branchesTrue = this.computeBranchTotals("bT");
}
return new CoverageSummary(ret);
}
}
// expose coverage data attributes
dataProperties(FileCoverage, [
"path",
"statementMap",
"fnMap",
"branchMap",
"s",
"f",
"b",
"bT",
"all",
]);
module.exports = {
FileCoverage,
// exported for testing
findNearestContainer,
addHits,
addNearestContainerHits,
};
//# sourceMappingURL=file-coverage.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,75 @@
/**
* provides a read-only view of coverage for a single file.
* The deep structure of this object is documented elsewhere. It has the following
* properties:
*
* * `path` - the file path for which coverage is being tracked
* * `statementMap` - map of statement locations keyed by statement index
* * `fnMap` - map of function metadata keyed by function index
* * `branchMap` - map of branch metadata keyed by branch index
* * `s` - hit counts for statements
* * `f` - hit count for functions
* * `b` - hit count for branches
*/
export class FileCoverage {
/**
* @constructor
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
* and empty coverage object with the specified file path or a data object that
* has all the required properties for a file coverage object.
*/
constructor(pathOrObj: Object | FileCoverage | string, reportLogic?: boolean);
data: Object | undefined;
/**
* returns computed line coverage from statement coverage.
* This is a map of hits keyed by line number in the source.
*/
getLineCoverage(): any;
/**
* returns an array of uncovered line numbers.
* @returns {Array} an array of line numbers for which no hits have been
* collected.
*/
getUncoveredLines(): any[];
/**
* returns a map of branch coverage by source line number.
* @returns {Object} an object keyed by line number. Each object
* has a `covered`, `total` and `coverage` (percentage) property.
*/
getBranchCoverageByLine(): Object;
/**
* return a JSON-serializable POJO for this file coverage object
*/
toJSON(): Object | undefined;
/**
* merges a second coverage object into this one, updating hit counts
* @param {FileCoverage} other - the coverage object to be merged into this one.
* Note that the other object should have the same structure as this one (same file).
*/
merge(other: FileCoverage): void;
computeSimpleTotals(property: any): {
total: number;
covered: number;
skipped: number;
};
computeBranchTotals(property: any): {
total: number;
covered: number;
skipped: number;
};
/**
* resets hit counts for all statements, functions and branches
* in this coverage object resulting in zero coverage.
*/
resetHits(): void;
/**
* returns a CoverageSummary for this file coverage object
* @returns {CoverageSummary}
*/
toSummary(): CoverageSummary;
}
export function findNearestContainer(item: any, map: any): string | null;
export function addHits(aHits: any, bHits: any): number | any[] | null;
export function addNearestContainerHits(item: any, itemHits: any, map: any, mapHits: any): any;
import { CoverageSummary } from "./coverage-summary.cjs";
//# sourceMappingURL=file-coverage.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"file-coverage.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/file-coverage.cjs"],"names":[],"mappings":"AAqLA;;;;;;;;;;;;GAYG;AACH;IACE;;;;;OAKG;IACH,uBAJW,MAAM,GAAC,YAAY,SAAO,yBAkBpC;IATG,yBAAiD;IAWrD;;;OAGG;IACH,uBAiBC;IAED;;;;OAIG;IACH,2BASC;IAED;;;;OAIG;IACH,2BAHa,MAAM,CAuBlB;IAED;;OAEG;IACH,6BAEC;IAED;;;;OAIG;IACH,aAHW,YAAY,QAyDtB;IAED;;;;MAcC;IAED;;;;MAUC;IAED;;;OAGG;IACH,kBAqBC;IAED;;;OAGG;IACH,aAFa,eAAe,CAc3B;CACF;AAzWD,yEAoDC;AAGD,uEAOC;AAED,+FAOC"}

View File

@@ -0,0 +1,18 @@
// Contains code copied from istanbul-lib-coverage (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-coverage).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
module.exports = function percent(covered, total) {
let tmp;
if (total > 0) {
tmp = (1000 * 100 * covered) / total;
return Math.floor(tmp / 10) / 100;
}
else {
return 100.0;
}
};
//# sourceMappingURL=percent.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"percent.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/percent.cjs"],"names":[],"mappings":"AAAA,uIAAuI;AACvI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,GAAG,SAAS,OAAO,CAAC,OAAO,EAAE,KAAK;IAC9C,IAAI,GAAG,CAAC;IACR,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}

View File

@@ -0,0 +1,3 @@
declare function _exports(covered: any, total: any): number;
export = _exports;
//# sourceMappingURL=percent.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"percent.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-coverage/lib/percent.cjs"],"names":[],"mappings":"AASiB,4DAQhB"}

View File

@@ -0,0 +1,38 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
/**
* @module Exports
*/
const Context = require("./lib/context.cjs");
const watermarks = require("./lib/watermarks.cjs");
const ReportBase = require("./lib/report-base.cjs");
module.exports = {
/**
* returns a reporting context for the supplied options
* @param {Object} [opts=null] opts
* @returns {Context}
*/
createContext(opts) {
return new Context(opts);
},
/**
* returns the default watermarks that would be used when not
* overridden
* @returns {Object} an object with `statements`, `functions`, `branches`,
* and `line` keys. Each value is a 2 element array that has the low and
* high watermark as percentages.
*/
getDefaultWatermarks() {
return watermarks.getDefault();
},
/**
* Base class for all reports
*/
ReportBase,
};
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-lib-report/index.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb;;GAEG;AAEH,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AACnD,MAAM,UAAU,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEpD,MAAM,CAAC,OAAO,GAAG;IACf;;;;OAIG;IACH,aAAa,CAAC,IAAI;QAChB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB;QAClB,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,UAAU;CACX,CAAC"}

View File

@@ -0,0 +1,18 @@
import Context = require("./lib/context.cjs");
import ReportBase = require("./lib/report-base.cjs");
/**
* returns a reporting context for the supplied options
* @param {Object} [opts=null] opts
* @returns {Context}
*/
export declare function createContext(opts?: Object): Context;
/**
* returns the default watermarks that would be used when not
* overridden
* @returns {Object} an object with `statements`, `functions`, `branches`,
* and `line` keys. Each value is a 2 element array that has the low and
* high watermark as percentages.
*/
export declare function getDefaultWatermarks(): Object;
export { ReportBase };
//# sourceMappingURL=index.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-lib-report/index.cjs"],"names":[],"mappings":";;AAkBE;;;;GAIG;AACH,6CAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;;;GAMG;AACH,gDAJa,MAAM,CAMlB"}

View File

@@ -0,0 +1,121 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const fs = require("node:fs");
const FileWriter = require("./file-writer.cjs");
const XMLWriter = require("./xml-writer.cjs");
const tree = require("./tree.cjs");
const watermarks = require("./watermarks.cjs");
const SummarizerFactory = require("./summarizer-factory.cjs");
function defaultSourceLookup(path) {
try {
return fs.readFileSync(path, "utf8");
}
catch (ex) {
throw new Error(`Unable to lookup source: ${path} (${ex.message})`);
}
}
function normalizeWatermarks(specified = {}) {
Object.entries(watermarks.getDefault()).forEach(([k, value]) => {
const specValue = specified[k];
if (!Array.isArray(specValue) || specValue.length !== 2) {
specified[k] = value;
}
});
return specified;
}
/**
* A reporting context that is passed to report implementations
* @param {Object} [opts=null] opts options
* @param {String} [opts.dir='coverage'] opts.dir the reporting directory
* @param {Object} [opts.watermarks=null] opts.watermarks watermarks for
* statements, lines, branches and functions
* @param {Function} [opts.sourceFinder=fsLookup] opts.sourceFinder a
* function that returns source code given a file path. Defaults to
* filesystem lookups based on path.
* @constructor
*/
class Context {
constructor(opts) {
this.dir = opts.dir || "coverage";
this.watermarks = normalizeWatermarks(opts.watermarks);
this.sourceFinder = opts.sourceFinder || defaultSourceLookup;
this._summarizerFactory = new SummarizerFactory(opts.coverageMap, opts.defaultSummarizer);
this.data = {};
}
/**
* returns a FileWriter implementation for reporting use. Also available
* as the `writer` property on the context.
* @returns {Writer}
*/
getWriter() {
return this.writer;
}
/**
* returns the source code for the specified file path or throws if
* the source could not be found.
* @param {String} filePath the file path as found in a file coverage object
* @returns {String} the source code
*/
getSource(filePath) {
return this.sourceFinder(filePath);
}
/**
* returns the coverage class given a coverage
* types and a percentage value.
* @param {String} type - the coverage type, one of `statements`, `functions`,
* `branches`, or `lines`
* @param {Number} value - the percentage value
* @returns {String} one of `high`, `medium` or `low`
*/
classForPercent(type, value) {
const watermarks = this.watermarks[type];
if (!watermarks) {
return "unknown";
}
if (value < watermarks[0]) {
return "low";
}
if (value >= watermarks[1]) {
return "high";
}
return "medium";
}
/**
* returns an XML writer for the supplied content writer
* @param {ContentWriter} contentWriter the content writer to which the returned XML writer
* writes data
* @returns {XMLWriter}
*/
getXMLWriter(contentWriter) {
return new XMLWriter(contentWriter);
}
/**
* returns a full visitor given a partial one.
* @param {Object} partialVisitor a partial visitor only having the functions of
* interest to the caller. These functions are called with a scope that is the
* supplied object.
* @returns {Visitor}
*/
getVisitor(partialVisitor) {
return new tree.Visitor(partialVisitor);
}
getTree(name = "defaultSummarizer") {
return this._summarizerFactory[name];
}
}
Object.defineProperty(Context.prototype, "writer", {
enumerable: true,
get() {
if (!this.data.writer) {
this.data.writer = new FileWriter(this.dir);
}
return this.data.writer;
},
});
module.exports = Context;
//# sourceMappingURL=context.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/context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CAAC;IACvC,CAAC;CACF;AAED,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE;IACjD,UAAU,EAAE,IAAI;IAChB,GAAG;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC"}

View File

@@ -0,0 +1,62 @@
export = Context;
/**
* A reporting context that is passed to report implementations
* @param {Object} [opts=null] opts options
* @param {String} [opts.dir='coverage'] opts.dir the reporting directory
* @param {Object} [opts.watermarks=null] opts.watermarks watermarks for
* statements, lines, branches and functions
* @param {Function} [opts.sourceFinder=fsLookup] opts.sourceFinder a
* function that returns source code given a file path. Defaults to
* filesystem lookups based on path.
* @constructor
*/
declare class Context {
constructor(opts: any);
dir: any;
watermarks: {};
sourceFinder: any;
_summarizerFactory: SummarizerFactory;
data: {};
/**
* returns a FileWriter implementation for reporting use. Also available
* as the `writer` property on the context.
* @returns {Writer}
*/
getWriter(): Writer;
/**
* returns the source code for the specified file path or throws if
* the source could not be found.
* @param {String} filePath the file path as found in a file coverage object
* @returns {String} the source code
*/
getSource(filePath: string): string;
/**
* returns the coverage class given a coverage
* types and a percentage value.
* @param {String} type - the coverage type, one of `statements`, `functions`,
* `branches`, or `lines`
* @param {Number} value - the percentage value
* @returns {String} one of `high`, `medium` or `low`
*/
classForPercent(type: string, value: number): string;
/**
* returns an XML writer for the supplied content writer
* @param {ContentWriter} contentWriter the content writer to which the returned XML writer
* writes data
* @returns {XMLWriter}
*/
getXMLWriter(contentWriter: ContentWriter): XMLWriter;
/**
* returns a full visitor given a partial one.
* @param {Object} partialVisitor a partial visitor only having the functions of
* interest to the caller. These functions are called with a scope that is the
* supplied object.
* @returns {Visitor}
*/
getVisitor(partialVisitor: Object): Visitor;
getTree(name?: string): any;
get writer(): any;
}
import SummarizerFactory = require("./summarizer-factory.cjs");
import XMLWriter = require("./xml-writer.cjs");
//# sourceMappingURL=context.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/context.cjs"],"names":[],"mappings":";AAkCA;;;;;;;;;;GAUG;AACH;IACE,uBASC;IARC,SAAiC;IACjC,eAAsD;IACtD,kBAA4D;IAC5D,sCAGC;IACD,SAAc;IAGhB;;;;OAIG;IACH,aAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,oCAEC;IAED;;;;;;;OAOG;IACH,qDAYC;IAED;;;;;OAKG;IACH,4BAJW,aAAa,GAEX,SAAS,CAIrB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,GAGJ,OAAO,CAInB;IAED,4BAEC;;CACF"}

View File

@@ -0,0 +1,166 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const path = require("node:path");
const fs = require("node:fs");
/**
* Base class for writing content
* @class ContentWriter
* @constructor
*/
class ContentWriter {
/**
* returns the colorized version of a string. Typically,
* content writers that write to files will return the
* same string and ones writing to a tty will wrap it in
* appropriate escape sequences.
* @param {String} str the string to colorize
* @param {String} clazz one of `high`, `medium` or `low`
* @returns {String} the colorized form of the string
*/
colorize(str /*, clazz*/) {
return str;
}
/**
* writes a string appended with a newline to the destination
* @param {String} str the string to write
*/
println(str) {
this.write(`${str}\n`);
}
/**
* closes this content writer. Should be called after all writes are complete.
*/
close() { }
}
/**
* a content writer that writes to a file
* @param {Number} fd - the file descriptor
* @extends ContentWriter
* @constructor
*/
class FileContentWriter extends ContentWriter {
constructor(fd) {
super();
this.fd = fd;
}
write(str) {
fs.writeSync(this.fd, str);
}
close() {
fs.closeSync(this.fd);
}
}
// allow stdout to be captured for tests.
let capture = false;
let output = "";
/**
* a content writer that writes to the console
* @extends ContentWriter
* @constructor
*/
class ConsoleWriter extends ContentWriter {
write(str) {
if (capture) {
output += str;
}
else {
process.stdout.write(str);
}
}
colorize(str, clazz) {
const colors = {
low: "31;1",
medium: "33;1",
high: "32;1",
};
return str;
}
}
/**
* utility for writing files under a specific directory
* @class FileWriter
* @param {String} baseDir the base directory under which files should be written
* @constructor
*/
class FileWriter {
constructor(baseDir) {
if (!baseDir) {
throw new Error("baseDir must be specified");
}
this.baseDir = baseDir;
}
/**
* static helpers for capturing stdout report output;
* super useful for tests!
*/
static startCapture() {
capture = true;
}
static stopCapture() {
capture = false;
}
static getOutput() {
return output;
}
static resetOutput() {
output = "";
}
/**
* returns a FileWriter that is rooted at the supplied subdirectory
* @param {String} subdir the subdirectory under which to root the
* returned FileWriter
* @returns {FileWriter}
*/
writerForDir(subdir) {
if (path.isAbsolute(subdir)) {
throw new Error(`Cannot create subdir writer for absolute path: ${subdir}`);
}
return new FileWriter(`${this.baseDir}/${subdir}`);
}
/**
* copies a file from a source directory to a destination name
* @param {String} source path to source file
* @param {String} dest relative path to destination file
* @param {String} [header=undefined] optional text to prepend to destination
* (e.g., an "this file is autogenerated" comment, copyright notice, etc.)
*/
copyFile(source, dest, header) {
if (path.isAbsolute(dest)) {
throw new Error(`Cannot write to absolute path: ${dest}`);
}
dest = path.resolve(this.baseDir, dest);
fs.mkdirSync(path.dirname(dest), { recursive: true });
let contents;
if (header) {
contents = header + fs.readFileSync(source, "utf8");
}
else {
contents = fs.readFileSync(source);
}
fs.writeFileSync(dest, contents);
}
/**
* returns a content writer for writing content to the supplied file.
* @param {String|null} file the relative path to the file or the special
* values `"-"` or `null` for writing to the console
* @returns {ContentWriter}
*/
writeFile(file) {
if (file === null || file === "-") {
return new ConsoleWriter();
}
if (path.isAbsolute(file)) {
throw new Error(`Cannot write to absolute path: ${file}`);
}
file = path.resolve(this.baseDir, file);
fs.mkdirSync(path.dirname(file), { recursive: true });
return new FileContentWriter(fs.openSync(file, "w"));
}
}
module.exports = FileWriter;
//# sourceMappingURL=file-writer.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"file-writer.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/file-writer.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF,YAAY,CAAC;AACb;;;GAGG;AACH,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAClC,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAE9B;;;;GAIG;AACH,MAAM,aAAa;IACjB;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,CAAC,WAAW;QACtB,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,GAAG;QACT,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,KAAI,CAAC;CACX;AAED;;;;;GAKG;AACH,MAAM,iBAAkB,SAAQ,aAAa;IAC3C,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,KAAK,CAAC,GAAG;QACP,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK;QACH,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;CACF;AAED,yCAAyC;AACzC,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,MAAM,GAAG,EAAE,CAAC;AAEhB;;;;GAIG;AACH,MAAM,aAAc,SAAQ,aAAa;IACvC,KA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@@
export = FileWriter;
/**
* utility for writing files under a specific directory
* @class FileWriter
* @param {String} baseDir the base directory under which files should be written
* @constructor
*/
declare class FileWriter {
/**
* static helpers for capturing stdout report output;
* super useful for tests!
*/
static startCapture(): void;
static stopCapture(): void;
static getOutput(): string;
static resetOutput(): void;
constructor(baseDir: any);
baseDir: any;
/**
* returns a FileWriter that is rooted at the supplied subdirectory
* @param {String} subdir the subdirectory under which to root the
* returned FileWriter
* @returns {FileWriter}
*/
writerForDir(subdir: string): FileWriter;
/**
* copies a file from a source directory to a destination name
* @param {String} source path to source file
* @param {String} dest relative path to destination file
* @param {String} [header=undefined] optional text to prepend to destination
* (e.g., an "this file is autogenerated" comment, copyright notice, etc.)
*/
copyFile(source: string, dest: string, header?: string): void;
/**
* returns a content writer for writing content to the supplied file.
* @param {String|null} file the relative path to the file or the special
* values `"-"` or `null` for writing to the console
* @returns {ContentWriter}
*/
writeFile(file: string | null): ContentWriter;
}
/**
* Base class for writing content
* @class ContentWriter
* @constructor
*/
declare class ContentWriter {
/**
* returns the colorized version of a string. Typically,
* content writers that write to files will return the
* same string and ones writing to a tty will wrap it in
* appropriate escape sequences.
* @param {String} str the string to colorize
* @param {String} clazz one of `high`, `medium` or `low`
* @returns {String} the colorized form of the string
*/
colorize(str: string): string;
/**
* writes a string appended with a newline to the destination
* @param {String} str the string to write
*/
println(str: string): void;
/**
* closes this content writer. Should be called after all writes are complete.
*/
close(): void;
}
//# sourceMappingURL=file-writer.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"file-writer.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/file-writer.cjs"],"names":[],"mappings":";AA+FA;;;;;GAKG;AACH;IAQE;;;OAGG;IACH,4BAEC;IAED,2BAEC;IAED,2BAEC;IAED,2BAEC;IAzBD,0BAKC;IADC,aAAsB;IAuBxB;;;;;OAKG;IACH,8BAFa,UAAU,CAStB;IAED;;;;;;OAMG;IACH,8DAaC;IAED;;;;;OAKG;IACH,gBAJW,SAAO,IAAI,GAET,aAAa,CAYzB;CACF;AA5KD;;;;GAIG;AACH;IACE;;;;;;;;OAQG;IACH,8BAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;OAEG;IACH,cAAU;CACX"}

View File

@@ -0,0 +1,150 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const path = require("node:path");
let parsePath = path.parse;
let SEP = path.sep;
const origParser = parsePath;
const origSep = SEP;
function makeRelativeNormalizedPath(str, sep) {
const parsed = parsePath(str);
let root = parsed.root;
let dir;
let file = parsed.base;
let quoted;
let pos;
// handle a weird windows case separately
if (sep === "\\") {
pos = root.indexOf(":\\");
if (pos >= 0) {
root = root.substring(0, pos + 2);
}
}
dir = parsed.dir.substring(root.length);
if (str === "") {
return [];
}
if (sep !== "/") {
quoted = new RegExp(sep.replace(/\W/g, "\\$&"), "g");
dir = dir.replace(quoted, "/");
file = file.replace(quoted, "/"); // excessively paranoid?
}
if (dir !== "") {
dir = `${dir}/${file}`;
}
else {
dir = file;
}
if (dir.substring(0, 1) === "/") {
dir = dir.substring(1);
}
dir = dir.split(/\/+/);
return dir;
}
class Path {
constructor(strOrArray) {
if (Array.isArray(strOrArray)) {
this.v = strOrArray;
}
else if (typeof strOrArray === "string") {
this.v = makeRelativeNormalizedPath(strOrArray, SEP);
}
else {
throw new Error(`Invalid Path argument must be string or array:${strOrArray}`);
}
}
toString() {
return this.v.join("/");
}
hasParent() {
return this.v.length > 0;
}
parent() {
if (!this.hasParent()) {
throw new Error("Unable to get parent for 0 elem path");
}
const p = this.v.slice();
p.pop();
return new Path(p);
}
elements() {
return this.v.slice();
}
name() {
return this.v.slice(-1)[0];
}
contains(other) {
let i;
if (other.length > this.length) {
return false;
}
for (i = 0; i < other.length; i += 1) {
if (this.v[i] !== other.v[i]) {
return false;
}
}
return true;
}
ancestorOf(other) {
return other.contains(this) && other.length !== this.length;
}
descendantOf(other) {
return this.contains(other) && other.length !== this.length;
}
commonPrefixPath(other) {
const len = this.length > other.length ? other.length : this.length;
let i;
const ret = [];
for (i = 0; i < len; i += 1) {
if (this.v[i] === other.v[i]) {
ret.push(this.v[i]);
}
else {
break;
}
}
return new Path(ret);
}
static compare(a, b) {
const al = a.length;
const bl = b.length;
if (al < bl) {
return -1;
}
if (al > bl) {
return 1;
}
const astr = a.toString();
const bstr = b.toString();
return astr < bstr ? -1 : astr > bstr ? 1 : 0;
}
}
["push", "pop", "shift", "unshift", "splice"].forEach((fn) => {
Object.defineProperty(Path.prototype, fn, {
value(...args) {
return this.v[fn](...args);
},
});
});
Object.defineProperty(Path.prototype, "length", {
enumerable: true,
get() {
return this.v.length;
},
});
module.exports = Path;
Path.tester = {
setParserAndSep(p, sep) {
parsePath = p;
SEP = sep;
},
reset() {
parsePath = origParser;
SEP = origSep;
},
};
//# sourceMappingURL=path.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"path.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/path.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF;;;GAGG;AACH,YAAY,CAAC;AAEb,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAClC,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;AAC3B,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACnB,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,SAAS,0BAA0B,CAAC,GAAG,EAAE,GAAG;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACvB,IAAI,GAAG,CAAC;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UAAU,CAAC;QACvB,GAAG,GAAG,OAAO,CAAC;IAChB,CAAC;CACF,CAAC"}

View File

@@ -0,0 +1,23 @@
export = Path;
declare class Path {
static compare(a: any, b: any): 0 | 1 | -1;
constructor(strOrArray: any);
v: any[];
toString(): string;
hasParent(): boolean;
parent(): Path;
elements(): any[];
name(): any;
contains(other: any): boolean;
ancestorOf(other: any): any;
descendantOf(other: any): boolean;
commonPrefixPath(other: any): Path;
get length(): any;
}
declare namespace Path {
namespace tester {
function setParserAndSep(p: any, sep: any): void;
function reset(): void;
}
}
//# sourceMappingURL=path.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"path.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/path.cjs"],"names":[],"mappings":";AAsDA;IA0EE,2CAeC;IAxFD,6BAUC;IARG,SAAmB;IAUvB,mBAEC;IAED,qBAEC;IAED,eAOC;IAED,kBAEC;IAED,YAEC;IAED,8BAWC;IAED,4BAEC;IAED,kCAEC;IAED,mCAaC;;CAkBF;;;QAmBC,iDAGC;QACD,uBAGC"}

View File

@@ -0,0 +1,15 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
// TODO: switch to class private field when targeting node.js 12
const _summarizer = Symbol("ReportBase.#summarizer");
class ReportBase {
constructor(opts = {}) {
this[_summarizer] = opts.summarizer;
}
execute(context) {
context.getTree(this[_summarizer]).visit(this, context);
}
}
module.exports = ReportBase;
//# sourceMappingURL=report-base.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"report-base.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/report-base.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF,YAAY,CAAC;AAEb,gEAAgE;AAChE,MAAM,WAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAErD,MAAM,UAAU;IACd,YAAY,IAAI,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,OAAO;QACb,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}

View File

@@ -0,0 +1,8 @@
export = ReportBase;
declare class ReportBase {
constructor(opts?: {});
execute(context: any): void;
[_summarizer]: any;
}
declare const _summarizer: unique symbol;
//# sourceMappingURL=report-base.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"report-base.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/report-base.cjs"],"names":[],"mappings":";AAQA;IACE,uBAEC;IAED,4BAEC;IALC,mBAAmC;CAMtC;AAVD,yCAAqD"}

View File

@@ -0,0 +1,226 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const coverage = require("../../istanbul-lib-coverage/index.cjs");
const Path = require("./path.cjs");
const { BaseNode, BaseTree } = require("./tree.cjs");
class ReportNode extends BaseNode {
constructor(path, fileCoverage) {
super();
this.path = path;
this.parent = null;
this.fileCoverage = fileCoverage;
this.children = [];
}
static createRoot(children) {
const root = new ReportNode(new Path([]));
children.forEach((child) => {
root.addChild(child);
});
return root;
}
addChild(child) {
child.parent = this;
this.children.push(child);
}
asRelative(p) {
if (p.substring(0, 1) === "/") {
return p.substring(1);
}
return p;
}
getQualifiedName() {
return this.asRelative(this.path.toString());
}
getRelativeName() {
const parent = this.getParent();
const myPath = this.path;
let relPath;
let i;
const parentPath = parent ? parent.path : new Path([]);
if (parentPath.ancestorOf(myPath)) {
relPath = new Path(myPath.elements());
for (i = 0; i < parentPath.length; i += 1) {
relPath.shift();
}
return this.asRelative(relPath.toString());
}
return this.asRelative(this.path.toString());
}
getParent() {
return this.parent;
}
getChildren() {
return this.children;
}
isSummary() {
return !this.fileCoverage;
}
getFileCoverage() {
return this.fileCoverage;
}
getCoverageSummary(filesOnly) {
const cacheProp = `c_${filesOnly ? "files" : "full"}`;
let summary;
if (Object.prototype.hasOwnProperty.call(this, cacheProp)) {
return this[cacheProp];
}
if (!this.isSummary()) {
summary = this.getFileCoverage().toSummary();
}
else {
let count = 0;
summary = coverage.createCoverageSummary();
this.getChildren().forEach((child) => {
if (filesOnly && child.isSummary()) {
return;
}
count += 1;
summary.merge(child.getCoverageSummary(filesOnly));
});
if (count === 0 && filesOnly) {
summary = null;
}
}
this[cacheProp] = summary;
return summary;
}
}
class ReportTree extends BaseTree {
constructor(root, childPrefix) {
super(root);
const maybePrefix = (node) => {
if (childPrefix && !node.isRoot()) {
node.path.unshift(childPrefix);
}
};
this.visit({
onDetail: maybePrefix,
onSummary(node) {
maybePrefix(node);
node.children.sort((a, b) => {
const astr = a.path.toString();
const bstr = b.path.toString();
return astr < bstr
? -1
: astr > bstr
? 1
: /* istanbul ignore next */ 0;
});
},
});
}
}
function findCommonParent(paths) {
return paths.reduce((common, path) => common.commonPrefixPath(path), paths[0] || new Path([]));
}
function findOrCreateParent(parentPath, nodeMap, created = () => { }) {
let parent = nodeMap[parentPath.toString()];
if (!parent) {
parent = new ReportNode(parentPath);
nodeMap[parentPath.toString()] = parent;
created(parentPath, parent);
}
return parent;
}
function toDirParents(list) {
const nodeMap = Object.create(null);
list.forEach((o) => {
const parent = findOrCreateParent(o.path.parent(), nodeMap);
parent.addChild(new ReportNode(o.path, o.fileCoverage));
});
return Object.values(nodeMap);
}
function addAllPaths(topPaths, nodeMap, path, node) {
const parent = findOrCreateParent(path.parent(), nodeMap, (parentPath, parent) => {
if (parentPath.hasParent()) {
addAllPaths(topPaths, nodeMap, parentPath, parent);
}
else {
topPaths.push(parent);
}
});
parent.addChild(node);
}
function foldIntoOneDir(node, parent) {
const { children } = node;
if (children.length === 1 && !children[0].fileCoverage) {
children[0].parent = parent;
return foldIntoOneDir(children[0], parent);
}
node.children = children.map((child) => foldIntoOneDir(child, node));
return node;
}
function pkgSummaryPrefix(dirParents, commonParent) {
if (!dirParents.some((dp) => dp.path.length === 0)) {
return;
}
if (commonParent.length === 0) {
return "root";
}
return commonParent.name();
}
class SummarizerFactory {
constructor(coverageMap, defaultSummarizer = "pkg") {
this._coverageMap = coverageMap;
this._defaultSummarizer = defaultSummarizer;
this._initialList = coverageMap.files().map((filePath) => ({
filePath,
path: new Path(filePath),
fileCoverage: coverageMap.fileCoverageFor(filePath),
}));
this._commonParent = findCommonParent(this._initialList.map((o) => o.path.parent()));
if (this._commonParent.length > 0) {
this._initialList.forEach((o) => {
o.path.splice(0, this._commonParent.length);
});
}
}
get defaultSummarizer() {
return this[this._defaultSummarizer];
}
get flat() {
if (!this._flat) {
this._flat = new ReportTree(ReportNode.createRoot(this._initialList.map((node) => new ReportNode(node.path, node.fileCoverage))));
}
return this._flat;
}
_createPkg() {
const dirParents = toDirParents(this._initialList);
if (dirParents.length === 1) {
return new ReportTree(dirParents[0]);
}
return new ReportTree(ReportNode.createRoot(dirParents), pkgSummaryPrefix(dirParents, this._commonParent));
}
get pkg() {
if (!this._pkg) {
this._pkg = this._createPkg();
}
return this._pkg;
}
_createNested() {
const nodeMap = Object.create(null);
const topPaths = [];
this._initialList.forEach((o) => {
const node = new ReportNode(o.path, o.fileCoverage);
addAllPaths(topPaths, nodeMap, o.path, node);
});
const topNodes = topPaths.map((node) => foldIntoOneDir(node));
if (topNodes.length === 1) {
return new ReportTree(topNodes[0]);
}
return new ReportTree(ReportNode.createRoot(topNodes));
}
get nested() {
if (!this._nested) {
this._nested = this._createNested();
}
return this._nested;
}
}
module.exports = SummarizerFactory;
//# sourceMappingURL=summarizer-factory.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
export = SummarizerFactory;
declare class SummarizerFactory {
constructor(coverageMap: any, defaultSummarizer?: string);
_coverageMap: any;
_defaultSummarizer: string;
_initialList: any;
_commonParent: any;
get defaultSummarizer(): any;
get flat(): ReportTree;
_flat: ReportTree | undefined;
_createPkg(): ReportTree;
get pkg(): ReportTree;
_pkg: ReportTree | undefined;
_createNested(): ReportTree;
get nested(): ReportTree;
_nested: ReportTree | undefined;
}
declare class ReportTree extends BaseTree {
constructor(root: any, childPrefix: any);
}
import { BaseTree } from "./tree.cjs";
//# sourceMappingURL=summarizer-factory.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"summarizer-factory.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/summarizer-factory.cjs"],"names":[],"mappings":";AA4MA;IACE,0DAgBC;IAfC,kBAA+B;IAC/B,2BAA2C;IAC3C,kBAIG;IACH,mBAEC;IAQH,6BAEC;IAED,uBAYC;IAVG,8BAMC;IAML,yBAUC;IAED,sBAMC;IAJG,6BAA6B;IAMjC,4BAcC;IAED,yBAMC;IAJG,gCAAmC;CAKxC;AA9KD;IACE,yCAuBC;CACF"}

View File

@@ -0,0 +1,128 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
/**
* An object with methods that are called during the traversal of the coverage tree.
* A visitor has the following methods that are called during tree traversal.
*
* * `onStart(root, state)` - called before traversal begins
* * `onSummary(node, state)` - called for every summary node
* * `onDetail(node, state)` - called for every detail node
* * `onSummaryEnd(node, state)` - called after all children have been visited for
* a summary node.
* * `onEnd(root, state)` - called after traversal ends
*
* @param delegate - a partial visitor that only implements the methods of interest
* The visitor object supplies the missing methods as noops. For example, reports
* that only need the final coverage summary need implement `onStart` and nothing
* else. Reports that use only detailed coverage information need implement `onDetail`
* and nothing else.
* @constructor
*/
class Visitor {
constructor(delegate) {
this.delegate = delegate;
}
}
["Start", "End", "Summary", "SummaryEnd", "Detail"]
.map((k) => `on${k}`)
.forEach((fn) => {
Object.defineProperty(Visitor.prototype, fn, {
writable: true,
value(node, state) {
if (typeof this.delegate[fn] === "function") {
this.delegate[fn](node, state);
}
},
});
});
class CompositeVisitor extends Visitor {
constructor(visitors) {
super();
if (!Array.isArray(visitors)) {
visitors = [visitors];
}
this.visitors = visitors.map((v) => {
if (v instanceof Visitor) {
return v;
}
return new Visitor(v);
});
}
}
["Start", "Summary", "SummaryEnd", "Detail", "End"]
.map((k) => `on${k}`)
.forEach((fn) => {
Object.defineProperty(CompositeVisitor.prototype, fn, {
value(node, state) {
this.visitors.forEach((v) => {
v[fn](node, state);
});
},
});
});
class BaseNode {
isRoot() {
return !this.getParent();
}
/**
* visit all nodes depth-first from this node down. Note that `onStart`
* and `onEnd` are never called on the visitor even if the current
* node is the root of the tree.
* @param visitor a full visitor that is called during tree traversal
* @param state optional state that is passed around
*/
visit(visitor, state) {
if (this.isSummary()) {
visitor.onSummary(this, state);
}
else {
visitor.onDetail(this, state);
}
this.getChildren().forEach((child) => {
child.visit(visitor, state);
});
if (this.isSummary()) {
visitor.onSummaryEnd(this, state);
}
}
}
/**
* abstract base class for a coverage tree.
* @constructor
*/
class BaseTree {
constructor(root) {
this.root = root;
}
/**
* returns the root node of the tree
*/
getRoot() {
return this.root;
}
/**
* visits the tree depth-first with the supplied partial visitor
* @param visitor - a potentially partial visitor
* @param state - the state to be passed around during tree traversal
*/
visit(visitor, state) {
if (!(visitor instanceof Visitor)) {
visitor = new Visitor(visitor);
}
visitor.onStart(this.getRoot(), state);
this.getRoot().visit(visitor, state);
visitor.onEnd(this.getRoot(), state);
}
}
module.exports = {
BaseTree,
BaseNode,
Visitor,
CompositeVisitor,
};
//# sourceMappingURL=tree.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Z,YAAY,IAAI;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,KAAK;QAClB,IAAI,CAAC,CAAC,OAAO,YAAY,OAAO,CAAC,EAAE,CAAC;YAClC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG;IACf,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,gBAAgB;CACjB,CAAC"}

View File

@@ -0,0 +1,55 @@
/**
* abstract base class for a coverage tree.
* @constructor
*/
export class BaseTree {
constructor(root: any);
root: any;
/**
* returns the root node of the tree
*/
getRoot(): any;
/**
* visits the tree depth-first with the supplied partial visitor
* @param visitor - a potentially partial visitor
* @param state - the state to be passed around during tree traversal
*/
visit(visitor: any, state: any): void;
}
export class BaseNode {
isRoot(): boolean;
/**
* visit all nodes depth-first from this node down. Note that `onStart`
* and `onEnd` are never called on the visitor even if the current
* node is the root of the tree.
* @param visitor a full visitor that is called during tree traversal
* @param state optional state that is passed around
*/
visit(visitor: any, state: any): void;
}
/**
* An object with methods that are called during the traversal of the coverage tree.
* A visitor has the following methods that are called during tree traversal.
*
* * `onStart(root, state)` - called before traversal begins
* * `onSummary(node, state)` - called for every summary node
* * `onDetail(node, state)` - called for every detail node
* * `onSummaryEnd(node, state)` - called after all children have been visited for
* a summary node.
* * `onEnd(root, state)` - called after traversal ends
*
* @param delegate - a partial visitor that only implements the methods of interest
* The visitor object supplies the missing methods as noops. For example, reports
* that only need the final coverage summary need implement `onStart` and nothing
* else. Reports that use only detailed coverage information need implement `onDetail`
* and nothing else.
* @constructor
*/
export class Visitor {
constructor(delegate: any);
delegate: any;
}
export class CompositeVisitor extends Visitor {
visitors: any;
}
//# sourceMappingURL=tree.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"tree.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/tree.cjs"],"names":[],"mappings":"AAuGA;;;GAGG;AACH;IACE,uBAEC;IADC,UAAgB;IAGlB;;OAEG;IACH,eAEC;IAED;;;;OAIG;IACH,sCAOC;CACF;AA1DD;IACE,kBAEC;IAED;;;;;;OAMG;IACH,sCAcC;CACF;AA5FD;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE,2BAEC;IADC,cAAwB;CAE3B;AAeD;IAOI,cAKE;CAEL"}

View File

@@ -0,0 +1,18 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = {
getDefault() {
return {
statements: [50, 80],
functions: [50, 80],
branches: [50, 80],
lines: [50, 80],
};
},
};
//# sourceMappingURL=watermarks.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"watermarks.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/watermarks.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF,YAAY,CAAC;AACb;;;GAGG;AACH,MAAM,CAAC,OAAO,GAAG;IACf,UAAU;QACR,OAAO;YACL,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;YACpB,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;YACnB,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;YAClB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;SAChB,CAAC;IACJ,CAAC;CACF,CAAC"}

View File

@@ -0,0 +1,7 @@
export function getDefault(): {
statements: number[];
functions: number[];
branches: number[];
lines: number[];
};
//# sourceMappingURL=watermarks.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"watermarks.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/watermarks.cjs"],"names":[],"mappings":"AASE;;;;;EAOC"}

View File

@@ -0,0 +1,83 @@
// Contains code copied from istanbul-lib-report (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-lib-report).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const INDENT = " ";
function attrString(attrs) {
return Object.entries(attrs || {})
.map(([k, v]) => ` ${k}="${v}"`)
.join("");
}
/**
* a utility class to produce well-formed, indented XML
* @param {ContentWriter} contentWriter the content writer that this utility wraps
* @constructor
*/
class XMLWriter {
constructor(contentWriter) {
this.cw = contentWriter;
this.stack = [];
}
indent(str) {
return this.stack.map(() => INDENT).join("") + str;
}
/**
* writes the opening XML tag with the supplied attributes
* @param {String} name tag name
* @param {Object} [attrs=null] attrs attributes for the tag
*/
openTag(name, attrs) {
const str = this.indent(`<${name + attrString(attrs)}>`);
this.cw.println(str);
this.stack.push(name);
}
/**
* closes an open XML tag.
* @param {String} name - tag name to close. This must match the writer's
* notion of the tag that is currently open.
*/
closeTag(name) {
if (this.stack.length === 0) {
throw new Error(`Attempt to close tag ${name} when not opened`);
}
const stashed = this.stack.pop();
const str = `</${name}>`;
if (stashed !== name) {
throw new Error(`Attempt to close tag ${name} when ${stashed} was the one open`);
}
this.cw.println(this.indent(str));
}
/**
* writes a tag and its value opening and closing it at the same time
* @param {String} name tag name
* @param {Object} [attrs=null] attrs tag attributes
* @param {String} [content=null] content optional tag content
*/
inlineTag(name, attrs, content) {
let str = "<" + name + attrString(attrs);
if (content) {
str += `>${content}</${name}>`;
}
else {
str += "/>";
}
str = this.indent(str);
this.cw.println(str);
}
/**
* closes all open tags and ends the document
*/
closeAll() {
this.stack
.slice()
.reverse()
.forEach((name) => {
this.closeTag(name);
});
}
}
module.exports = XMLWriter;
//# sourceMappingURL=xml-writer.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"xml-writer.cjs","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/xml-writer.cjs"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,uFAAuF;AAEvF,YAAY,CAAC;AACb;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,SAAS,UAAU,CAAC,KAAK;IACvB,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SAC/B,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS;IACb,YAAY,aAAa;QACvB,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,GAAG;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,KAAK;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,CAAC,EAAE,CAAC,OAA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AC,CAAC;IACP,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC"}

View File

@@ -0,0 +1,36 @@
export = XMLWriter;
/**
* a utility class to produce well-formed, indented XML
* @param {ContentWriter} contentWriter the content writer that this utility wraps
* @constructor
*/
declare class XMLWriter {
constructor(contentWriter: any);
cw: any;
stack: any[];
indent(str: any): string;
/**
* writes the opening XML tag with the supplied attributes
* @param {String} name tag name
* @param {Object} [attrs=null] attrs attributes for the tag
*/
openTag(name: string, attrs?: Object): void;
/**
* closes an open XML tag.
* @param {String} name - tag name to close. This must match the writer's
* notion of the tag that is currently open.
*/
closeTag(name: string): void;
/**
* writes a tag and its value opening and closing it at the same time
* @param {String} name tag name
* @param {Object} [attrs=null] attrs tag attributes
* @param {String} [content=null] content optional tag content
*/
inlineTag(name: string, attrs?: Object, content?: string): void;
/**
* closes all open tags and ends the document
*/
closeAll(): void;
}
//# sourceMappingURL=xml-writer.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"xml-writer.d.cts","sourceRoot":"","sources":["../../../../../src/coverage-module/istanbul-lib-report/lib/xml-writer.cjs"],"names":[],"mappings":";AAgBA;;;;GAIG;AACH;IACE,gCAGC;IAFC,QAAuB;IACvB,aAAe;IAGjB,yBAEC;IAED;;;;OAIG;IACH,8BAFW,MAAM,QAMhB;IAED;;;;OAIG;IACH,6BAaC;IAED;;;;;OAKG;IACH,gCAHW,MAAM,0BAYhB;IAED;;OAEG;IACH,iBAOC;CACF"}

View File

@@ -0,0 +1,25 @@
// Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const path = require("node:path");
module.exports = {
create(name, cfg) {
cfg = cfg || {};
let Cons;
try {
Cons = require(path.join(__dirname, "lib", name, "index.cjs"));
}
catch (e) {
if (e.code !== "MODULE_NOT_FOUND") {
throw e;
}
Cons = require(name);
}
return new Cons(cfg);
},
};
//# sourceMappingURL=index.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-reports/index.cjs"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,uFAAuF;AAEvF,YAAY,CAAC;AACb;;;GAGG;AACH,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAElC,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,CAAC,IAAI,EAAE,GAAG;QACd,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC;QACT,IAAI,CAAC;YACH,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;gBAClC,MAAM,CAAC,CAAC;YACV,CAAC;YAED,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;CACF,CAAC"}

View File

@@ -0,0 +1,2 @@
export function create(name: any, cfg: any): any;
//# sourceMappingURL=index.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/coverage-module/istanbul-reports/index.cjs"],"names":[],"mappings":"AAWE,iDAcC"}

View File

@@ -0,0 +1,251 @@
// Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
// The link to the original license is in the VENDORED.md file in the parent directory.
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
"use strict";
const InsertionText = require("./insertion-text.cjs");
const lt = "\u0001";
const gt = "\u0002";
const RE_LT = /</g;
const RE_GT = />/g;
const RE_AMP = /&/g;
var RE_lt = /\u0001/g;
var RE_gt = /\u0002/g;
function title(str) {
return ' title="' + str + '" ';
}
function customEscape(text) {
text = String(text);
return text
.replace(RE_AMP, "&amp;")
.replace(RE_LT, "&lt;")
.replace(RE_GT, "&gt;")
.replace(RE_lt, "<")
.replace(RE_gt, ">");
}
function annotateLines(fileCoverage, structuredText) {
const lineStats = fileCoverage.getLineCoverage();
if (!lineStats) {
return;
}
Object.entries(lineStats).forEach(([lineNumber, count]) => {
if (structuredText[lineNumber]) {
structuredText[lineNumber].covered = count > 0 ? "yes" : "no";
structuredText[lineNumber].hits = count;
}
});
}
function annotateStatements(fileCoverage, structuredText) {
const statementStats = fileCoverage.s;
const statementMeta = fileCoverage.statementMap;
Object.entries(statementStats).forEach(([stName, count]) => {
const meta = statementMeta[stName];
const type = count > 0 ? "yes" : "no";
const startCol = meta.start.column;
let endCol = meta.end.column + 1;
const startLine = meta.start.line;
const endLine = meta.end.line;
const openSpan = lt +
'span class="' +
(meta.skip ? "cstat-skip" : "cstat-no") +
'"' +
title("statement not covered") +
gt;
const closeSpan = lt + "/span" + gt;
let text;
if (type === "no" && structuredText[startLine]) {
if (endLine !== startLine) {
endCol = structuredText[startLine].text.originalLength();
}
text = structuredText[startLine].text;
text.wrap(startCol, openSpan, startCol < endCol ? endCol : text.originalLength(), closeSpan);
}
});
}
function annotateFunctions(fileCoverage, structuredText) {
const fnStats = fileCoverage.f;
const fnMeta = fileCoverage.fnMap;
if (!fnStats) {
return;
}
Object.entries(fnStats).forEach(([fName, count]) => {
const meta = fnMeta[fName];
const type = count > 0 ? "yes" : "no";
// Some versions of the instrumenter in the wild populate 'func'
// but not 'decl':
const decl = meta.decl || meta.loc;
const startCol = decl.start.column;
let endCol = decl.end.column + 1;
const startLine = decl.start.line;
const endLine = decl.end.line;
const openSpan = lt +
'span class="' +
(meta.skip ? "fstat-skip" : "fstat-no") +
'"' +
title("function not covered") +
gt;
const closeSpan = lt + "/span" + gt;
let text;
if (type === "no" && structuredText[startLine]) {
if (endLine !== startLine) {
endCol = structuredText[startLine].text.originalLength();
}
text = structuredText[startLine].text;
text.wrap(startCol, openSpan, startCol < endCol ? endCol : text.originalLength(), closeSpan);
}
});
}
function annotateBranches(fileCoverage, structuredText) {
const branchStats = fileCoverage.b;
const branchMeta = fileCoverage.branchMap;
if (!branchStats) {
return;
}
Object.entries(branchStats).forEach(([branchName, branchArray]) => {
const sumCount = branchArray.reduce((p, n) => p + n, 0);
const metaArray = branchMeta[branchName].locations;
let i;
let count;
let meta;
let startCol;
let endCol;
let startLine;
let endLine;
let openSpan;
let closeSpan;
let text;
// only highlight if partial branches are missing or if there is a
// single uncovered branch.
if (sumCount > 0 || (sumCount === 0 && branchArray.length === 1)) {
// Need to recover the metaArray placeholder item to count an implicit else
if (
// Check if the branch is a conditional if branch.
branchMeta[branchName].type === "if" &&
// Check if the branch has an implicit else.
branchArray.length === 2 &&
// Check if the implicit else branch is unaccounted for.
metaArray.length === 1 &&
// Check if the implicit else branch is uncovered.
branchArray[1] === 0) {
metaArray[1] = {
start: {},
end: {},
};
}
for (i = 0; i < branchArray.length && i < metaArray.length; i += 1) {
count = branchArray[i];
meta = metaArray[i];
startCol = meta.start.column;
endCol = meta.end.column + 1;
startLine = meta.start.line;
endLine = meta.end.line;
openSpan =
lt +
'span class="branch-' +
i +
" " +
(meta.skip ? "cbranch-skip" : "cbranch-no") +
'"' +
title("branch not covered") +
gt;
closeSpan = lt + "/span" + gt;
// If the branch is an implicit else from an if statement,
// then the coverage report won't show a statistic.
// Therefore, the previous branch will be used to report that
// there is no coverage on that implicit branch.
if (count === 0 &&
startLine === undefined &&
branchMeta[branchName].type === "if") {
const prevMeta = metaArray[i - 1];
startCol = prevMeta.start.column;
endCol = prevMeta.end.column + 1;
startLine = prevMeta.start.line;
endLine = prevMeta.end.line;
}
if (count === 0 && structuredText[startLine]) {
//skip branches taken
if (endLine !== startLine) {
endCol = structuredText[startLine].text.originalLength();
}
text = structuredText[startLine].text;
if (branchMeta[branchName].type === "if") {
// 'if' is a special case
// since the else branch might not be visible, being nonexistent
text.insertAt(startCol, lt +
'span class="' +
(meta.skip ? "skip-if-branch" : "missing-if-branch") +
'"' +
title((i === 0 ? "if" : "else") + " path not taken") +
gt +
(i === 0 ? "I" : "E") +
lt +
"/span" +
gt, true, false);
}
else {
text.wrap(startCol, openSpan, startCol < endCol ? endCol : text.originalLength(), closeSpan);
}
}
}
}
});
}
function annotateSourceCode(fileCoverage, sourceStore) {
let codeArray;
let lineCoverageArray;
try {
const sourceText = sourceStore.getSource(fileCoverage.path);
const code = sourceText.split(/(?:\r?\n)|\r/);
let count = 0;
const structured = code.map((str) => {
count += 1;
return {
line: count,
covered: "neutral",
hits: 0,
text: new InsertionText(str, true),
};
});
structured.unshift({
line: 0,
covered: null,
text: new InsertionText(""),
});
annotateLines(fileCoverage, structured);
//note: order is important, since statements typically result in spanning the whole line and doing branches late
//causes mismatched tags
annotateBranches(fileCoverage, structured);
annotateFunctions(fileCoverage, structured);
annotateStatements(fileCoverage, structured);
structured.shift();
codeArray = structured.map((item) => customEscape(item.text.toString()) || "&nbsp;");
lineCoverageArray = structured.map((item) => ({
covered: item.covered,
hits: item.hits > 0 ? item.hits + "x" : "&nbsp;",
}));
return {
annotatedCode: codeArray,
lineCoverage: lineCoverageArray,
maxLines: structured.length,
};
}
catch (ex) {
codeArray = [ex.message];
lineCoverageArray = [{ covered: "no", hits: 0 }];
String(ex.stack || "")
.split(/\r?\n/)
.forEach((line) => {
codeArray.push(line);
lineCoverageArray.push({ covered: "no", hits: 0 });
});
return {
annotatedCode: codeArray,
lineCoverage: lineCoverageArray,
maxLines: codeArray.length,
};
}
}
module.exports = annotateSourceCode;
//# sourceMappingURL=annotator.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
export = annotateSourceCode;
declare function annotateSourceCode(fileCoverage: any, sourceStore: any): {
annotatedCode: any;
lineCoverage: any;
maxLines: any;
};
//# sourceMappingURL=annotator.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"annotator.d.cts","sourceRoot":"","sources":["../../../../../../src/coverage-module/istanbul-reports/lib/html/annotator.cjs"],"names":[],"mappings":";AA4OA;;;;EA0DC"}

View File

@@ -0,0 +1,227 @@
/* Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
The link to the original license is in the VENDORED.md file in the parent directory. */
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* yellow */
.cbranch-no { background: yellow !important; color: #111; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
.highlighted,
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
background: #C21F39 !important;
}
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
/* dark yellow (gold) */
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
.medium .chart { border:1px solid #f9cd0b; }
/* light yellow */
.medium { background: #fff4c2; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
span.cline-neutral { background: #eaeaea; }
.coverage-summary td.empty {
opacity: .5;
padding-top: 4px;
padding-bottom: 4px;
line-height: 1;
color: #888;
}
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=block-navigation.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"block-navigation.d.ts","sourceRoot":"","sources":["../../../../../../../src/coverage-module/istanbul-reports/lib/html/assets/block-navigation.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,87 @@
// Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
// The link to the original license is in the VENDORED.md file in the parent directory.
var jumpToCode = (function init() {
// Classes of code we would like to highlight in the file view
var missingCoverageClasses = [".cbranch-no", ".cstat-no", ".fstat-no"];
// Elements to highlight in the file listing view
var fileListingElements = ["td.pct.low"];
// We don't want to select elements that are direct descendants of another match
var notSelector = ":not(" + missingCoverageClasses.join("):not(") + ") > "; // becomes `:not(a):not(b) > `
// Selector that finds elements on the page to which we can jump
var selector =
fileListingElements.join(", ") +
", " +
notSelector +
missingCoverageClasses.join(", " + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
// The NodeList of matching elements
var missingCoverageElements = document.querySelectorAll(selector);
var currentIndex;
function toggleClass(index) {
missingCoverageElements.item(currentIndex).classList.remove("highlighted");
missingCoverageElements.item(index).classList.add("highlighted");
}
function makeCurrent(index) {
toggleClass(index);
currentIndex = index;
missingCoverageElements.item(index).scrollIntoView({
behavior: "smooth",
block: "center",
inline: "center",
});
}
function goToPrevious() {
var nextIndex = 0;
if (typeof currentIndex !== "number" || currentIndex === 0) {
nextIndex = missingCoverageElements.length - 1;
} else if (missingCoverageElements.length > 1) {
nextIndex = currentIndex - 1;
}
makeCurrent(nextIndex);
}
function goToNext() {
var nextIndex = 0;
if (
typeof currentIndex === "number" &&
currentIndex < missingCoverageElements.length - 1
) {
nextIndex = currentIndex + 1;
}
makeCurrent(nextIndex);
}
return function jump(event) {
if (
document.getElementById("fileSearch") === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
return;
}
switch (event.which) {
case 78: // n
case 74: // j
goToNext();
break;
case 66: // b
case 75: // k
case 80: // p
goToPrevious();
break;
}
};
})();
window.addEventListener("keydown", jumpToCode);

View File

@@ -0,0 +1 @@
{"version":3,"file":"block-navigation.js","sourceRoot":"","sources":["../../../../../../../src/coverage-module/istanbul-reports/lib/html/assets/block-navigation.js"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,uFAAuF;AAEvF,IAAI,UAAU,GAAG,CAAC,SAAS,IAAI;IAC7B,8DAA8D;IAC9D,IAAI,sBAAsB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAEvE,iDAAiD;IACjD,IAAI,mBAAmB,GAAG,CAAC,YAAY,CAAC,CAAC;IAEzC,gFAA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C,CAAC;IACzB,CAAC;IAED,SAAS,QAAQ;QACf,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IACE,OAAO,YAAY,KAAK,QAAQ;YAChC,YAAY,GAAG,uBAAuB,CAAC,MAAM,GAAG,CAAC,EACjD,CAAC;YACD,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC;QAC/B,CAAC;QAED,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,IAAI,CAAC,KAAK;QACxB,IACE,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,QAAQ,CAAC,aAAa;YAChE,QAAQ,CAAC,aAAa,IAAI,IAAI,EAC9B,CAAC;YACD,4EAA4E;YAC5E,OAAO;QACT,CAAC;QAED,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;YACpB,KAAK,EAAE,CAAC,CAAC,IAAI;YACb,KAAK,EAAE,EAAE,IAAI;gBACX,QAAQ,EAAE,CAAC;gBACX,MAAM;YACR,KAAK,EAAE,CAAC,CAAC,IAAI;YACb,KAAK,EAAE,CAAC,CAAC,IAAI;YACb,KAAK,EAAE,EAAE,IAAI;gBACX,YAAY,EAAE,CAAC;gBACf,MAAM;QACV,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AACL,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=sorter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sorter.d.ts","sourceRoot":"","sources":["../../../../../../../src/coverage-module/istanbul-reports/lib/html/assets/sorter.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,211 @@
// Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
// The link to the original license is in the VENDORED.md file in the parent directory.
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
desc: false,
};
// returns the summary table element
function getTable() {
return document.querySelector(".coverage-summary");
}
// returns the thead element of the summary table
function getTableHeader() {
return getTable().querySelector("thead tr");
}
// returns the tbody element of the summary table
function getTableBody() {
return getTable().querySelector("tbody");
}
// returns the th element for nth column
function getNthColumn(n) {
return getTableHeader().querySelectorAll("th")[n];
}
function onFilterInput() {
const searchValue = document.getElementById("fileSearch").value;
const rows = document.getElementsByTagName("tbody")[0].children;
// Try to create a RegExp from the searchValue. If it fails (invalid regex),
// it will be treated as a plain text search
let searchRegex;
try {
searchRegex = new RegExp(searchValue, "i"); // 'i' for case-insensitive
} catch (error) {
searchRegex = null;
}
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
let isMatch = false;
if (searchRegex) {
// If a valid regex was created, use it for matching
isMatch = searchRegex.test(row.textContent);
} else {
// Otherwise, fall back to the original plain text search
isMatch = row.textContent
.toLowerCase()
.includes(searchValue.toLowerCase());
}
row.style.display = isMatch ? "" : "none";
}
}
// loads the search box
function addSearchBox() {
var template = document.getElementById("filterTemplate");
var templateClone = template.content.cloneNode(true);
templateClone.getElementById("fileSearch").oninput = onFilterInput;
template.parentElement.appendChild(templateClone);
}
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll("th"),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute("data-col"),
sortable: !colNode.getAttribute("data-nosort"),
type: colNode.getAttribute("data-type") || "string",
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === "number";
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll("td"),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute("data-value");
if (col.type === "number") {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll("tr"),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function (a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector(".coverage-summary tbody"),
rowNodes = tableBody.querySelectorAll("tr"),
rows = [],
i;
if (desc) {
finalSorter = function (a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, "").replace(/ sorted-desc$/, "");
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc
? " sorted-desc"
: " sorted";
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function () {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i = 0; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector(".sorter").parentElement;
if (el.addEventListener) {
el.addEventListener("click", ithSorter(i));
} else {
el.attachEvent("onclick", ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function () {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData();
addSearchBox();
addSortIndicators();
enableUI();
};
})();
window.addEventListener("load", addSorting);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
/* Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
The link to the original license is in the VENDORED.md file in the parent directory. */
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=prettify.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"prettify.d.ts","sourceRoot":"","sources":["../../../../../../../../src/coverage-module/istanbul-reports/lib/html/assets/vendor/prettify.js"],"names":[],"mappings":""}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,341 @@
// Contains code copied from istanbul-reports (https://github.com/istanbuljs/istanbuljs/tree/main/packages/istanbul-reports).
// The link to the original license is in the VENDORED.md file in the parent directory.
"use strict";
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const fs = require("node:fs");
const path = require("node:path");
const html = require("../../../html-escaper/index.cjs");
const ReportBase = require("../../../istanbul-lib-report/lib/report-base.cjs");
const annotator = require("./annotator.cjs");
function htmlHead(details) {
return `
<head>
<title>Code coverage report for ${html.escape(details.entity)}</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="${html.escape(details.prettify.css)}" />
<link rel="stylesheet" href="${html.escape(details.base.css)}" />
<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)});
}
</style>
</head>
`;
}
function headerTemplate(details) {
function metricsTemplate({ pct, covered, total }, kind) {
return `
<div class='fl pad1y space-right2'>
<span class="strong">${pct}% </span>
<span class="quiet">${kind}</span>
<span class='fraction'>${covered}/${total}</span>
</div>
`;
}
function skipTemplate(metrics) {
const statements = metrics.statements.skipped;
const branches = metrics.branches.skipped;
const functions = metrics.functions.skipped;
const countLabel = (c, label, plural) => c === 0 ? [] : `${c} ${label}${c === 1 ? "" : plural}`;
const skips = [].concat(countLabel(statements, "statement", "s"), countLabel(functions, "function", "s"), countLabel(branches, "branch", "es"));
if (skips.length === 0) {
return "";
}
return `
<div class='fl pad1y'>
<span class="strong">${skips.join(", ")}</span>
<span class="quiet">Ignored</span> &nbsp;&nbsp;&nbsp;&nbsp;
</div>
`;
}
return `
<!doctype html>
<html lang="en">
${htmlHead(details)}
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>${details.pathHtml}</h1>
<div class='clearfix'>
${metricsTemplate(details.metrics.statements, "Statements")}
${metricsTemplate(details.metrics.branches, "Branches")}
${metricsTemplate(details.metrics.functions, "Functions")}
${metricsTemplate(details.metrics.lines, "Lines")}
${skipTemplate(details.metrics)}
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line ${details.reportClass}'></div>
`;
}
function footerTemplate(details) {
return `
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at ${html.escape(details.datetime)}
</div>
<script src="${html.escape(details.prettify.js)}"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="${html.escape(details.sorter.js)}"></script>
<script src="${html.escape(details.blockNavigation.js)}"></script>
</body>
</html>
`;
}
function detailTemplate(data) {
const lineNumbers = new Array(data.maxLines).fill().map((_, i) => i + 1);
const lineLink = (num) => `<a name='L${num}'></a><a href='#L${num}'>${num}</a>`;
const lineCount = (line) => `<span class="cline-any cline-${line.covered}">${line.hits}</span>`;
/* This is rendered in a `<pre>`, need control of all whitespace. */
return [
"<tr>",
`<td class="line-count quiet">${lineNumbers.map(lineLink).join("\n")}</td>`,
`<td class="line-coverage quiet">${data.lineCoverage
.map(lineCount)
.join("\n")}</td>`,
`<td class="text"><pre class="prettyprint lang-js">${data.annotatedCode.join("\n")}</pre></td>`,
"</tr>",
].join("");
}
const summaryTableHeader = [
'<div class="pad1">',
'<table class="coverage-summary">',
"<thead>",
"<tr>",
' <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>',
' <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>',
' <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>',
' <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>',
' <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>',
' <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>',
' <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>',
' <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>',
' <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>',
' <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>',
"</tr>",
"</thead>",
"<tbody>",
].join("\n");
function summaryLineTemplate(details) {
const { reportClasses, metrics, file, output } = details;
const percentGraph = (pct) => {
if (!isFinite(pct)) {
return "";
}
const cls = ["cover-fill"];
if (pct === 100) {
cls.push("cover-full");
}
pct = Math.floor(pct);
return [
`<div class="${cls.join(" ")}" style="width: ${pct}%"></div>`,
`<div class="cover-empty" style="width: ${100 - pct}%"></div>`,
].join("");
};
const summaryType = (type, showGraph = false) => {
const info = metrics[type];
const reportClass = reportClasses[type];
const result = [
`<td data-value="${info.pct}" class="pct ${reportClass}">${info.pct}%</td>`,
`<td data-value="${info.total}" class="abs ${reportClass}">${info.covered}/${info.total}</td>`,
];
if (showGraph) {
result.unshift(`<td data-value="${info.pct}" class="pic ${reportClass}">`, `<div class="chart">${percentGraph(info.pct)}</div>`, `</td>`);
}
return result;
};
return []
.concat("<tr>", `<td class="file ${reportClasses.statements}" data-value="${html.escape(file)}"><a href="${html.escape(output)}">${html.escape(file)}</a></td>`, summaryType("statements", true), summaryType("branches"), summaryType("functions"), summaryType("lines"), "</tr>\n")
.join("\n\t");
}
const summaryTableFooter = ["</tbody>", "</table>", "</div>"].join("\n");
const emptyClasses = {
statements: "empty",
lines: "empty",
functions: "empty",
branches: "empty",
};
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.posix.relative(sourcePath, targetPath);
},
assetPath(node, name) {
return this.relativePath(this.getPath(node), name);
},
};
function fixPct(metrics) {
Object.keys(emptyClasses).forEach((key) => {
metrics[key].pct = 0;
});
return metrics;
}
class HtmlReport extends ReportBase {
constructor(opts) {
super();
this.verbose = opts.verbose;
this.linkMapper = opts.linkMapper || standardLinkMapper;
this.subdir = opts.subdir || "";
this.date = new Date().toISOString();
this.skipEmpty = opts.skipEmpty;
}
getBreadcrumbHtml(node) {
let parent = node.getParent();
const nodePath = [];
while (parent) {
nodePath.push(parent);
parent = parent.getParent();
}
const linkPath = nodePath.map((ancestor) => {
const target = this.linkMapper.relativePath(node, ancestor);
const name = ancestor.getRelativeName() || "All files";
return '<a href="' + target + '">' + name + "</a>";
});
linkPath.reverse();
return linkPath.length > 0
? linkPath.join(" / ") + " " + node.getRelativeName()
: "All files";
}
fillTemplate(node, templateData, context) {
const linkMapper = this.linkMapper;
const summary = node.getCoverageSummary();
templateData.entity = node.getQualifiedName() || "All files";
templateData.metrics = summary;
templateData.reportClass = context.classForPercent("statements", summary.statements.pct);
templateData.pathHtml = this.getBreadcrumbHtml(node);
templateData.base = {
css: linkMapper.assetPath(node, "base.css"),
};
templateData.sorter = {
js: linkMapper.assetPath(node, "sorter.js"),
image: linkMapper.assetPath(node, "sort-arrow-sprite.png"),
};
templateData.blockNavigation = {
js: linkMapper.assetPath(node, "block-navigation.js"),
};
templateData.prettify = {
js: linkMapper.assetPath(node, "prettify.js"),
css: linkMapper.assetPath(node, "prettify.css"),
};
templateData.favicon = linkMapper.assetPath(node, "favicon.png");
}
getTemplateData() {
return { datetime: this.date };
}
getWriter(context) {
if (!this.subdir) {
return context.writer;
}
return context.writer.writerForDir(this.subdir);
}
onStart(root, context) {
const assetHeaders = {
".js": "/* eslint-disable */\n",
};
[".", "vendor"].forEach((subdir) => {
const writer = this.getWriter(context);
const srcDir = path.resolve(__dirname, "assets", subdir);
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, assetHeaders[path.extname(f)]);
}
});
});
}
onSummary(node, context) {
const linkMapper = this.linkMapper;
const templateData = this.getTemplateData();
const children = node.getChildren();
const skipEmpty = this.skipEmpty;
this.fillTemplate(node, templateData, context);
const cw = this.getWriter(context).writeFile(linkMapper.getPath(node));
cw.write(headerTemplate(templateData));
cw.write(summaryTableHeader);
children.forEach((child) => {
const metrics = child.getCoverageSummary();
const isEmpty = metrics.isEmpty();
if (skipEmpty && isEmpty) {
return;
}
const reportClasses = isEmpty
? emptyClasses
: {
statements: context.classForPercent("statements", metrics.statements.pct),
lines: context.classForPercent("lines", metrics.lines.pct),
functions: context.classForPercent("functions", metrics.functions.pct),
branches: context.classForPercent("branches", metrics.branches.pct),
};
const data = {
metrics: isEmpty ? fixPct(metrics) : metrics,
reportClasses,
file: child.getRelativeName(),
output: linkMapper.relativePath(node, child),
};
cw.write(summaryLineTemplate(data) + "\n");
});
cw.write(summaryTableFooter);
cw.write(footerTemplate(templateData));
cw.close();
}
onDetail(node, context) {
const linkMapper = this.linkMapper;
const templateData = this.getTemplateData();
this.fillTemplate(node, templateData, context);
const cw = this.getWriter(context).writeFile(linkMapper.getPath(node));
cw.write(headerTemplate(templateData));
cw.write('<pre><table class="coverage">\n');
cw.write(detailTemplate(annotator(node.getFileCoverage(), context)));
cw.write("</table></pre>\n");
cw.write(footerTemplate(templateData));
cw.close();
}
}
module.exports = HtmlReport;
//# sourceMappingURL=index.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
export = HtmlReport;
declare class HtmlReport extends ReportBase {
constructor(opts: any);
verbose: any;
linkMapper: any;
subdir: any;
date: string;
skipEmpty: any;
getBreadcrumbHtml(node: any): string;
fillTemplate(node: any, templateData: any, context: any): void;
getTemplateData(): {
datetime: string;
};
getWriter(context: any): any;
onStart(root: any, context: any): void;
onSummary(node: any, context: any): void;
onDetail(node: any, context: any): void;
}
import ReportBase = require("../../../istanbul-lib-report/lib/report-base.cjs");
//# sourceMappingURL=index.d.cts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../../../src/coverage-module/istanbul-reports/lib/html/index.cjs"],"names":[],"mappings":";AAkQA;IACE,uBAQC;IALC,aAA2B;IAC3B,gBAAuD;IACvD,YAA+B;IAC/B,aAAoC;IACpC,eAA+B;IAGjC,qCAmBC;IAED,+DAyBC;IAED;;MAEC;IAED,6BAKC;IAED,uCAuBC;IAED,yCAyCC;IAED,wCAYC;CACF"}

Some files were not shown because too many files have changed in this diff Show More