aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/istanbul-lib-coverage
diff options
context:
space:
mode:
Diffstat (limited to 'vanilla/node_modules/istanbul-lib-coverage')
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/CHANGELOG.md209
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/LICENSE24
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/README.md29
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/index.js64
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/lib/coverage-map.js134
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/lib/coverage-summary.js112
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/lib/data-properties.js12
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/lib/file-coverage.js444
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/lib/percent.js15
-rw-r--r--vanilla/node_modules/istanbul-lib-coverage/package.json47
10 files changed, 0 insertions, 1090 deletions
diff --git a/vanilla/node_modules/istanbul-lib-coverage/CHANGELOG.md b/vanilla/node_modules/istanbul-lib-coverage/CHANGELOG.md
deleted file mode 100644
index 31adc75..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/CHANGELOG.md
+++ /dev/null
@@ -1,209 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file.
-See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
-
-# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.2...istanbul-lib-coverage@3.0.0) (2019-12-20)
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-
-
-
-
-# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.1...istanbul-lib-coverage@3.0.0-alpha.2) (2019-12-07)
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-
-
-
-
-# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@3.0.0-alpha.0...istanbul-lib-coverage@3.0.0-alpha.1) (2019-10-06)
-
-
-### Bug Fixes
-
-* Drop unneeded coverage data from `nyc --all` ([#456](https://github.com/istanbuljs/istanbuljs/issues/456)) ([f6bb0b4](https://github.com/istanbuljs/istanbuljs/commit/f6bb0b4)), closes [#123](https://github.com/istanbuljs/istanbuljs/issues/123) [#224](https://github.com/istanbuljs/istanbuljs/issues/224) [#260](https://github.com/istanbuljs/istanbuljs/issues/260) [#322](https://github.com/istanbuljs/istanbuljs/issues/322) [#413](https://github.com/istanbuljs/istanbuljs/issues/413)
-
-
-
-
-
-# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.5...istanbul-lib-coverage@3.0.0-alpha.0) (2019-06-19)
-
-
-### Features
-
-* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
-
-
-### BREAKING CHANGES
-
-* Node.js 8 is now required
-
-
-
-
-
-## [3.2.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.2.1...istanbul-lib-coverage-v3.2.2) (2023-11-07)
-
-
-### Bug Fixes
-
-* [#753](https://github.com/istanbuljs/istanbuljs/issues/753) ([c4895bb](https://github.com/istanbuljs/istanbuljs/commit/c4895bb418c55700182f481b914b74b2865a9bea))
-* Proper data validation in findNearestContainer ([#754](https://github.com/istanbuljs/istanbuljs/issues/754)) ([c4895bb](https://github.com/istanbuljs/istanbuljs/commit/c4895bb418c55700182f481b914b74b2865a9bea)), closes [#753](https://github.com/istanbuljs/istanbuljs/issues/753)
-
-## [3.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.2.0...istanbul-lib-coverage-v3.2.1) (2023-11-04)
-
-
-### Bug Fixes
-
-* https://github.com/istanbuljs/v8-to-istanbul/issues/233 ([288888f](https://github.com/istanbuljs/istanbuljs/commit/288888fef02ea35baf536bdd4d390ee12233ceb3))
-* merge ranges properly when contained by other ranges in set ([#750](https://github.com/istanbuljs/istanbuljs/issues/750)) ([288888f](https://github.com/istanbuljs/istanbuljs/commit/288888fef02ea35baf536bdd4d390ee12233ceb3))
-
-## [3.2.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.1.0...istanbul-lib-coverage-v3.2.0) (2021-10-17)
-
-
-### Features
-
-* allow FileCoverage to be initialized with logical tracking ([#644](https://www.github.com/istanbuljs/istanbuljs/issues/644)) ([4cb5af1](https://www.github.com/istanbuljs/istanbuljs/commit/4cb5af1daaf33c3e9a5f3ee44f6bb7f958e5ba04))
-
-## [3.1.0](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.2...istanbul-lib-coverage-v3.1.0) (2021-10-17)
-
-
-### Features
-
-* support tracking Logic Truthiness as additional metric in coverage API ([#639](https://www.github.com/istanbuljs/istanbuljs/issues/639)) ([0967c80](https://www.github.com/istanbuljs/istanbuljs/commit/0967c80b905c3c17675ff2185b2325784e8dc0a2))
-
-### [3.0.2](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.1...istanbul-lib-coverage-v3.0.2) (2021-10-11)
-
-
-### Bug Fixes
-
-* handle merging '0' indexed coverage with '1' indexed coverage ([5dac2bc](https://www.github.com/istanbuljs/istanbuljs/commit/5dac2bcf28d6f27dbb720be72c2b692153418ab5)), closes [#632](https://www.github.com/istanbuljs/istanbuljs/issues/632)
-
-### [3.0.1](https://www.github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage-v3.0.0...istanbul-lib-coverage-v3.0.1) (2021-09-23)
-
-
-### Bug Fixes
-
-* merge branch/statement/functionMap's together when merging two coverage reports ([#617](https://www.github.com/istanbuljs/istanbuljs/issues/617)) ([ff1b5e9](https://www.github.com/istanbuljs/istanbuljs/commit/ff1b5e915201e4ff8f737010509bab98d8238118))
-
-## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.4...istanbul-lib-coverage@2.0.5) (2019-04-24)
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-
-
-
-
-## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.3...istanbul-lib-coverage@2.0.4) (2019-03-12)
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-
-
-
-
-## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.2...istanbul-lib-coverage@2.0.3) (2019-01-26)
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-
-
-
-
-<a name="2.0.2"></a>
-## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.1...istanbul-lib-coverage@2.0.2) (2018-12-25)
-
-
-
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-<a name="2.0.1"></a>
-## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@2.0.0...istanbul-lib-coverage@2.0.1) (2018-07-07)
-
-
-
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-<a name="2.0.0"></a>
-# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.2.0...istanbul-lib-coverage@2.0.0) (2018-06-06)
-
-
-### Bug Fixes
-
-* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c))
-
-
-### BREAKING CHANGES
-
-* a null prototype is now used in several places rather than the default `{}` assignment.
-
-
-
-
-<a name="1.2.0"></a>
-# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.2...istanbul-lib-coverage@1.2.0) (2018-03-04)
-
-
-### Features
-
-* add skip-empty option for html & text reports ([#140](https://github.com/istanbuljs/istanbuljs/issues/140)) ([d2a4262](https://github.com/istanbuljs/istanbuljs/commit/d2a4262))
-
-
-
-
-<a name="1.1.2"></a>
-## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.1...istanbul-lib-coverage@1.1.2) (2018-02-13)
-
-
-
-
-**Note:** Version bump only for package istanbul-lib-coverage
-
-<a name="1.1.1"></a>
-## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-coverage@1.1.0...istanbul-lib-coverage@1.1.1) (2017-05-27)
-
-
-
-
-<a name="1.1.0"></a>
-# [1.1.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.2...istanbul-lib-coverage@1.1.0) (2017-04-29)
-
-
-### Bug Fixes
-
-* getBranchCoverageByLine() was looking for line coverage using wrong object structure ([bf36658](https://github.com/istanbuljs/istanbul-lib-coverage/commit/bf36658))
-
-
-### Features
-
-* add possibility to filter coverage maps when running reports post-hoc ([#24](https://github.com/istanbuljs/istanbuljs/issues/24)) ([e1c99d6](https://github.com/istanbuljs/istanbul-lib-coverage/commit/e1c99d6))
-
-
-
-
-<a name="1.0.2"></a>
-## [1.0.2](https://github.com/istanbuljs/istanbul-lib-coverage/compare/istanbul-lib-coverage@1.0.1...istanbul-lib-coverage@1.0.2) (2017-03-27)
-
-<a name="1.0.1"></a>
-## [1.0.1](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0...v1.0.1) (2017-01-18)
-
-
-### Bug Fixes
-
-* handle edge-case surrounding merging two file coverage reports ([22e154c](https://github.com/istanbuljs/istanbul-lib-coverage/commit/22e154c))
-
-
-
-<a name="1.0.0"></a>
-# [1.0.0](https://github.com/istanbuljs/istanbul-lib-coverage/compare/v1.0.0-alpha.3...v1.0.0) (2016-08-12)
-
-
-### Bug Fixes
-
-* guard against missing statement ([76aad99](https://github.com/istanbuljs/istanbul-lib-coverage/commit/76aad99))
diff --git a/vanilla/node_modules/istanbul-lib-coverage/LICENSE b/vanilla/node_modules/istanbul-lib-coverage/LICENSE
deleted file mode 100644
index d55d291..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright 2012-2015 Yahoo! Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Yahoo! Inc. nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vanilla/node_modules/istanbul-lib-coverage/README.md b/vanilla/node_modules/istanbul-lib-coverage/README.md
deleted file mode 100644
index 2c24a56..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-## istanbul-lib-coverage
-
-[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-coverage.svg)](https://greenkeeper.io/)
-[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-coverage.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-coverage)
-
-An API that provides a read-only view of coverage information with the ability
-to merge and summarize coverage info.
-
-Supersedes `object-utils` and `collector` from the v0 istanbul API.
-
-See the docs for the full API.
-
-```js
-var libCoverage = require('istanbul-lib-coverage');
-var map = libCoverage.createCoverageMap(globalCoverageVar);
-var summary = libCoverage.createCoverageSummary();
-
-// merge another coverage map into the one we created
-map.merge(otherCoverageMap);
-
-// inspect and summarize all file coverage objects in the map
-map.files().forEach(function(f) {
- var fc = map.fileCoverageFor(f),
- s = fc.toSummary();
- summary.merge(s);
-});
-
-console.log('Global summary', summary);
-```
diff --git a/vanilla/node_modules/istanbul-lib-coverage/index.js b/vanilla/node_modules/istanbul-lib-coverage/index.js
deleted file mode 100644
index bdc5a18..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/index.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- 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');
-const { CoverageMap } = require('./lib/coverage-map');
-const { CoverageSummary } = require('./lib/coverage-summary');
-
-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
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-map.js b/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-map.js
deleted file mode 100644
index 0a1ebd0..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-map.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- 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');
-const { CoverageSummary } = require('./coverage-summary');
-
-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;
- }
-
- /**
- * adds a file coverage object to this map. If the path for the object,
- * already exists in the map, it is merged with the existing coverage
- * otherwise a new key is added to the map.
- * @param {FileCoverage} fc the file coverage to add
- */
- 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
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-summary.js b/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-summary.js
deleted file mode 100644
index 9b769c6..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/lib/coverage-summary.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- 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');
-const dataProperties = require('./data-properties');
-
-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
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/lib/data-properties.js b/vanilla/node_modules/istanbul-lib-coverage/lib/data-properties.js
deleted file mode 100644
index 3a12d40..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/lib/data-properties.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-module.exports = function dataProperties(klass, properties) {
- properties.forEach(p => {
- Object.defineProperty(klass.prototype, p, {
- enumerable: true,
- get() {
- return this.data[p];
- }
- });
- });
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/lib/file-coverage.js b/vanilla/node_modules/istanbul-lib-coverage/lib/file-coverage.js
deleted file mode 100644
index 4ed4c09..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/lib/file-coverage.js
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- 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');
-const dataProperties = require('./data-properties');
-const { CoverageSummary } = require('./coverage-summary');
-
-// 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
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/lib/percent.js b/vanilla/node_modules/istanbul-lib-coverage/lib/percent.js
deleted file mode 100644
index c7b7aaf..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/lib/percent.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- 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;
- }
-};
diff --git a/vanilla/node_modules/istanbul-lib-coverage/package.json b/vanilla/node_modules/istanbul-lib-coverage/package.json
deleted file mode 100644
index deefa79..0000000
--- a/vanilla/node_modules/istanbul-lib-coverage/package.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "name": "istanbul-lib-coverage",
- "version": "3.2.2",
- "description": "Data library for istanbul coverage objects",
- "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",
- "main": "index.js",
- "files": [
- "lib",
- "index.js"
- ],
- "scripts": {
- "test": "nyc mocha"
- },
- "devDependencies": {
- "chai": "^4.2.0",
- "mocha": "^6.2.2",
- "nyc": "^15.0.0-beta.2"
- },
- "karmaDeps": {
- "browserify-istanbul": "^0.2.1",
- "karma": "^0.13.10",
- "karma-browserify": "^4.2.1",
- "karma-chrome-launcher": "^0.2.0",
- "karma-coverage": "^0.4.2",
- "karma-mocha": "^0.2.0",
- "karma-phantomjs-launcher": "^0.2.0",
- "phantomjs": "^1.9.17"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
- "directory": "packages/istanbul-lib-coverage"
- },
- "keywords": [
- "istanbul",
- "coverage",
- "data"
- ],
- "license": "BSD-3-Clause",
- "bugs": {
- "url": "https://github.com/istanbuljs/istanbuljs/issues"
- },
- "homepage": "https://istanbul.js.org/",
- "engines": {
- "node": ">=8"
- }
-}