@featurevisor/core 1.2.1 → 1.2.3
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/.eslintcache +1 -1
- package/CHANGELOG.md +16 -0
- package/coverage/clover.xml +2 -2
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/lib/builder/allocator.js.html +1 -1
- package/coverage/lcov-report/lib/builder/index.html +1 -1
- package/coverage/lcov-report/lib/builder/traffic.js.html +1 -1
- package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +1 -1
- package/coverage/lcov-report/lib/tester/index.html +1 -1
- package/coverage/lcov-report/lib/tester/matrix.js.html +5 -5
- package/coverage/lcov-report/src/builder/allocator.ts.html +1 -1
- package/coverage/lcov-report/src/builder/index.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +1 -1
- package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +1 -1
- package/coverage/lcov-report/src/tester/index.html +1 -1
- package/coverage/lcov-report/src/tester/matrix.ts.html +5 -5
- package/lib/tester/matrix.js +4 -4
- package/lib/tester/matrix.js.map +1 -1
- package/lib/tester/prettyDuration.d.ts +1 -0
- package/lib/tester/prettyDuration.js +31 -0
- package/lib/tester/prettyDuration.js.map +1 -0
- package/lib/tester/printTestResult.d.ts +2 -0
- package/lib/tester/printTestResult.js +41 -0
- package/lib/tester/printTestResult.js.map +1 -0
- package/lib/tester/testFeature.d.ts +2 -2
- package/lib/tester/testFeature.js +78 -31
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.js +37 -11
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +2 -2
- package/lib/tester/testSegment.js +35 -12
- package/lib/tester/testSegment.js.map +1 -1
- package/package.json +5 -5
- package/src/tester/matrix.ts +4 -4
- package/src/tester/prettyDuration.ts +34 -0
- package/src/tester/printTestResult.ts +53 -0
- package/src/tester/testFeature.ts +87 -48
- package/src/tester/testProject.ts +44 -12
- package/src/tester/testSegment.ts +48 -20
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2024-01-
|
|
119
|
+
at 2024-01-18T17:12:05.406Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -417,7 +417,7 @@ exports.applyCombinationToFeatureAssertion = applyCombinationToFeatureAssertion;
|
|
|
417
417
|
function <span class="fstat-no" title="function not covered" >getFeatureAssertionsFromMatrix(</span>aIndex, assertionWithMatrix) {
|
|
418
418
|
<span class="cstat-no" title="statement not covered" > if (!assertionWithMatrix.matrix) {</span>
|
|
419
419
|
var assertion = <span class="cstat-no" title="statement not covered" >__assign({}, assertionWithMatrix);</span>
|
|
420
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = "
|
|
420
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = "Assertion #".concat(aIndex + 1, ": (").concat(assertion.environment, ") ").concat(assertion.description || "at ".concat(assertion.at, "%"));</span>
|
|
421
421
|
<span class="cstat-no" title="statement not covered" > return [assertion];</span>
|
|
422
422
|
}
|
|
423
423
|
var assertions = <span class="cstat-no" title="statement not covered" >[];</span>
|
|
@@ -425,7 +425,7 @@ function <span class="fstat-no" title="function not covered" >getFeatureAssertio
|
|
|
425
425
|
<span class="cstat-no" title="statement not covered" > for (var cIndex = <span class="cstat-no" title="statement not covered" >0;</span> cIndex < combinations.length; cIndex++) {</span>
|
|
426
426
|
var combination = <span class="cstat-no" title="statement not covered" >combinations[cIndex];</span>
|
|
427
427
|
var assertion = <span class="cstat-no" title="statement not covered" >applyCombinationToFeatureAssertion(combination, assertionWithMatrix);</span>
|
|
428
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = "
|
|
428
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = "Assertion #".concat(aIndex + 1, ": (").concat(assertion.environment, ") ").concat(assertion.description || "at ".concat(assertion.at, "%"));</span>
|
|
429
429
|
<span class="cstat-no" title="statement not covered" > assertions.push(assertion);</span>
|
|
430
430
|
}
|
|
431
431
|
<span class="cstat-no" title="statement not covered" > return assertions;</span>
|
|
@@ -451,7 +451,7 @@ exports.applyCombinationToSegmentAssertion = applyCombinationToSegmentAssertion;
|
|
|
451
451
|
function <span class="fstat-no" title="function not covered" >getSegmentAssertionsFromMatrix(</span>aIndex, assertionWithMatrix) {
|
|
452
452
|
<span class="cstat-no" title="statement not covered" > if (!assertionWithMatrix.matrix) {</span>
|
|
453
453
|
var assertion = <span class="cstat-no" title="statement not covered" >__assign({}, assertionWithMatrix);</span>
|
|
454
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = "
|
|
454
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = "Assertion #".concat(aIndex + 1, ": ").concat(assertion.description || "#".concat(aIndex + 1));</span>
|
|
455
455
|
<span class="cstat-no" title="statement not covered" > return [assertion];</span>
|
|
456
456
|
}
|
|
457
457
|
var assertions = <span class="cstat-no" title="statement not covered" >[];</span>
|
|
@@ -459,7 +459,7 @@ function <span class="fstat-no" title="function not covered" >getSegmentAssertio
|
|
|
459
459
|
<span class="cstat-no" title="statement not covered" > for (var cIndex = <span class="cstat-no" title="statement not covered" >0;</span> cIndex < combinations.length; cIndex++) {</span>
|
|
460
460
|
var combination = <span class="cstat-no" title="statement not covered" >combinations[cIndex];</span>
|
|
461
461
|
var assertion = <span class="cstat-no" title="statement not covered" >applyCombinationToSegmentAssertion(combination, assertionWithMatrix);</span>
|
|
462
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = "
|
|
462
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = "Assertion #".concat(aIndex + 1, ": ").concat(assertion.description || "#".concat(aIndex + 1));</span>
|
|
463
463
|
<span class="cstat-no" title="statement not covered" > assertions.push(assertion);</span>
|
|
464
464
|
}
|
|
465
465
|
<span class="cstat-no" title="statement not covered" > return assertions;</span>
|
|
@@ -472,7 +472,7 @@ exports.getSegmentAssertionsFromMatrix = getSegmentAssertionsFromMatrix;
|
|
|
472
472
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
473
473
|
Code coverage generated by
|
|
474
474
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
475
|
-
at 2024-01-
|
|
475
|
+
at 2024-01-18T17:12:05.406Z
|
|
476
476
|
</div>
|
|
477
477
|
<script src="../../prettify.js"></script>
|
|
478
478
|
<script>
|
|
@@ -193,7 +193,7 @@ export function getUpdatedAvailableRangesAfterFilling(
|
|
|
193
193
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
194
194
|
Code coverage generated by
|
|
195
195
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
196
|
-
at 2024-01-
|
|
196
|
+
at 2024-01-18T17:12:05.406Z
|
|
197
197
|
</div>
|
|
198
198
|
<script src="../../prettify.js"></script>
|
|
199
199
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2024-01-
|
|
119
|
+
at 2024-01-18T17:12:05.406Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -574,7 +574,7 @@ export function getTraffic(
|
|
|
574
574
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
575
575
|
Code coverage generated by
|
|
576
576
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
577
|
-
at 2024-01-
|
|
577
|
+
at 2024-01-18T17:12:05.406Z
|
|
578
578
|
</div>
|
|
579
579
|
<script src="../../prettify.js"></script>
|
|
580
580
|
<script>
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
143
143
|
Code coverage generated by
|
|
144
144
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
145
|
-
at 2024-01-
|
|
145
|
+
at 2024-01-18T17:12:05.406Z
|
|
146
146
|
</div>
|
|
147
147
|
<script src="../../prettify.js"></script>
|
|
148
148
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2024-01-
|
|
119
|
+
at 2024-01-18T17:12:05.406Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -540,7 +540,7 @@ export function <span class="fstat-no" title="function not covered" >getFeatureA
|
|
|
540
540
|
): FeatureAssertion[] {
|
|
541
541
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!assertionWithMatrix.matrix) {</span>
|
|
542
542
|
const assertion<span class="cstat-no" title="statement not covered" > = { ...assertionWithMatrix };</span>
|
|
543
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = `
|
|
543
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = `Assertion #${aIndex + 1}: (${assertion.environment}) ${</span>
|
|
544
544
|
assertion.description || `at ${assertion.at}%`
|
|
545
545
|
}`;
|
|
546
546
|
|
|
@@ -553,7 +553,7 @@ export function <span class="fstat-no" title="function not covered" >getFeatureA
|
|
|
553
553
|
<span class="cstat-no" title="statement not covered" > for (let cIndex = <span class="cstat-no" title="statement not covered" >0;</span> cIndex < combinations.length; cIndex++) {</span>
|
|
554
554
|
const combination = <span class="cstat-no" title="statement not covered" >combinations[cIndex];</span>
|
|
555
555
|
const assertion = <span class="cstat-no" title="statement not covered" >applyCombinationToFeatureAssertion(combination, assertionWithMatrix);</span>
|
|
556
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = `
|
|
556
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = `Assertion #${aIndex + 1}: (${assertion.environment}) ${</span>
|
|
557
557
|
assertion.description || `at ${assertion.at}%`
|
|
558
558
|
}`;
|
|
559
559
|
|
|
@@ -596,7 +596,7 @@ export function <span class="fstat-no" title="function not covered" >getSegmentA
|
|
|
596
596
|
): SegmentAssertion[] {
|
|
597
597
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!assertionWithMatrix.matrix) {</span>
|
|
598
598
|
const assertion<span class="cstat-no" title="statement not covered" > = { ...assertionWithMatrix };</span>
|
|
599
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = `
|
|
599
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = `Assertion #${aIndex + 1}: ${</span>
|
|
600
600
|
assertion.description || `#${aIndex + 1}`
|
|
601
601
|
}`;
|
|
602
602
|
|
|
@@ -609,7 +609,7 @@ export function <span class="fstat-no" title="function not covered" >getSegmentA
|
|
|
609
609
|
<span class="cstat-no" title="statement not covered" > for (let cIndex = <span class="cstat-no" title="statement not covered" >0;</span> cIndex < combinations.length; cIndex++) {</span>
|
|
610
610
|
const combination = <span class="cstat-no" title="statement not covered" >combinations[cIndex];</span>
|
|
611
611
|
const assertion = <span class="cstat-no" title="statement not covered" >applyCombinationToSegmentAssertion(combination, assertionWithMatrix);</span>
|
|
612
|
-
<span class="cstat-no" title="statement not covered" > assertion.description = `
|
|
612
|
+
<span class="cstat-no" title="statement not covered" > assertion.description = `Assertion #${aIndex + 1}: ${</span>
|
|
613
613
|
assertion.description || `#${aIndex + 1}`
|
|
614
614
|
}`;
|
|
615
615
|
|
|
@@ -625,7 +625,7 @@ export function <span class="fstat-no" title="function not covered" >getSegmentA
|
|
|
625
625
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
626
626
|
Code coverage generated by
|
|
627
627
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
628
|
-
at 2024-01-
|
|
628
|
+
at 2024-01-18T17:12:05.406Z
|
|
629
629
|
</div>
|
|
630
630
|
<script src="../../prettify.js"></script>
|
|
631
631
|
<script>
|
package/lib/tester/matrix.js
CHANGED
|
@@ -84,7 +84,7 @@ exports.applyCombinationToFeatureAssertion = applyCombinationToFeatureAssertion;
|
|
|
84
84
|
function getFeatureAssertionsFromMatrix(aIndex, assertionWithMatrix) {
|
|
85
85
|
if (!assertionWithMatrix.matrix) {
|
|
86
86
|
var assertion = __assign({}, assertionWithMatrix);
|
|
87
|
-
assertion.description = "
|
|
87
|
+
assertion.description = "Assertion #".concat(aIndex + 1, ": (").concat(assertion.environment, ") ").concat(assertion.description || "at ".concat(assertion.at, "%"));
|
|
88
88
|
return [assertion];
|
|
89
89
|
}
|
|
90
90
|
var assertions = [];
|
|
@@ -92,7 +92,7 @@ function getFeatureAssertionsFromMatrix(aIndex, assertionWithMatrix) {
|
|
|
92
92
|
for (var cIndex = 0; cIndex < combinations.length; cIndex++) {
|
|
93
93
|
var combination = combinations[cIndex];
|
|
94
94
|
var assertion = applyCombinationToFeatureAssertion(combination, assertionWithMatrix);
|
|
95
|
-
assertion.description = "
|
|
95
|
+
assertion.description = "Assertion #".concat(aIndex + 1, ": (").concat(assertion.environment, ") ").concat(assertion.description || "at ".concat(assertion.at, "%"));
|
|
96
96
|
assertions.push(assertion);
|
|
97
97
|
}
|
|
98
98
|
return assertions;
|
|
@@ -118,7 +118,7 @@ exports.applyCombinationToSegmentAssertion = applyCombinationToSegmentAssertion;
|
|
|
118
118
|
function getSegmentAssertionsFromMatrix(aIndex, assertionWithMatrix) {
|
|
119
119
|
if (!assertionWithMatrix.matrix) {
|
|
120
120
|
var assertion = __assign({}, assertionWithMatrix);
|
|
121
|
-
assertion.description = "
|
|
121
|
+
assertion.description = "Assertion #".concat(aIndex + 1, ": ").concat(assertion.description || "#".concat(aIndex + 1));
|
|
122
122
|
return [assertion];
|
|
123
123
|
}
|
|
124
124
|
var assertions = [];
|
|
@@ -126,7 +126,7 @@ function getSegmentAssertionsFromMatrix(aIndex, assertionWithMatrix) {
|
|
|
126
126
|
for (var cIndex = 0; cIndex < combinations.length; cIndex++) {
|
|
127
127
|
var combination = combinations[cIndex];
|
|
128
128
|
var assertion = applyCombinationToSegmentAssertion(combination, assertionWithMatrix);
|
|
129
|
-
assertion.description = "
|
|
129
|
+
assertion.description = "Assertion #".concat(aIndex + 1, ": ").concat(assertion.description || "#".concat(aIndex + 1));
|
|
130
130
|
assertions.push(assertion);
|
|
131
131
|
}
|
|
132
132
|
return assertions;
|
package/lib/tester/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/tester/matrix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,oBAAoB,CAC3B,IAAc,EACd,MAAuB,EACvB,GAAW,EACX,IAAS,EACT,YAAmB;;IAEnB,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,IAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAM,WAAW,yBAAQ,IAAI,gBAAG,GAAG,IAAG,MAAM,CAAC,CAAC,CAAC,MAAE,CAAC;QAElD,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAChC;aAAM;YACL,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;SACxE;KACF;AACH,CAAC;AAED,SAAgB,qBAAq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AC,EAAE,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QAC3D,IAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACzC,IAAM,SAAS,GAAG,kCAAkC,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACvF,SAAS,CAAC,WAAW,GAAG,qBAAc,MAAM,GAAG,CAAC,eAC9C,SAAS,CAAC,WAAW,IAAI,WAAI,MAAM,GAAG,CAAC,CAAE,CACzC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC5B;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA3BD,wEA2BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prettyDuration(diffInMs: any): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prettyDuration = void 0;
|
|
4
|
+
function prettyDuration(diffInMs) {
|
|
5
|
+
var diff = Math.abs(diffInMs);
|
|
6
|
+
if (diff === 0) {
|
|
7
|
+
return "0ms";
|
|
8
|
+
}
|
|
9
|
+
var ms = diff % 1000;
|
|
10
|
+
diff = (diff - ms) / 1000;
|
|
11
|
+
var secs = diff % 60;
|
|
12
|
+
diff = (diff - secs) / 60;
|
|
13
|
+
var mins = diff % 60;
|
|
14
|
+
var hrs = (diff - mins) / 60;
|
|
15
|
+
var result = "";
|
|
16
|
+
if (hrs) {
|
|
17
|
+
result += " ".concat(hrs, "h");
|
|
18
|
+
}
|
|
19
|
+
if (mins) {
|
|
20
|
+
result += " ".concat(mins, "m");
|
|
21
|
+
}
|
|
22
|
+
if (secs) {
|
|
23
|
+
result += " ".concat(secs, "s");
|
|
24
|
+
}
|
|
25
|
+
if (ms) {
|
|
26
|
+
result += " ".concat(ms, "ms");
|
|
27
|
+
}
|
|
28
|
+
return result.trim();
|
|
29
|
+
}
|
|
30
|
+
exports.prettyDuration = prettyDuration;
|
|
31
|
+
//# sourceMappingURL=prettyDuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettyDuration.js","sourceRoot":"","sources":["../../src/tester/prettyDuration.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAAC,QAAQ;IACrC,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE9B,IAAI,IAAI,KAAK,CAAC,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,IAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACvB,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1B,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1B,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,IAAM,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,IAAI,GAAG,EAAE;QACP,MAAM,IAAI,WAAI,GAAG,MAAG,CAAC;KACtB;IAED,IAAI,IAAI,EAAE;QACR,MAAM,IAAI,WAAI,IAAI,MAAG,CAAC;KACvB;IAED,IAAI,IAAI,EAAE;QACR,MAAM,IAAI,WAAI,IAAI,MAAG,CAAC;KACvB;IAED,IAAI,EAAE,EAAE;QACN,MAAM,IAAI,WAAI,EAAE,OAAI,CAAC;KACtB;IAED,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAjCD,wCAiCC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printTestResult = void 0;
|
|
4
|
+
var cliFormat_1 = require("./cliFormat");
|
|
5
|
+
var prettyDuration_1 = require("./prettyDuration");
|
|
6
|
+
function printTestResult(testResult, testFilePath, rootDirectoryPath) {
|
|
7
|
+
console.log("");
|
|
8
|
+
var title = "Testing: ".concat(testFilePath.replace(rootDirectoryPath, ""), " (").concat((0, prettyDuration_1.prettyDuration)(testResult.duration), ")");
|
|
9
|
+
console.log(title);
|
|
10
|
+
if (testResult.notFound) {
|
|
11
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => ".concat(testResult.type, " ").concat(testResult.key, " not found"));
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
console.log(cliFormat_1.CLI_FORMAT_BOLD, " ".concat(testResult.type, " \"").concat(testResult.key, "\":"));
|
|
15
|
+
testResult.assertions.forEach(function (assertion) {
|
|
16
|
+
var _a;
|
|
17
|
+
if (assertion.passed) {
|
|
18
|
+
console.log(" \u2714 ".concat(assertion.description, " (").concat((0, prettyDuration_1.prettyDuration)(assertion.duration), ")"));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " \u2718 ".concat(assertion.description, " (").concat((0, prettyDuration_1.prettyDuration)(assertion.duration), ")"));
|
|
22
|
+
(_a = assertion.errors) === null || _a === void 0 ? void 0 : _a.forEach(function (error) {
|
|
23
|
+
if (error.message) {
|
|
24
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => ".concat(error.message));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (error.type === "variable") {
|
|
28
|
+
var variableKey = error.details.variableKey;
|
|
29
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => variable key: ".concat(variableKey));
|
|
30
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => expected: ".concat(error.expected));
|
|
31
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => received: ".concat(error.actual));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(cliFormat_1.CLI_FORMAT_RED, " => ".concat(error.type, ": expected \"").concat(error.expected, "\", received \"").concat(error.actual, "\""));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.printTestResult = printTestResult;
|
|
41
|
+
//# sourceMappingURL=printTestResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printTestResult.js","sourceRoot":"","sources":["../../src/tester/printTestResult.ts"],"names":[],"mappings":";;;AAEA,yCAA8D;AAC9D,mDAAkD;AAElD,SAAgB,eAAe,CAAC,UAAsB,EAAE,YAAY,EAAE,iBAAiB;IACrF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,IAAM,KAAK,GAAG,mBAAY,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,eAAK,IAAA,+BAAc,EACtF,UAAU,CAAC,QAAQ,CACpB,MAAG,CAAC;IACL,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAEnB,IAAI,UAAU,CAAC,QAAQ,EAAE;QACvB,OAAO,CAAC,GAAG,CAAC,0BAAc,EAAE,eAAQ,UAAU,CAAC,IAAI,cAAI,UAAU,CAAC,GAAG,eAAY,CAAC,CAAC;QAEnF,OAAO;KACR;IAED,OAAO,CAAC,GAAG,CAAC,2BAAe,EAAE,YAAK,UAAU,CAAC,IAAI,gBAAK,UAAU,CAAC,GAAG,QAAI,CAAC,CAAC;IAE1E,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,SAAS;;QAC/C,IAAI,SAAS,CAAC,MAAM,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,mBAAO,SAAS,CAAC,WAAW,eAAK,IAAA,+BAAc,EAAC,SAAS,CAAC,QAAQ,CAAC,MAAG,CAAC,CAAC;SACrF;aAAM;YACL,OAAO,CAAC,GAAG,CACT,0BAAc,EACd,mBAAO,SAAS,CAAC,WAAW,eAAK,IAAA,+BAAc,EAAC,SAAS,CAAC,QAAQ,CAAC,MAAG,CACvE,CAAC;YAEF,MAAA,SAAS,CAAC,MAAM,0CAAE,OAAO,CAAC,UAAU,KAAK;gBACvC,IAAI,KAAK,CAAC,OAAO,EAAE;oBACjB,OAAO,CAAC,GAAG,CAAC,0BAAc,EAAE,iBAAU,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC;oBAEvD,OAAO;iBACR;gBAED,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;oBAC7B,IAAM,WAAW,GAAI,KAAK,CAAC,OAAe,CAAC,WAAW,CAAC;oBAEvD,OAAO,CAAC,GAAG,CAAC,0BAAc,EAAE,+BAAwB,WAAW,CAAE,CAAC,CAAC;oBACnE,OAAO,CAAC,GAAG,CAAC,0BAAc,EAAE,8BAAuB,KAAK,CAAC,QAAQ,CAAE,CAAC,CAAC;oBACrE,OAAO,CAAC,GAAG,CAAC,0BAAc,EAAE,8BAAuB,KAAK,CAAC,MAAM,CAAE,CAAC,CAAC;iBACpE;qBAAM;oBACL,OAAO,CAAC,GAAG,CACT,0BAAc,EACd,iBAAU,KAAK,CAAC,IAAI,0BAAe,KAAK,CAAC,QAAQ,4BAAgB,KAAK,CAAC,MAAM,OAAG,CACjF,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA/CD,0CA+CC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TestFeature } from "@featurevisor/types";
|
|
1
|
+
import { TestFeature, TestResult } from "@featurevisor/types";
|
|
2
2
|
import { Datasource } from "../datasource";
|
|
3
3
|
import { ProjectConfig } from "../config";
|
|
4
4
|
export declare function testFeature(datasource: Datasource, projectConfig: ProjectConfig, test: TestFeature, options: {
|
|
5
5
|
verbose?: boolean;
|
|
6
6
|
showDatafile?: boolean;
|
|
7
|
-
}, patterns: any): Promise<
|
|
7
|
+
}, patterns: any): Promise<TestResult>;
|
|
@@ -42,33 +42,46 @@ var builder_1 = require("../builder");
|
|
|
42
42
|
var config_1 = require("../config");
|
|
43
43
|
var checkIfArraysAreEqual_1 = require("./checkIfArraysAreEqual");
|
|
44
44
|
var checkIfObjectsAreEqual_1 = require("./checkIfObjectsAreEqual");
|
|
45
|
-
var cliFormat_1 = require("./cliFormat");
|
|
46
45
|
var matrix_1 = require("./matrix");
|
|
47
46
|
function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
48
47
|
if (options === void 0) { options = {}; }
|
|
49
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
var
|
|
49
|
+
var testStartTime, featureKey, testResult, aIndex, assertions, _loop_1, bIndex, state_1;
|
|
51
50
|
return __generator(this, function (_a) {
|
|
52
51
|
switch (_a.label) {
|
|
53
52
|
case 0:
|
|
54
|
-
|
|
53
|
+
testStartTime = Date.now();
|
|
55
54
|
featureKey = test.feature;
|
|
56
|
-
|
|
55
|
+
testResult = {
|
|
56
|
+
type: "feature",
|
|
57
|
+
key: featureKey,
|
|
58
|
+
// to be updated later
|
|
59
|
+
notFound: false,
|
|
60
|
+
duration: 0,
|
|
61
|
+
passed: true,
|
|
62
|
+
assertions: [],
|
|
63
|
+
};
|
|
57
64
|
aIndex = 0;
|
|
58
65
|
_a.label = 1;
|
|
59
66
|
case 1:
|
|
60
67
|
if (!(aIndex < test.assertions.length)) return [3 /*break*/, 6];
|
|
61
68
|
assertions = (0, matrix_1.getFeatureAssertionsFromMatrix)(aIndex, test.assertions[aIndex]);
|
|
62
69
|
_loop_1 = function (bIndex) {
|
|
63
|
-
var assertion, requiredChain, featuresToInclude, existingState, datafileContent, sdk, isEnabled, variation
|
|
70
|
+
var assertionStartTime, assertion, testResultAssertion, requiredChain, featuresToInclude, existingState, datafileContent, sdk, feature, isEnabled, variation;
|
|
64
71
|
return __generator(this, function (_b) {
|
|
65
72
|
switch (_b.label) {
|
|
66
73
|
case 0:
|
|
74
|
+
assertionStartTime = Date.now();
|
|
67
75
|
assertion = assertions[bIndex];
|
|
76
|
+
testResultAssertion = {
|
|
77
|
+
description: assertion.description,
|
|
78
|
+
duration: 0,
|
|
79
|
+
passed: true,
|
|
80
|
+
errors: [],
|
|
81
|
+
};
|
|
68
82
|
if (patterns.assertionPattern && !patterns.assertionPattern.test(assertion.description)) {
|
|
69
83
|
return [2 /*return*/, "continue"];
|
|
70
84
|
}
|
|
71
|
-
console.log(assertion.description);
|
|
72
85
|
return [4 /*yield*/, datasource.getRequiredFeaturesChain(test.feature)];
|
|
73
86
|
case 1:
|
|
74
87
|
requiredChain = _b.sent();
|
|
@@ -98,30 +111,41 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
98
111
|
if (options.verbose) {
|
|
99
112
|
sdk.setLogLevels(["debug", "info", "warn", "error"]);
|
|
100
113
|
}
|
|
114
|
+
return [4 /*yield*/, datasource.readFeature(featureKey)];
|
|
115
|
+
case 4:
|
|
116
|
+
feature = _b.sent();
|
|
117
|
+
if (!feature) {
|
|
118
|
+
testResult.notFound = true;
|
|
119
|
+
testResult.passed = false;
|
|
120
|
+
return [2 /*return*/, { value: testResult }];
|
|
121
|
+
}
|
|
101
122
|
// isEnabled
|
|
102
123
|
if ("expectedToBeEnabled" in assertion) {
|
|
103
124
|
isEnabled = sdk.isEnabled(featureKey, assertion.context);
|
|
104
125
|
if (isEnabled !== assertion.expectedToBeEnabled) {
|
|
105
|
-
|
|
106
|
-
|
|
126
|
+
testResult.passed = false;
|
|
127
|
+
testResultAssertion.passed = false;
|
|
128
|
+
testResultAssertion.errors.push({
|
|
129
|
+
type: "flag",
|
|
130
|
+
expected: assertion.expectedToBeEnabled,
|
|
131
|
+
actual: isEnabled,
|
|
132
|
+
});
|
|
107
133
|
}
|
|
108
134
|
}
|
|
109
135
|
// variation
|
|
110
136
|
if ("expectedVariation" in assertion) {
|
|
111
137
|
variation = sdk.getVariation(featureKey, assertion.context);
|
|
112
138
|
if (variation !== assertion.expectedVariation) {
|
|
113
|
-
|
|
114
|
-
|
|
139
|
+
testResult.passed = false;
|
|
140
|
+
testResultAssertion.passed = false;
|
|
141
|
+
testResultAssertion.errors.push({
|
|
142
|
+
type: "variation",
|
|
143
|
+
expected: assertion.expectedVariation,
|
|
144
|
+
actual: variation,
|
|
145
|
+
});
|
|
115
146
|
}
|
|
116
147
|
}
|
|
117
|
-
|
|
118
|
-
case 4:
|
|
119
|
-
feature = _b.sent();
|
|
120
|
-
if (!feature) {
|
|
121
|
-
hasError = true;
|
|
122
|
-
console.error(cliFormat_1.CLI_FORMAT_RED, " Feature \"".concat(featureKey, "\" failed: feature not found"));
|
|
123
|
-
return [2 /*return*/, "continue"];
|
|
124
|
-
}
|
|
148
|
+
// variables
|
|
125
149
|
if (typeof assertion.expectedVariables === "object") {
|
|
126
150
|
Object.keys(assertion.expectedVariables).forEach(function (variableKey) {
|
|
127
151
|
var _a;
|
|
@@ -130,8 +154,14 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
130
154
|
var passed;
|
|
131
155
|
var variableSchema = (_a = feature.variablesSchema) === null || _a === void 0 ? void 0 : _a.find(function (v) { return v.key === variableKey; });
|
|
132
156
|
if (!variableSchema) {
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
testResult.passed = false;
|
|
158
|
+
testResultAssertion.passed = false;
|
|
159
|
+
testResultAssertion.errors.push({
|
|
160
|
+
type: "variable",
|
|
161
|
+
expected: assertion.expectedVariation,
|
|
162
|
+
actual: undefined,
|
|
163
|
+
message: "schema for variable \"".concat(variableKey, "\" not found in feature"),
|
|
164
|
+
});
|
|
135
165
|
return;
|
|
136
166
|
}
|
|
137
167
|
if (variableSchema.type === "json") {
|
|
@@ -149,9 +179,16 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
149
179
|
passed = JSON.stringify(parsedExpectedValue) === JSON.stringify(actualValue);
|
|
150
180
|
}
|
|
151
181
|
if (!passed) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
testResult.passed = false;
|
|
183
|
+
testResultAssertion.passed = false;
|
|
184
|
+
testResultAssertion.errors.push({
|
|
185
|
+
type: "variable",
|
|
186
|
+
expected: typeof expectedValue !== "string" ? JSON.stringify(expectedValue) : expectedValue,
|
|
187
|
+
actual: typeof actualValue !== "string" ? JSON.stringify(actualValue) : actualValue,
|
|
188
|
+
details: {
|
|
189
|
+
variableKey: variableKey,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
155
192
|
}
|
|
156
193
|
}
|
|
157
194
|
else {
|
|
@@ -166,16 +203,22 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
166
203
|
passed = expectedValue === actualValue;
|
|
167
204
|
}
|
|
168
205
|
if (!passed) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
206
|
+
testResult.passed = false;
|
|
207
|
+
testResultAssertion.passed = false;
|
|
208
|
+
testResultAssertion.errors.push({
|
|
209
|
+
type: "variable",
|
|
210
|
+
expected: expectedValue,
|
|
211
|
+
actual: actualValue,
|
|
212
|
+
details: {
|
|
213
|
+
variableKey: variableKey,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
172
216
|
}
|
|
173
217
|
}
|
|
174
|
-
if (!passed) {
|
|
175
|
-
hasError = true;
|
|
176
|
-
}
|
|
177
218
|
});
|
|
178
219
|
}
|
|
220
|
+
testResultAssertion.duration = Date.now() - assertionStartTime;
|
|
221
|
+
testResult.assertions.push(testResultAssertion);
|
|
179
222
|
return [2 /*return*/];
|
|
180
223
|
}
|
|
181
224
|
});
|
|
@@ -186,7 +229,9 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
186
229
|
if (!(bIndex < assertions.length)) return [3 /*break*/, 5];
|
|
187
230
|
return [5 /*yield**/, _loop_1(bIndex)];
|
|
188
231
|
case 3:
|
|
189
|
-
_a.sent();
|
|
232
|
+
state_1 = _a.sent();
|
|
233
|
+
if (typeof state_1 === "object")
|
|
234
|
+
return [2 /*return*/, state_1.value];
|
|
190
235
|
_a.label = 4;
|
|
191
236
|
case 4:
|
|
192
237
|
bIndex++;
|
|
@@ -194,7 +239,9 @@ function testFeature(datasource, projectConfig, test, options, patterns) {
|
|
|
194
239
|
case 5:
|
|
195
240
|
aIndex++;
|
|
196
241
|
return [3 /*break*/, 1];
|
|
197
|
-
case 6:
|
|
242
|
+
case 6:
|
|
243
|
+
testResult.duration = Date.now() - testStartTime;
|
|
244
|
+
return [2 /*return*/, testResult];
|
|
198
245
|
}
|
|
199
246
|
});
|
|
200
247
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFeature.js","sourceRoot":"","sources":["../../src/tester/testFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"testFeature.js","sourceRoot":"","sources":["../../src/tester/testFeature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,yCAAwE;AAIxE,sCAA2C;AAC3C,oCAA2C;AAE3C,iEAAgE;AAChE,mEAAkE;AAClE,mCAA0D;AAE1D,SAAsB,WAAW,CAC/B,UAAsB,EACtB,aAA4B,EAC5B,IAAiB,EACjB,OAA2D,EAC3D,QAAQ;IADR,wBAAA,EAAA,YAA2D;;;;;;oBAGrD,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;oBAC3B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;oBAE1B,UAAU,GAAe;wBAC7B,IAAI,EAAE,SAAS;wBACf,GAAG,EAAE,UAAU;wBAEf,sBAAsB;wBACtB,QAAQ,EAAE,KAAK;wBACf,QAAQ,EAAE,CAAC;wBACX,MAAM,EAAE,IAAI;wBACZ,UAAU,EAAE,EAAE;qBACf,CAAC;oBAEO,MAAM,GAAG,CAAC;;;yBAAE,CAAA,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAA;oBAC5C,UAAU,GAAG,IAAA,uCAA8B,EAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAA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