testilo 47.0.0 → 47.1.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 +33 -2
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
// FUNCTIONS
|
|
31
31
|
|
|
32
|
-
// Adds
|
|
32
|
+
// Adds directories 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:
|
|
@@ -38,7 +38,7 @@ exports.collateExcerpts = report => {
|
|
|
38
38
|
const testActs = acts.filter(act => act.type === 'test');
|
|
39
39
|
// If there are any:
|
|
40
40
|
if (testActs.length) {
|
|
41
|
-
// Initialize
|
|
41
|
+
// Initialize excerpt and text directories in the report in place.
|
|
42
42
|
const excerpts = report.excerpts = {};
|
|
43
43
|
const texts = report.texts = {};
|
|
44
44
|
// For each test act:
|
|
@@ -68,6 +68,37 @@ exports.collateExcerpts = report => {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
+
// If the text directory is non-empty:
|
|
72
|
+
if (Object.keys(texts).length) {
|
|
73
|
+
// For each path ID in it:
|
|
74
|
+
Object.keys(texts).forEach(pathID => {
|
|
75
|
+
const toolNames = Object.keys(texts[pathID]);
|
|
76
|
+
// If the element has only 1 text:
|
|
77
|
+
if (toolNames.length === 1) {
|
|
78
|
+
// Change the key to unanimous.
|
|
79
|
+
texts[pathID].unanimous = texts[pathID][toolNames[0]];
|
|
80
|
+
delete texts[pathID][toolNames[0]];
|
|
81
|
+
}
|
|
82
|
+
// Otherwise, i.e. if the element has more than 1 text:
|
|
83
|
+
else {
|
|
84
|
+
// If all the texts are identical:
|
|
85
|
+
if (
|
|
86
|
+
Object
|
|
87
|
+
.values(texts[pathID])
|
|
88
|
+
.slice(1)
|
|
89
|
+
.every(text => text === texts[pathID][toolNames[0]])
|
|
90
|
+
) {
|
|
91
|
+
// Consolidate the texts to 1 unanimous text.
|
|
92
|
+
texts[pathID].unanimous = texts[pathID][toolNames[0]];
|
|
93
|
+
toolNames.forEach(toolName => {
|
|
94
|
+
if (toolName !== toolNames[0]) {
|
|
95
|
+
delete texts[pathID][toolName];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
71
102
|
}
|
|
72
103
|
}
|
|
73
104
|
};
|