Struct swc_coverage_instrument::FileCoverage
source · pub struct FileCoverage {
pub all: bool,
pub path: String,
pub statement_map: IndexMap<u32, Range, RandomState>,
pub fn_map: IndexMap<u32, Function, RandomState>,
pub branch_map: IndexMap<u32, Branch, RandomState>,
pub s: IndexMap<u32, u32, RandomState>,
pub f: IndexMap<u32, u32, RandomState>,
pub b: IndexMap<u32, Vec<u32, Global>, RandomState>,
pub b_t: Option<IndexMap<u32, Vec<u32, Global>, RandomState>>,
pub input_source_map: Option<SourceMap>,
}Expand description
provides a read-only view of coverage for a single file.
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
Note: internally it uses IndexMap to represent key-value pairs for the coverage data, as logic for merge relies on the order of keys in the map.
Fields§
§all: bool§path: String§statement_map: IndexMap<u32, Range, RandomState>§fn_map: IndexMap<u32, Function, RandomState>§branch_map: IndexMap<u32, Branch, RandomState>§s: IndexMap<u32, u32, RandomState>§f: IndexMap<u32, u32, RandomState>§b: IndexMap<u32, Vec<u32, Global>, RandomState>§b_t: Option<IndexMap<u32, Vec<u32, Global>, RandomState>>§input_source_map: Option<SourceMap>Implementations§
source§impl FileCoverage
impl FileCoverage
pub fn empty(file_path: String, report_logic: bool) -> FileCoverage
pub fn from_file_path(file_path: String, report_logic: bool) -> FileCoverage
pub fn from_file_coverage(coverage: &FileCoverage) -> FileCoverage
sourcepub fn get_line_coverage(&self) -> IndexMap<u32, u32, RandomState>
pub fn get_line_coverage(&self) -> IndexMap<u32, u32, RandomState>
Returns computed line coverage from statement coverage. This is a map of hits keyed by line number in the source.
sourcepub fn get_uncovered_lines(&self) -> Vec<u32, Global>
pub fn get_uncovered_lines(&self) -> Vec<u32, Global>
Returns an array of uncovered line numbers.
pub fn get_branch_coverage_by_line( &self ) -> IndexMap<u32, Coverage, RandomState>
pub fn to_json()
sourcepub fn merge(&mut self, coverage: &FileCoverage)
pub fn merge(&mut self, coverage: &FileCoverage)
Merges a second coverage object into this one, updating hit counts
pub fn compute_simple_totals<T>( line_map: &IndexMap<T, u32, RandomState> ) -> Totals
pub fn reset_hits(&mut self)
pub fn to_summary(&self) -> CoverageSummary
Trait Implementations§
source§impl Clone for FileCoverage
impl Clone for FileCoverage
source§fn clone(&self) -> FileCoverage
fn clone(&self) -> FileCoverage
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for FileCoverage
impl Debug for FileCoverage
source§impl<'de> Deserialize<'de> for FileCoverage
impl<'de> Deserialize<'de> for FileCoverage
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<FileCoverage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<FileCoverage, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl PartialEq<FileCoverage> for FileCoverage
impl PartialEq<FileCoverage> for FileCoverage
source§fn eq(&self, other: &FileCoverage) -> bool
fn eq(&self, other: &FileCoverage) -> bool
self and other values to be equal, and is used
by ==.