From 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Mar 2022 19:02:27 +0200 Subject: Added node_modules for the updating to work properly. --- .../lib/html-spa/src/summaryTableLine.js | 159 +++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js (limited to 'node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js') diff --git a/node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js b/node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js new file mode 100644 index 0000000..6dc56e6 --- /dev/null +++ b/node_modules/istanbul-reports/lib/html-spa/src/summaryTableLine.js @@ -0,0 +1,159 @@ +const React = require('react'); + +function MetricCells({ metrics }) { + const { classForPercent, pct, covered, missed, total } = metrics; + + return ( + <> + {Math.round(pct)}% + +
+
+
+ + {covered} + {missed} + {total} + + ); +} + +function FileCell({ + file, + prefix, + expandedLines, + setExpandedLines, + hasChildren, + setFileFilter +}) { + if (hasChildren) { + const expandedIndex = expandedLines.indexOf(prefix + file); + const isExpanded = expandedIndex >= 0; + const newExpandedLines = isExpanded + ? [ + ...expandedLines.slice(0, expandedIndex), + ...expandedLines.slice(expandedIndex + 1) + ] + : [...expandedLines, prefix + file]; + + return ( + <> + + setFileFilter(prefix + file)} + > + {file} + + + ); + } else { + return {file}; + } +} + +function getWorstMetricClassForPercent(metricsToShow, metrics) { + let classForPercent = 'none'; + for (const metricToShow in metricsToShow) { + if (metricsToShow[metricToShow]) { + const metricClassForPercent = metrics[metricToShow].classForPercent; + + // ignore none metrics so they don't change whats shown + if (metricClassForPercent === 'none') { + continue; + } + + // if the metric low or lower than whats currently being used, replace it + if ( + metricClassForPercent == 'low' || + (metricClassForPercent === 'medium' && + classForPercent !== 'low') || + (metricClassForPercent === 'high' && + classForPercent !== 'low' && + classForPercent !== 'medium') + ) { + classForPercent = metricClassForPercent; + } + } + } + return classForPercent; +} + +module.exports = function SummaryTableLine({ + prefix, + metrics, + file, + children, + tabSize, + metricsToShow, + expandedLines, + setExpandedLines, + fileFilter, + setFileFilter +}) { + tabSize = tabSize || 0; + if (children && tabSize > 0) { + tabSize--; + } + prefix = (fileFilter ? fileFilter + '/' : '') + (prefix || ''); + + return ( + <> + + + {/* eslint-disable-line prefer-spread */ Array.apply(null, { + length: tabSize + }).map((nothing, index) => ( + + ))} + + + {metricsToShow.statements && ( + + )} + {metricsToShow.branches && ( + + )} + {metricsToShow.functions && ( + + )} + {metricsToShow.lines && } + + {children && + expandedLines.indexOf(prefix + file) >= 0 && + children.map(child => ( + + ))} + + ); +}; -- cgit v1.2.3