rooibos-roku 5.10.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/framework/BaseTestSuite.bs +48 -4
- package/dist/lib/framework/CodeCoverage.brs +18 -14
- package/dist/lib/framework/CodeCoverageSupport.brs +3 -3
- package/dist/lib/framework/Coverage.bs +27 -9
- package/dist/lib/framework/Rooibos.bs +4 -1
- package/dist/lib/framework/TestResult.bs +1 -1
- package/dist/lib/rooibos/Annotation.js +73 -76
- package/dist/lib/rooibos/Annotation.js.map +1 -1
- package/dist/lib/rooibos/CodeCoverageProcessor.js +37 -43
- package/dist/lib/rooibos/CodeCoverageProcessor.js.map +1 -1
- package/dist/lib/rooibos/FileFactory.js +2 -2
- package/dist/lib/rooibos/FileFactory.js.map +1 -1
- package/dist/lib/rooibos/MockUtil.js +78 -46
- package/dist/lib/rooibos/MockUtil.js.map +1 -1
- package/dist/lib/rooibos/RooibosSession.js +19 -16
- package/dist/lib/rooibos/RooibosSession.js.map +1 -1
- package/dist/lib/rooibos/TestGroup.js +29 -11
- package/dist/lib/rooibos/TestGroup.js.map +1 -1
- package/dist/lib/rooibos/Utils.js +19 -1
- package/dist/lib/rooibos/Utils.js.map +1 -1
- package/dist/plugin.js +3 -5
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
|
@@ -267,7 +267,7 @@ namespace rooibos
|
|
|
267
267
|
if m.catchCrashes and not test.noCatch and not m.noCatch
|
|
268
268
|
try
|
|
269
269
|
test.run()
|
|
270
|
-
if m.isAutoAssertingMocks = true
|
|
270
|
+
if m.isAutoAssertingMocks = true and not test.isAsync
|
|
271
271
|
m.AssertMocks()
|
|
272
272
|
m.CleanMocks()
|
|
273
273
|
m.CleanStubs()
|
|
@@ -278,7 +278,7 @@ namespace rooibos
|
|
|
278
278
|
end try
|
|
279
279
|
else
|
|
280
280
|
test.run()
|
|
281
|
-
if m.isAutoAssertingMocks = true
|
|
281
|
+
if m.isAutoAssertingMocks = true and not test.isAsync
|
|
282
282
|
m.AssertMocks()
|
|
283
283
|
m.CleanMocks()
|
|
284
284
|
m.CleanStubs()
|
|
@@ -313,6 +313,28 @@ namespace rooibos
|
|
|
313
313
|
return false
|
|
314
314
|
end function
|
|
315
315
|
|
|
316
|
+
' /**
|
|
317
|
+
' * @memberof module:BaseTestSuite
|
|
318
|
+
' * @name failCrash
|
|
319
|
+
' * @function
|
|
320
|
+
' * @instance
|
|
321
|
+
' * @description Fail immediately, with the given exception
|
|
322
|
+
' * @param {Dynamic} [error] - exception to fail on
|
|
323
|
+
' * @param {Dynamic} [msg=""] - message to display in the test report
|
|
324
|
+
' * @returns {boolean} - true if failure was set, false if the test is already failed
|
|
325
|
+
' */
|
|
326
|
+
function failCrash(error as dynamic, msg = "Error" as string) as dynamic
|
|
327
|
+
if m.currentResult.isFail
|
|
328
|
+
if m.throwOnFailedAssertion
|
|
329
|
+
throw m.currentResult.getMessage()
|
|
330
|
+
end if
|
|
331
|
+
return false
|
|
332
|
+
end if
|
|
333
|
+
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
334
|
+
m.currentResult.crash(msg, error)
|
|
335
|
+
return true
|
|
336
|
+
end function
|
|
337
|
+
|
|
316
338
|
function failBecauseOfTimeOut() as dynamic
|
|
317
339
|
if m.currentResult.isFail
|
|
318
340
|
return false
|
|
@@ -1802,8 +1824,25 @@ namespace rooibos
|
|
|
1802
1824
|
return invalid
|
|
1803
1825
|
end function
|
|
1804
1826
|
|
|
1805
|
-
function stubCall(invocation as dynamic,
|
|
1806
|
-
'
|
|
1827
|
+
function stubCall(invocation as dynamic, stubOrReturnValue = invalid as dynamic, functionName = "" as string) as object
|
|
1828
|
+
' When stubbing global functions this will be called. Other wise the test code will be updated to call m._stubCall()
|
|
1829
|
+
if type(invocation).endsWith("Function") and functionName = ""
|
|
1830
|
+
functionName = invocation.toStr().tokenize(" ").peek()
|
|
1831
|
+
else
|
|
1832
|
+
throw "Did not provide a function to be stubbed"
|
|
1833
|
+
end if
|
|
1834
|
+
|
|
1835
|
+
if not type(stubOrReturnValue).endsWith("Function")
|
|
1836
|
+
throw "Did not provide a stub function"
|
|
1837
|
+
end if
|
|
1838
|
+
|
|
1839
|
+
' Store the stub on the component scope
|
|
1840
|
+
globalAa = getGlobalAa()
|
|
1841
|
+
if type(globalAa?.__globalStubs) <> "roAssociativeArray"
|
|
1842
|
+
globalAa.__globalStubs = {}
|
|
1843
|
+
end if
|
|
1844
|
+
|
|
1845
|
+
globalAa.__globalStubs[lCase(functionName)] = stubOrReturnValue
|
|
1807
1846
|
return invalid
|
|
1808
1847
|
end function
|
|
1809
1848
|
|
|
@@ -2262,6 +2301,7 @@ namespace rooibos
|
|
|
2262
2301
|
rooibos.resetMocksByFunctionName()
|
|
2263
2302
|
end function
|
|
2264
2303
|
|
|
2304
|
+
|
|
2265
2305
|
' /**
|
|
2266
2306
|
' * @memberof module:BaseTestSuite
|
|
2267
2307
|
' * @name cleanStubs
|
|
@@ -2270,6 +2310,10 @@ namespace rooibos
|
|
|
2270
2310
|
' * @description Cleans up all tracking data associated with stubs
|
|
2271
2311
|
' */
|
|
2272
2312
|
function cleanStubs() as void
|
|
2313
|
+
' Clean up the global functions mocks as well
|
|
2314
|
+
globalAa = getGlobalAa()
|
|
2315
|
+
globalAa.__globalStubs = invalid
|
|
2316
|
+
|
|
2273
2317
|
if m.stubs = invalid
|
|
2274
2318
|
return
|
|
2275
2319
|
end if
|
|
@@ -2,33 +2,37 @@ function init()
|
|
|
2
2
|
m.resolvedMap = {}
|
|
3
3
|
m.top.observeField("entry", "onEntryChange")
|
|
4
4
|
m.top.observeField("save", "onSave")
|
|
5
|
-
|
|
5
|
+
m.results = []
|
|
6
6
|
end function
|
|
7
7
|
|
|
8
8
|
function setExpectedMap()
|
|
9
|
-
m.top.expectedMap = #EXPECTED_MAP#
|
|
9
|
+
m.top.expectedMap = "#EXPECTED_MAP#"
|
|
10
10
|
end function
|
|
11
11
|
|
|
12
12
|
function setFilePathMap()
|
|
13
|
-
m.top.filePathMap = #FILE_PATH_MAP#
|
|
13
|
+
m.top.filePathMap = "#FILE_PATH_MAP#"
|
|
14
14
|
end function
|
|
15
15
|
|
|
16
16
|
function onEntryChange()
|
|
17
|
-
entry = m.top.entry
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if lineMap = invalid
|
|
22
|
-
lineMap = {}
|
|
23
|
-
end if
|
|
24
|
-
lineMap[entry.l] = entry.r
|
|
25
|
-
|
|
26
|
-
m.resolvedMap[entry.f] = lineMap
|
|
27
|
-
end if
|
|
17
|
+
entry = m.top.entry
|
|
18
|
+
' defer till later
|
|
19
|
+
m.results.push(entry)
|
|
28
20
|
end function
|
|
29
21
|
|
|
30
22
|
function onSave()
|
|
31
23
|
? "saving data"
|
|
24
|
+
for each entry in m.results
|
|
25
|
+
if entry <> invalid
|
|
26
|
+
fileId = entry.f
|
|
27
|
+
lineMap = m.resolvedMap[fileId]
|
|
28
|
+
|
|
29
|
+
if lineMap = invalid
|
|
30
|
+
lineMap = {}
|
|
31
|
+
m.resolvedMap[fileId] = lineMap
|
|
32
|
+
end if
|
|
33
|
+
lineMap[entry.l] = entry.r
|
|
34
|
+
end if
|
|
35
|
+
end for
|
|
32
36
|
m.top.resolvedMap = m.resolvedMap
|
|
33
37
|
setExpectedMap()
|
|
34
38
|
setFilePathMap()
|
|
@@ -22,7 +22,7 @@ function RBS_ReportCodeCoverage() as void
|
|
|
22
22
|
resolvedCount = cc.resolvedMap[key].count()
|
|
23
23
|
allLinesHit += resolvedCount
|
|
24
24
|
resolvedPercent = (resolvedCount / expectedCount) * 100
|
|
25
|
-
hitFiles.push({percent:resolvedPercent, text:filename + ": " +str(resolvedPercent).trim() + "% (" + stri(resolvedCount).trim() + "/" + stri(expectedCount).trim() + ")"})
|
|
25
|
+
hitFiles.push({ percent: resolvedPercent, text: filename + ": " + str(resolvedPercent).trim() + "% (" + stri(resolvedCount).trim() + "/" + stri(expectedCount).trim() + ")" })
|
|
26
26
|
else
|
|
27
27
|
missFiles.push(filename + ": MISS!")
|
|
28
28
|
end if
|
|
@@ -41,13 +41,13 @@ function RBS_ReportCodeCoverage() as void
|
|
|
41
41
|
? "HIT FILES"
|
|
42
42
|
? "---------"
|
|
43
43
|
hitFiles.SortBy("percent")
|
|
44
|
-
for i = 0 to hitFiles.count() -1
|
|
44
|
+
for i = 0 to hitFiles.count() - 1
|
|
45
45
|
? hitFiles[i].text
|
|
46
46
|
end for
|
|
47
47
|
? ""
|
|
48
48
|
? "MISSED FILES"
|
|
49
49
|
? "------------"
|
|
50
|
-
for i = 0 to missFiles.count() -1
|
|
50
|
+
for i = 0 to missFiles.count() - 1
|
|
51
51
|
? missFiles[i]
|
|
52
52
|
end for
|
|
53
53
|
|
|
@@ -5,31 +5,46 @@ namespace rooibos.Coverage
|
|
|
5
5
|
? "There was no rooibos code coverage component - not generating coverage report"
|
|
6
6
|
return
|
|
7
7
|
end if
|
|
8
|
+
t = createObject("roTimespan")
|
|
8
9
|
? ""
|
|
9
10
|
? "...Generating code coverage report"
|
|
10
11
|
? ""
|
|
11
12
|
m.global._rbs_ccn.save = true
|
|
12
13
|
cc = m.global._rbs_ccn
|
|
14
|
+
expectedMap = cc.expectedMap
|
|
15
|
+
filePathMap = cc.filePathMap
|
|
16
|
+
resolvedMap = cc.resolvedMap
|
|
17
|
+
|
|
13
18
|
hitFiles = []
|
|
14
19
|
missFiles = []
|
|
15
20
|
allLinesCount = 0
|
|
16
21
|
allLinesHit = 0
|
|
17
|
-
for each key in
|
|
18
|
-
filename =
|
|
19
|
-
expectedCount =
|
|
22
|
+
for each key in expectedMap
|
|
23
|
+
filename = filePathMap[key]
|
|
24
|
+
expectedCount = expectedMap[key].count()
|
|
20
25
|
allLinesCount += expectedCount
|
|
21
26
|
if expectedCount > 0
|
|
22
|
-
if
|
|
23
|
-
resolvedCount =
|
|
27
|
+
if resolvedMap[key] <> invalid
|
|
28
|
+
resolvedCount = resolvedMap[key].count()
|
|
24
29
|
allLinesHit += resolvedCount
|
|
25
|
-
|
|
30
|
+
if resolvedCount = 0
|
|
31
|
+
resolvedPercent = 0
|
|
32
|
+
else
|
|
33
|
+
resolvedPercent = (resolvedCount / expectedCount) * 100
|
|
34
|
+
end if
|
|
26
35
|
hitFiles.push({ percent: resolvedPercent, text: filename + ": " + str(resolvedPercent).trim() + "% (" + stri(resolvedCount).trim() + "/" + stri(expectedCount).trim() + ")" })
|
|
27
36
|
else
|
|
28
37
|
missFiles.push(filename + ": MISS!")
|
|
29
38
|
end if
|
|
39
|
+
else
|
|
40
|
+
missFiles.push(filename + ": MISS!")
|
|
30
41
|
end if
|
|
31
42
|
end for
|
|
32
|
-
|
|
43
|
+
if allLinesHit = 0
|
|
44
|
+
allLinesPercent = 0
|
|
45
|
+
else
|
|
46
|
+
allLinesPercent = (allLinesHit / allLinesCount) * 100
|
|
47
|
+
end if
|
|
33
48
|
? ""
|
|
34
49
|
? ""
|
|
35
50
|
? "+++++++++++++++++++++++++++++++++++++++++++"
|
|
@@ -37,7 +52,7 @@ namespace rooibos.Coverage
|
|
|
37
52
|
? "+++++++++++++++++++++++++++++++++++++++++++"
|
|
38
53
|
? ""
|
|
39
54
|
? "Total Coverage: " ; str(allLinesPercent).trim() ; "% (" ; stri(allLinesHit).trim() ; "/" + stri(allLinesCount).trim() ; ")"
|
|
40
|
-
? "Files: " ;
|
|
55
|
+
? "Files: " ; resolvedMap.count(); "/" ; expectedMap.count()
|
|
41
56
|
? ""
|
|
42
57
|
? "HIT FILES"
|
|
43
58
|
? "---------"
|
|
@@ -51,7 +66,10 @@ namespace rooibos.Coverage
|
|
|
51
66
|
for i = 0 to missFiles.count() - 1
|
|
52
67
|
? missFiles[i]
|
|
53
68
|
end for
|
|
54
|
-
|
|
69
|
+
? ""
|
|
70
|
+
? "+++++++++++++++++++++++++++++++++++++++++++"
|
|
71
|
+
? "Code Coverage Report Complete"; t.totalMilliseconds(); "ms"
|
|
72
|
+
? "+++++++++++++++++++++++++++++++++++++++++++"
|
|
55
73
|
end function
|
|
56
74
|
|
|
57
75
|
function createLCovOutput()
|
|
@@ -18,7 +18,10 @@ namespace rooibos
|
|
|
18
18
|
screen.show()
|
|
19
19
|
|
|
20
20
|
m.global = screen.getGlobalNode()
|
|
21
|
-
m.global.addFields({
|
|
21
|
+
m.global.addFields({
|
|
22
|
+
"testsScene": scene
|
|
23
|
+
"_rbs_ccn": createObject("roSGNode", "CodeCoverage")' bs:disable-line
|
|
24
|
+
})
|
|
22
25
|
|
|
23
26
|
if scene.hasField("isReadyToStartTests") and scene.isReadyToStartTests = false
|
|
24
27
|
? "The scene is not ready yet - waiting for it to set isReadyToStartTests to true"
|
|
@@ -95,82 +95,79 @@ class RooibosAnnotation {
|
|
|
95
95
|
(0, Diagnostics_1.diagnosticMultipleDescribeAnnotations)(file, a);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
case AnnotationType.None:
|
|
172
|
-
default:
|
|
173
|
-
continue;
|
|
98
|
+
// Break up the annotations grouped by Describes
|
|
99
|
+
let blocks = [];
|
|
100
|
+
let currentBlock = [];
|
|
101
|
+
for (const annotation of statement.annotations) {
|
|
102
|
+
currentBlock.push(annotation);
|
|
103
|
+
if (getAnnotationType(annotation.name) === AnnotationType.Describe) {
|
|
104
|
+
blocks.push(currentBlock);
|
|
105
|
+
currentBlock = [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Make sure to push the last block as the last annotation likely wasn't a Describe
|
|
109
|
+
if (blocks[blocks.length - 1] !== currentBlock) {
|
|
110
|
+
blocks.push(currentBlock);
|
|
111
|
+
}
|
|
112
|
+
for (const annotationBlock of blocks) {
|
|
113
|
+
// eslint-disable-next-line no-inner-declarations
|
|
114
|
+
function getAnnotationsOfType(...names) {
|
|
115
|
+
return annotationBlock.filter(a => names.includes(a.name.toLowerCase()));
|
|
116
|
+
}
|
|
117
|
+
noEarlyExit = getAnnotationsOfType(AnnotationType.NoEarlyExit).length > 0;
|
|
118
|
+
noCatch = getAnnotationsOfType(AnnotationType.NoCatch).length > 0;
|
|
119
|
+
isSolo = getAnnotationsOfType(AnnotationType.Solo).length > 0;
|
|
120
|
+
isIgnore = getAnnotationsOfType(AnnotationType.Ignore).length > 0;
|
|
121
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.Async)) {
|
|
122
|
+
async = true;
|
|
123
|
+
asyncTimeout = annotation.getArguments().length === 1 ? parseInt(annotation.getArguments()[0]) : -1;
|
|
124
|
+
}
|
|
125
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.NodeTest)) {
|
|
126
|
+
nodeName = annotation.getArguments()[0];
|
|
127
|
+
}
|
|
128
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.Tags)) {
|
|
129
|
+
tags = annotation.getArguments().map((a) => a === null || a === void 0 ? void 0 : a.toString());
|
|
130
|
+
}
|
|
131
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.BeforeEach, AnnotationType.AfterEach, AnnotationType.Setup, AnnotationType.TearDown)) {
|
|
132
|
+
testAnnotation = new RooibosAnnotation(file, annotation, getAnnotationType(annotation.name), annotation.name, annotation.name);
|
|
133
|
+
}
|
|
134
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.Describe, AnnotationType.TestSuite)) {
|
|
135
|
+
const groupName = annotation.getArguments()[0];
|
|
136
|
+
blockAnnotation = new RooibosAnnotation(file, annotation, getAnnotationType(annotation.name), annotation.name, groupName, isIgnore, isSolo, null, nodeName, tags, noCatch, noEarlyExit);
|
|
137
|
+
blockAnnotation.isAsync = async;
|
|
138
|
+
blockAnnotation.asyncTimeout = asyncTimeout === -1 ? 60000 : asyncTimeout;
|
|
139
|
+
nodeName = null;
|
|
140
|
+
isSolo = false;
|
|
141
|
+
isIgnore = false;
|
|
142
|
+
async = false;
|
|
143
|
+
asyncTimeout = -1;
|
|
144
|
+
}
|
|
145
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.It)) {
|
|
146
|
+
const testName = annotation.getArguments()[0];
|
|
147
|
+
if (!testName || testName.trim() === '') {
|
|
148
|
+
(0, Diagnostics_1.diagnosticNoTestNameDefined)(file, annotation);
|
|
149
|
+
}
|
|
150
|
+
let newAnnotation = new RooibosAnnotation(file, annotation, getAnnotationType(annotation.name), annotation.name, testName, isIgnore, isSolo, undefined, undefined, tags, noCatch);
|
|
151
|
+
newAnnotation.isAsync = async;
|
|
152
|
+
newAnnotation.asyncTimeout = asyncTimeout === -1 ? 2000 : asyncTimeout;
|
|
153
|
+
if (testAnnotation) {
|
|
154
|
+
(0, Diagnostics_1.diagnosticMultipleTestOnFunctionDefined)(file, newAnnotation.annotation);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
testAnnotation = newAnnotation;
|
|
158
|
+
}
|
|
159
|
+
isSolo = false;
|
|
160
|
+
isIgnore = false;
|
|
161
|
+
async = false;
|
|
162
|
+
asyncTimeout = -1;
|
|
163
|
+
}
|
|
164
|
+
for (const annotation of getAnnotationsOfType(AnnotationType.Params, AnnotationType.SoloParams, AnnotationType.IgnoreParams)) {
|
|
165
|
+
if (testAnnotation) {
|
|
166
|
+
testAnnotation.parseParams(file, annotation, getAnnotationType(annotation.name), noCatch);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
//error
|
|
170
|
+
}
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Annotation.js","sourceRoot":"","sources":["../../../src/lib/rooibos/Annotation.ts"],"names":[],"mappings":";;;AACA,sDAA4K;AAE5K,IAAY,cAmBX;AAnBD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,2BAAS,CAAA;IACT,mCAAiB,CAAA;IACjB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;IACjB,+CAA6B,CAAA;IAC7B,2CAAyB,CAAA;IACzB,iCAAe,CAAA;IACf,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,6CAA2B,CAAA;AAC/B,CAAC,EAnBW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAmBzB;AAED,IAAI,gBAAgB,GAAG;IACnB,KAAK,EAAE,cAAc,CAAC,SAAS;IAC/B,QAAQ,EAAE,cAAc,CAAC,QAAQ;IACjC,EAAE,EAAE,cAAc,CAAC,EAAE;IACrB,MAAM,EAAE,cAAc,CAA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E,cAA8B,EAAE,OAAgB;QAChH,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;QAC1D,IAAI,MAAM,GAAG,cAAc,KAAK,cAAc,CAAC,UAAU,CAAC;QAC1D,IAAI,QAAQ,GAAG,cAAc,KAAK,cAAc,CAAC,YAAY,CAAC;QAC9D,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC7B;QACD,IAAI;YACA,IAAI,SAAS,EAAE;gBACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,YAAY,EAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;aAC3J;iBAAM;gBACH,IAAA,qCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;aAC7C;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,IAAA,qCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;SAC7C;IACL,CAAC;CAEJ;AAzJD,8CAyJC;AAED,SAAgB,iBAAiB,CAAC,IAAY;IAC1C,OAAO,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;AACvE,CAAC;AAFD,8CAEC"}
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CodeCoverageProcessor = exports.CodeCoverageLineType = void 0;
|
|
4
4
|
const brighterscript_1 = require("brighterscript");
|
|
5
|
-
const brighterscript = require("brighterscript");
|
|
6
5
|
const RawCodeStatement_1 = require("./RawCodeStatement");
|
|
7
6
|
const BrsTranspileState_1 = require("brighterscript/dist/parser/BrsTranspileState");
|
|
8
|
-
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
9
7
|
const RawCodeExpression_1 = require("./RawCodeExpression");
|
|
10
8
|
var CodeCoverageLineType;
|
|
11
9
|
(function (CodeCoverageLineType) {
|
|
@@ -17,27 +15,22 @@ var CodeCoverageLineType;
|
|
|
17
15
|
class CodeCoverageProcessor {
|
|
18
16
|
constructor(builder, fileFactory) {
|
|
19
17
|
this.coverageBrsTemplate = `
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'? "Coverage maps are not created - creating now"
|
|
27
|
-
if m.global._rbs_ccn = invalid
|
|
28
|
-
'? "Coverage maps are not created - creating now"
|
|
29
|
-
m.global.addFields({
|
|
30
|
-
"_rbs_ccn": createObject("roSGNode", "CodeCoverage")
|
|
31
|
-
})
|
|
32
|
-
end if
|
|
33
|
-
m._rbs_ccn = m.global._rbs_ccn
|
|
34
|
-
end if
|
|
35
|
-
end if
|
|
18
|
+
function RBS_CC_#ID#_reportLine(lineNumber, reportType = 1)
|
|
19
|
+
_rbs_ccn = m._rbs_ccn
|
|
20
|
+
if _rbs_ccn <> invalid
|
|
21
|
+
_rbs_ccn.entry = { "f": "#ID#", "l": lineNumber, "r": reportType }
|
|
22
|
+
return true
|
|
23
|
+
end if
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
_rbs_ccn = m?.global?._rbs_ccn
|
|
26
|
+
if _rbs_ccn <> invalid
|
|
27
|
+
_rbs_ccn.entry = { "f": "#ID#", "l": lineNumber, "r": reportType }
|
|
28
|
+
m._rbs_ccn = _rbs_ccn
|
|
29
|
+
return true
|
|
30
|
+
end if
|
|
31
|
+
return true
|
|
32
|
+
end function
|
|
33
|
+
`;
|
|
41
34
|
this.config = builder.options.rooibos || {};
|
|
42
35
|
this.expectedCoverageMap = {};
|
|
43
36
|
this.filePathMap = {};
|
|
@@ -50,9 +43,7 @@ end function
|
|
|
50
43
|
}
|
|
51
44
|
}
|
|
52
45
|
generateMetadata(isUsingCoverage, program) {
|
|
53
|
-
|
|
54
|
-
this.fileFactory.createCoverageComponent(program, this.expectedCoverageMap, this.filePathMap);
|
|
55
|
-
}
|
|
46
|
+
this.fileFactory.createCoverageComponent(program, this.expectedCoverageMap, this.filePathMap);
|
|
56
47
|
}
|
|
57
48
|
addCodeCoverage(file, astEditor) {
|
|
58
49
|
if (this.config.isRecordingCodeCoverage) {
|
|
@@ -71,21 +62,24 @@ end function
|
|
|
71
62
|
this.addStatement(ds);
|
|
72
63
|
ds.forToken.text = `${this.getFuncCallText(ds.range.start.line, CodeCoverageLineType.code)}: for`;
|
|
73
64
|
},
|
|
74
|
-
IfStatement: (
|
|
65
|
+
IfStatement: (ifStatement, parent, owner, key) => {
|
|
75
66
|
var _a;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if ((blockStatements === null || blockStatements === void 0 ? void 0 : blockStatements.length) > 0) {
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
86
|
-
let coverageStatement = new RawCodeStatement_1.RawCodeStatement(this.getFuncCallText(ifStatement.range.start.line - 1, CodeCoverageLineType.branch));
|
|
67
|
+
this.addStatement(ifStatement);
|
|
68
|
+
ifStatement.condition = new brighterscript_1.BinaryExpression(new RawCodeExpression_1.RawCodeExpression(this.getFuncCallText(ifStatement.condition.range.start.line, CodeCoverageLineType.condition)), (0, brighterscript_1.createToken)(brighterscript_1.TokenKind.And), new brighterscript_1.GroupingExpression({
|
|
69
|
+
left: (0, brighterscript_1.createToken)(brighterscript_1.TokenKind.LeftParen),
|
|
70
|
+
right: (0, brighterscript_1.createToken)(brighterscript_1.TokenKind.RightParen)
|
|
71
|
+
}, ifStatement.condition));
|
|
72
|
+
let blockStatements = (_a = ifStatement === null || ifStatement === void 0 ? void 0 : ifStatement.thenBranch) === null || _a === void 0 ? void 0 : _a.statements;
|
|
73
|
+
if (blockStatements) {
|
|
74
|
+
let coverageStatement = new RawCodeStatement_1.RawCodeStatement(this.getFuncCallText(ifStatement.range.start.line, CodeCoverageLineType.branch));
|
|
87
75
|
blockStatements.splice(0, 0, coverageStatement);
|
|
88
76
|
}
|
|
77
|
+
// Handle the else blocks
|
|
78
|
+
let elseBlock = ifStatement.elseBranch;
|
|
79
|
+
if ((0, brighterscript_1.isBlock)(elseBlock) && elseBlock.statements) {
|
|
80
|
+
let coverageStatement = new RawCodeStatement_1.RawCodeStatement(this.getFuncCallText(elseBlock.range.start.line - 1, CodeCoverageLineType.branch));
|
|
81
|
+
elseBlock.statements.splice(0, 0, coverageStatement);
|
|
82
|
+
}
|
|
89
83
|
},
|
|
90
84
|
GotoStatement: (ds, parent, owner, key) => {
|
|
91
85
|
this.addStatement(ds);
|
|
@@ -121,7 +115,7 @@ end function
|
|
|
121
115
|
this.convertStatementToCoverageStatement(ds, CodeCoverageLineType.code, owner, key);
|
|
122
116
|
},
|
|
123
117
|
AssignmentStatement: (ds, parent, owner, key) => {
|
|
124
|
-
if (!
|
|
118
|
+
if (!(0, brighterscript_1.isForStatement)(parent)) {
|
|
125
119
|
this.addStatement(ds);
|
|
126
120
|
this.convertStatementToCoverageStatement(ds, CodeCoverageLineType.code, owner, key);
|
|
127
121
|
}
|
|
@@ -133,7 +127,7 @@ end function
|
|
|
133
127
|
}), { walkMode: brighterscript_1.WalkMode.visitAllRecursive });
|
|
134
128
|
this.expectedCoverageMap[this.fileId.toString().trim()] = Array.from(this.coverageMap);
|
|
135
129
|
this.filePathMap[this.fileId] = file.pkgPath;
|
|
136
|
-
this.addBrsAPIText(file);
|
|
130
|
+
this.addBrsAPIText(file, astEditor);
|
|
137
131
|
}
|
|
138
132
|
convertStatementToCoverageStatement(statement, coverageType, owner, key) {
|
|
139
133
|
if (this.processedStatements.has(statement)) {
|
|
@@ -146,9 +140,9 @@ end function
|
|
|
146
140
|
// store the statement in a set to avoid handling again after inserting statement above
|
|
147
141
|
this.processedStatements.add(statement);
|
|
148
142
|
}
|
|
149
|
-
addBrsAPIText(file) {
|
|
150
|
-
const
|
|
151
|
-
file.ast.statements
|
|
143
|
+
addBrsAPIText(file, astEditor) {
|
|
144
|
+
const astCodeToInject = brighterscript_1.Parser.parse(this.coverageBrsTemplate.replace(/\#ID\#/g, this.fileId.toString().trim())).ast.statements;
|
|
145
|
+
astEditor.arrayPush(file.ast.statements, ...astCodeToInject);
|
|
152
146
|
}
|
|
153
147
|
addStatement(statement, lineNumber) {
|
|
154
148
|
if (!this.executableLines.has(lineNumber)) {
|
|
@@ -156,7 +150,7 @@ end function
|
|
|
156
150
|
}
|
|
157
151
|
}
|
|
158
152
|
getFuncCallText(lineNumber, lineType) {
|
|
159
|
-
return `RBS_CC_${this.fileId}_reportLine(${lineNumber.toString().trim()}, ${lineType.toString().trim()})`;
|
|
153
|
+
return `RBS_CC_${this.fileId}_reportLine("${lineNumber.toString().trim()}", ${lineType.toString().trim()})`;
|
|
160
154
|
}
|
|
161
155
|
}
|
|
162
156
|
exports.CodeCoverageProcessor = CodeCoverageProcessor;
|