Class: DeepCover::Reporter::Istanbul::CoveredCodeConverter
- Inherits:
-
Struct
- Object
- Struct
- DeepCover::Reporter::Istanbul::CoveredCodeConverter
show all
- Includes:
- Converters
- Defined in:
- lib/deep_cover/reporter/istanbul.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Converters
#convert_block, #convert_branch, #convert_def, #convert_function, #convert_list, #convert_range
Instance Attribute Details
#covered_code ⇒ Object
Returns the value of attribute covered_code
71
72
73
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 71
def covered_code
@covered_code
end
|
#options ⇒ Object
Returns the value of attribute options
71
72
73
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 71
def options
@options
end
|
Instance Method Details
#branch_map ⇒ Object
94
95
96
97
98
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 94
def branch_map
branches.map do |node, branches_runs|
convert_branch(node, branches_runs.keys)
end
end
|
#branch_runs ⇒ Object
105
106
107
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 105
def branch_runs
branches.values.map { |r| zero_to_something(r.values) }
end
|
#branches ⇒ Object
90
91
92
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 90
def branches
@branches ||= Analyser::Branch.new(node_analyser, **options).results
end
|
#convert ⇒ Object
136
137
138
139
140
141
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 136
def convert
{
path: covered_code.path,
**data.transform_values { |l| convert_list(l) },
}
end
|
#data ⇒ Object
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 125
def data
{
statementMap: statement_map,
s: statement_runs,
fnMap: function_map,
f: function_runs,
branchMap: branch_map,
b: branch_runs,
}
end
|
#function_map ⇒ Object
117
118
119
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 117
def function_map
functions.keys.map { |n| convert_function(n) }
end
|
#function_runs ⇒ Object
121
122
123
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 121
def function_runs
functions.values
end
|
#functions ⇒ Object
82
83
84
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 82
def functions
@functions ||= Analyser::Function.new(node_analyser, **options).results
end
|
#node_analyser ⇒ Object
74
75
76
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 74
def node_analyser
@node_analyser ||= Analyser::Node.new(covered_code, **options)
end
|
#node_runs ⇒ Object
78
79
80
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 78
def node_runs
@node_runs ||= node_analyser.results
end
|
#statement_map ⇒ Object
109
110
111
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 109
def statement_map
statements.keys.map { |range| convert_range(range) }
end
|
#statement_runs ⇒ Object
113
114
115
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 113
def statement_runs
statements.values
end
|
#statements ⇒ Object
86
87
88
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 86
def statements
@statements ||= Analyser::Statement.new(node_analyser, **options).results
end
|
#zero_to_something(values) ⇒ Object
Istanbul doesn’t understand how to ignore a branch…
101
102
103
|
# File 'lib/deep_cover/reporter/istanbul.rb', line 101
def zero_to_something(values)
values.map { |v| v || 1 }
end
|