mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
71 lines
5.6 KiB
JavaScript
71 lines
5.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
/**
|
|
* Creates a deep copy of a process coverage.
|
|
*
|
|
* @param processCov Process coverage to clone.
|
|
* @return Cloned process coverage.
|
|
*/
|
|
function cloneProcessCov(processCov) {
|
|
const result = [];
|
|
for (const scriptCov of processCov.result) {
|
|
result.push(cloneScriptCov(scriptCov));
|
|
}
|
|
return {
|
|
result,
|
|
};
|
|
}
|
|
exports.cloneProcessCov = cloneProcessCov;
|
|
/**
|
|
* Creates a deep copy of a script coverage.
|
|
*
|
|
* @param scriptCov Script coverage to clone.
|
|
* @return Cloned script coverage.
|
|
*/
|
|
function cloneScriptCov(scriptCov) {
|
|
const functions = [];
|
|
for (const functionCov of scriptCov.functions) {
|
|
functions.push(cloneFunctionCov(functionCov));
|
|
}
|
|
return {
|
|
scriptId: scriptCov.scriptId,
|
|
url: scriptCov.url,
|
|
functions,
|
|
};
|
|
}
|
|
exports.cloneScriptCov = cloneScriptCov;
|
|
/**
|
|
* Creates a deep copy of a function coverage.
|
|
*
|
|
* @param functionCov Function coverage to clone.
|
|
* @return Cloned function coverage.
|
|
*/
|
|
function cloneFunctionCov(functionCov) {
|
|
const ranges = [];
|
|
for (const rangeCov of functionCov.ranges) {
|
|
ranges.push(cloneRangeCov(rangeCov));
|
|
}
|
|
return {
|
|
functionName: functionCov.functionName,
|
|
ranges,
|
|
isBlockCoverage: functionCov.isBlockCoverage,
|
|
};
|
|
}
|
|
exports.cloneFunctionCov = cloneFunctionCov;
|
|
/**
|
|
* Creates a deep copy of a function coverage.
|
|
*
|
|
* @param rangeCov Range coverage to clone.
|
|
* @return Cloned range coverage.
|
|
*/
|
|
function cloneRangeCov(rangeCov) {
|
|
return {
|
|
startOffset: rangeCov.startOffset,
|
|
endOffset: rangeCov.endOffset,
|
|
count: rangeCov.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