testilo 46.0.0 → 47.0.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/package.json +1 -1
- package/procs/excerpts/excerpts.js +14 -10
package/package.json
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
/*
|
|
24
24
|
excerpts
|
|
25
|
-
Excerpt collation proc
|
|
25
|
+
Excerpt and text collation proc
|
|
26
26
|
|
|
27
|
-
Adds
|
|
27
|
+
Adds directories of element excerpts and texts to a Testaro report.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
// FUNCTIONS
|
|
31
31
|
|
|
32
|
-
// Adds a directory of element excerpts to a Testaro report.
|
|
32
|
+
// Adds a directory of element excerpts and texts to a Testaro report.
|
|
33
33
|
exports.collateExcerpts = report => {
|
|
34
34
|
const {acts} = report;
|
|
35
35
|
// If there are any acts in the report:
|
|
@@ -40,6 +40,7 @@ exports.collateExcerpts = report => {
|
|
|
40
40
|
if (testActs.length) {
|
|
41
41
|
// Initialize an excerpt directory in the report in place.
|
|
42
42
|
const excerpts = report.excerpts = {};
|
|
43
|
+
const texts = report.texts = {};
|
|
43
44
|
// For each test act:
|
|
44
45
|
testActs.forEach(act => {
|
|
45
46
|
const {which, standardResult} = act;
|
|
@@ -53,13 +54,16 @@ exports.collateExcerpts = report => {
|
|
|
53
54
|
) {
|
|
54
55
|
// For each instance of the tool:
|
|
55
56
|
standardResult.instances.forEach(instance => {
|
|
56
|
-
// Get the excerpt
|
|
57
|
-
const {excerpt, pathID} = instance;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
// Get the excerpt, path ID, and text, if any, of the element.
|
|
58
|
+
const {excerpt, pathID, text} = instance;
|
|
59
|
+
excerpts[pathID] ??= {};
|
|
60
|
+
texts[pathID] ??= {};
|
|
61
|
+
// If a path ID exists:
|
|
62
|
+
if (pathID) {
|
|
63
|
+
// Add the excerpt to the excerpt directory unless one already exists.
|
|
64
|
+
excerpts[pathID][which] ??= excerpt;
|
|
65
|
+
// Add the text to the text directory unless one already exists.
|
|
66
|
+
texts[pathID][which] ??= text;
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
69
|
}
|