@featurevisor/core 1.35.3 → 2.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/README.md +0 -6
- package/coverage/clover.xml +321 -237
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/index.html +77 -47
- package/coverage/lcov-report/lib/builder/allocator.js.html +14 -14
- package/coverage/lcov-report/lib/builder/index.html +16 -16
- package/coverage/lcov-report/lib/builder/revision.js.html +3 -3
- package/coverage/lcov-report/lib/builder/traffic.js.html +88 -64
- package/coverage/lcov-report/lib/list/index.html +116 -0
- package/coverage/lcov-report/lib/{tester → list}/matrix.js.html +90 -66
- package/coverage/lcov-report/lib/tester/helpers.js.html +295 -0
- package/coverage/lcov-report/lib/tester/index.html +20 -35
- package/coverage/lcov-report/src/builder/allocator.ts.html +2 -2
- package/coverage/lcov-report/src/builder/index.html +15 -15
- package/coverage/lcov-report/src/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +96 -24
- package/coverage/lcov-report/src/list/index.html +116 -0
- package/coverage/lcov-report/src/{tester → list}/matrix.ts.html +87 -21
- package/coverage/lcov-report/src/tester/helpers.ts.html +313 -0
- package/coverage/lcov-report/src/tester/index.html +20 -35
- package/coverage/lcov.info +592 -436
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +102 -162
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.js +87 -143
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/allocator.d.ts +1 -1
- package/lib/builder/allocator.js +12 -12
- package/lib/builder/allocator.js.map +1 -1
- package/lib/builder/allocator.spec.js +22 -22
- package/lib/builder/allocator.spec.js.map +1 -1
- package/lib/builder/buildDatafile.d.ts +4 -3
- package/lib/builder/buildDatafile.js +311 -388
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +2 -1
- package/lib/builder/buildProject.js +96 -183
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/convertToV1.d.ts +10 -0
- package/lib/builder/convertToV1.js +119 -0
- package/lib/builder/convertToV1.js.map +1 -0
- package/lib/builder/getFeatureRanges.d.ts +1 -1
- package/lib/builder/getFeatureRanges.js +32 -105
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.d.ts +4 -0
- package/lib/builder/hashes.js +70 -0
- package/lib/builder/hashes.js.map +1 -0
- package/lib/builder/revision.js +2 -2
- package/lib/builder/revision.js.map +1 -1
- package/lib/builder/revision.spec.js +1 -1
- package/lib/builder/revision.spec.js.map +1 -1
- package/lib/builder/traffic.d.ts +1 -1
- package/lib/builder/traffic.js +57 -49
- package/lib/builder/traffic.js.map +1 -1
- package/lib/builder/traffic.spec.js +14 -14
- package/lib/builder/traffic.spec.js.map +1 -1
- package/lib/cli/cli.js +60 -129
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +14 -16
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/parsers.js +1 -1
- package/lib/config/parsers.js.map +1 -1
- package/lib/config/projectConfig.d.ts +8 -6
- package/lib/config/projectConfig.js +31 -72
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +1 -1
- package/lib/datasource/adapter.js +2 -5
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +2 -1
- package/lib/datasource/datasource.js +107 -148
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +1 -1
- package/lib/datasource/filesystemAdapter.js +224 -360
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -1
- package/lib/evaluate/index.js +120 -188
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.d.ts +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +40 -128
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +27 -82
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.d.ts +7 -5
- package/lib/find-usage/index.js +333 -507
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.js +36 -91
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.js +117 -157
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +45 -133
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +1 -1
- package/lib/init/index.js +16 -64
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +21 -6
- package/lib/linter/attributeSchema.js +18 -4
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/checkCircularDependency.d.ts +1 -1
- package/lib/linter/checkCircularDependency.js +22 -80
- package/lib/linter/checkCircularDependency.js.map +1 -1
- package/lib/linter/checkPercentageExceedingSlot.d.ts +1 -1
- package/lib/linter/checkPercentageExceedingSlot.js +36 -76
- package/lib/linter/checkPercentageExceedingSlot.js.map +1 -1
- package/lib/linter/conditionSchema.d.ts +1 -1
- package/lib/linter/conditionSchema.js +89 -41
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +345 -197
- package/lib/linter/featureSchema.js +313 -172
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.js +6 -6
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.js +306 -480
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/printError.js +7 -7
- package/lib/linter/printError.js.map +1 -1
- package/lib/linter/segmentSchema.js +2 -2
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/testSchema.d.ts +155 -3
- package/lib/linter/testSchema.js +47 -17
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +349 -517
- package/lib/list/index.js.map +1 -1
- package/lib/{tester → list}/matrix.d.ts +1 -1
- package/lib/{tester → list}/matrix.js +50 -42
- package/lib/list/matrix.js.map +1 -0
- package/lib/{tester → list}/matrix.spec.js +7 -7
- package/lib/list/matrix.spec.js.map +1 -0
- package/lib/site/exportSite.js +25 -71
- package/lib/site/exportSite.js.map +1 -1
- package/lib/site/generateHistory.d.ts +1 -1
- package/lib/site/generateHistory.js +26 -82
- package/lib/site/generateHistory.js.map +1 -1
- package/lib/site/generateSiteSearchIndex.d.ts +1 -1
- package/lib/site/generateSiteSearchIndex.js +182 -259
- package/lib/site/generateSiteSearchIndex.js.map +1 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +1 -1
- package/lib/site/getLastModifiedFromHistory.js +2 -2
- package/lib/site/getLastModifiedFromHistory.js.map +1 -1
- package/lib/site/getOwnerAndRepoFromUrl.js +6 -6
- package/lib/site/getOwnerAndRepoFromUrl.js.map +1 -1
- package/lib/site/getRelativePaths.js +7 -7
- package/lib/site/getRelativePaths.js.map +1 -1
- package/lib/site/getRepoDetails.js +20 -20
- package/lib/site/getRepoDetails.js.map +1 -1
- package/lib/site/index.js +25 -73
- package/lib/site/index.js.map +1 -1
- package/lib/site/serveSite.js +10 -10
- package/lib/site/serveSite.js.map +1 -1
- package/lib/tester/helpers.d.ts +2 -0
- package/lib/tester/helpers.js +71 -0
- package/lib/tester/helpers.js.map +1 -0
- package/lib/tester/helpers.spec.js +115 -0
- package/lib/tester/helpers.spec.js.map +1 -0
- package/lib/tester/index.d.ts +0 -1
- package/lib/tester/index.js +0 -1
- package/lib/tester/index.js.map +1 -1
- package/lib/tester/prettyDuration.js +11 -11
- package/lib/tester/prettyDuration.js.map +1 -1
- package/lib/tester/printTestResult.d.ts +1 -1
- package/lib/tester/printTestResult.js +35 -15
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +4 -2
- package/lib/tester/testFeature.js +264 -226
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +3 -7
- package/lib/tester/testProject.js +145 -246
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +5 -2
- package/lib/tester/testSegment.js +65 -102
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/extractKeys.d.ts +2 -1
- package/lib/utils/extractKeys.js +57 -12
- package/lib/utils/extractKeys.js.map +1 -1
- package/lib/utils/git.d.ts +1 -1
- package/lib/utils/git.js +23 -23
- package/lib/utils/git.js.map +1 -1
- package/lib/utils/pretty.js +2 -4
- package/lib/utils/pretty.js.map +1 -1
- package/package.json +5 -6
- package/src/assess-distribution/index.ts +3 -2
- package/src/benchmark/index.ts +3 -3
- package/src/builder/allocator.spec.ts +1 -1
- package/src/builder/allocator.ts +1 -1
- package/src/builder/buildDatafile.ts +161 -124
- package/src/builder/buildProject.ts +6 -3
- package/src/builder/convertToV1.ts +166 -0
- package/src/builder/getFeatureRanges.ts +1 -1
- package/src/builder/hashes.ts +109 -0
- package/src/builder/traffic.ts +40 -16
- package/src/cli/cli.ts +1 -1
- package/src/cli/plugins.ts +0 -2
- package/src/config/projectConfig.ts +13 -10
- package/src/datasource/adapter.ts +1 -1
- package/src/datasource/datasource.ts +23 -2
- package/src/datasource/filesystemAdapter.ts +11 -12
- package/src/evaluate/index.ts +7 -6
- package/src/find-duplicate-segments/findDuplicateSegments.ts +1 -1
- package/src/find-usage/index.ts +111 -44
- package/src/generate-code/index.ts +1 -3
- package/src/generate-code/typescript.ts +7 -29
- package/src/index.ts +0 -1
- package/src/info/index.ts +2 -2
- package/src/init/index.ts +2 -2
- package/src/linter/attributeSchema.ts +18 -2
- package/src/linter/checkCircularDependency.ts +1 -1
- package/src/linter/checkPercentageExceedingSlot.ts +28 -8
- package/src/linter/conditionSchema.ts +66 -10
- package/src/linter/featureSchema.ts +312 -116
- package/src/linter/lintProject.ts +9 -4
- package/src/linter/testSchema.ts +42 -3
- package/src/list/index.ts +18 -30
- package/src/{tester → list}/matrix.ts +33 -11
- package/src/site/exportSite.ts +2 -4
- package/src/site/generateHistory.ts +1 -1
- package/src/site/generateSiteSearchIndex.ts +58 -50
- package/src/site/getLastModifiedFromHistory.ts +1 -1
- package/src/tester/helpers.spec.ts +149 -0
- package/src/tester/helpers.ts +76 -0
- package/src/tester/index.ts +0 -1
- package/src/tester/printTestResult.ts +25 -3
- package/src/tester/testFeature.ts +270 -124
- package/src/tester/testProject.ts +28 -49
- package/src/tester/testSegment.ts +48 -40
- package/src/utils/extractKeys.ts +58 -1
- package/src/utils/git.ts +1 -1
- package/tsconfig.cjs.json +1 -0
- package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +0 -151
- package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +0 -157
- package/lib/restore/index.d.ts +0 -4
- package/lib/restore/index.js +0 -91
- package/lib/restore/index.js.map +0 -1
- package/lib/tester/checkIfArraysAreEqual.d.ts +0 -1
- package/lib/tester/checkIfArraysAreEqual.js +0 -18
- package/lib/tester/checkIfArraysAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.d.ts +0 -1
- package/lib/tester/checkIfObjectsAreEqual.js +0 -23
- package/lib/tester/checkIfObjectsAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.spec.js +0 -26
- package/lib/tester/checkIfObjectsAreEqual.spec.js.map +0 -1
- package/lib/tester/matrix.js.map +0 -1
- package/lib/tester/matrix.spec.js.map +0 -1
- package/src/restore/index.ts +0 -42
- package/src/tester/checkIfArraysAreEqual.ts +0 -16
- package/src/tester/checkIfObjectsAreEqual.spec.ts +0 -31
- package/src/tester/checkIfObjectsAreEqual.ts +0 -24
- /package/lib/{tester → list}/matrix.spec.d.ts +0 -0
- /package/lib/tester/{checkIfObjectsAreEqual.spec.d.ts → helpers.spec.d.ts} +0 -0
- /package/src/{tester → list}/matrix.spec.ts +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { TestFeature, TestResult } from "@featurevisor/types";
|
|
1
|
+
import type { TestFeature, TestResult } from "@featurevisor/types";
|
|
2
2
|
import { Datasource } from "../datasource";
|
|
3
3
|
import { ProjectConfig } from "../config";
|
|
4
4
|
import type { DatafileContentByEnvironment } from "./testProject";
|
|
5
5
|
export declare function testFeature(datasource: Datasource, projectConfig: ProjectConfig, test: TestFeature, options: {
|
|
6
6
|
verbose?: boolean;
|
|
7
|
+
quiet?: boolean;
|
|
7
8
|
showDatafile?: boolean;
|
|
8
|
-
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, datafileContentByEnvironment: DatafileContentByEnvironment): Promise<TestResult>;
|
|
@@ -1,233 +1,271 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.testFeature = testFeature;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
4
|
+
const sdk_1 = require("@featurevisor/sdk");
|
|
5
|
+
const helpers_1 = require("./helpers");
|
|
6
|
+
async function testFeature(datasource, projectConfig, test, options = {}, datafileContentByEnvironment) {
|
|
7
|
+
const testStartTime = Date.now();
|
|
8
|
+
const featureKey = test.feature;
|
|
9
|
+
const testResult = {
|
|
10
|
+
type: "feature",
|
|
11
|
+
key: featureKey,
|
|
12
|
+
// to be updated later
|
|
13
|
+
notFound: false,
|
|
14
|
+
duration: 0,
|
|
15
|
+
passed: true,
|
|
16
|
+
assertions: [],
|
|
17
|
+
};
|
|
18
|
+
for (let aIndex = 0; aIndex < test.assertions.length; aIndex++) {
|
|
19
|
+
const assertionStartTime = Date.now();
|
|
20
|
+
const assertion = test.assertions[aIndex];
|
|
21
|
+
const testResultAssertion = {
|
|
22
|
+
description: assertion.description,
|
|
23
|
+
duration: 0,
|
|
24
|
+
passed: true,
|
|
25
|
+
errors: [],
|
|
26
|
+
};
|
|
27
|
+
const datafileContent = datafileContentByEnvironment.get(assertion.environment || false);
|
|
28
|
+
if (options.showDatafile) {
|
|
29
|
+
console.log("");
|
|
30
|
+
console.log(JSON.stringify(datafileContent, null, 2));
|
|
31
|
+
console.log("");
|
|
32
|
+
}
|
|
33
|
+
let logLevel = "warn";
|
|
34
|
+
if (options.verbose) {
|
|
35
|
+
logLevel = "debug";
|
|
36
|
+
}
|
|
37
|
+
else if (options.quiet) {
|
|
38
|
+
logLevel = "fatal";
|
|
39
|
+
}
|
|
40
|
+
const sdk = (0, sdk_1.createInstance)({
|
|
41
|
+
datafile: datafileContent,
|
|
42
|
+
sticky: assertion.sticky ? assertion.sticky : {},
|
|
43
|
+
hooks: [
|
|
44
|
+
{
|
|
45
|
+
name: "tester",
|
|
46
|
+
bucketValue: ({ bucketValue }) => {
|
|
47
|
+
if (typeof assertion.at !== "undefined") {
|
|
48
|
+
return assertion.at * (sdk_1.MAX_BUCKETED_NUMBER / 100);
|
|
49
|
+
}
|
|
50
|
+
return bucketValue;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
logLevel,
|
|
55
|
+
});
|
|
56
|
+
const feature = await datasource.readFeature(featureKey);
|
|
57
|
+
if (!feature) {
|
|
58
|
+
testResult.notFound = true;
|
|
59
|
+
testResult.passed = false;
|
|
60
|
+
return testResult;
|
|
61
|
+
}
|
|
62
|
+
if (assertion.context) {
|
|
63
|
+
sdk.setContext(assertion.context);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* expectedToBeEnabled
|
|
67
|
+
*/
|
|
68
|
+
function testExpectedToBeEnabled(sdk, assertion, details = {}) {
|
|
69
|
+
const isEnabled = sdk.isEnabled(featureKey, assertion.context || {});
|
|
70
|
+
if (isEnabled !== assertion.expectedToBeEnabled) {
|
|
71
|
+
testResult.passed = false;
|
|
72
|
+
testResultAssertion.passed = false;
|
|
73
|
+
testResultAssertion.errors.push({
|
|
74
|
+
type: "flag",
|
|
75
|
+
expected: assertion.expectedToBeEnabled,
|
|
76
|
+
actual: isEnabled,
|
|
77
|
+
details,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if ("expectedToBeEnabled" in assertion) {
|
|
82
|
+
testExpectedToBeEnabled(sdk, assertion);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* expectedVariation
|
|
86
|
+
*/
|
|
87
|
+
function testExpectedVariation(sdk, assertion, details = {}) {
|
|
88
|
+
const overrideOptions = {};
|
|
89
|
+
if (assertion.defaultVariationValue) {
|
|
90
|
+
overrideOptions.defaultVariationValue = assertion.defaultVariationValue;
|
|
91
|
+
}
|
|
92
|
+
const variation = sdk.getVariation(featureKey, assertion.context || {}, overrideOptions);
|
|
93
|
+
if (variation !== assertion.expectedVariation) {
|
|
94
|
+
testResult.passed = false;
|
|
95
|
+
testResultAssertion.passed = false;
|
|
96
|
+
testResultAssertion.errors.push({
|
|
97
|
+
type: "variation",
|
|
98
|
+
expected: assertion.expectedVariation,
|
|
99
|
+
actual: variation,
|
|
100
|
+
details,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if ("expectedVariation" in assertion) {
|
|
105
|
+
testExpectedVariation(sdk, assertion);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* expectedVariables
|
|
109
|
+
*/
|
|
110
|
+
function testExpectedVariables(sdk, assertion, details = {}) {
|
|
111
|
+
Object.keys(assertion.expectedVariables).forEach(function (variableKey) {
|
|
112
|
+
const expectedValue = assertion.expectedVariables && assertion.expectedVariables[variableKey];
|
|
113
|
+
const overrideOptions = {};
|
|
114
|
+
if (assertion.defaultVariableValues && assertion.defaultVariableValues[variableKey]) {
|
|
115
|
+
overrideOptions.defaultVariableValue = assertion.defaultVariableValues[variableKey];
|
|
116
|
+
}
|
|
117
|
+
const actualValue = sdk.getVariable(featureKey, variableKey, assertion.context || {}, overrideOptions);
|
|
118
|
+
let passed;
|
|
119
|
+
const variableSchema = feature.variablesSchema?.[variableKey];
|
|
120
|
+
if (!variableSchema) {
|
|
121
|
+
testResult.passed = false;
|
|
122
|
+
testResultAssertion.passed = false;
|
|
123
|
+
testResultAssertion.errors.push({
|
|
124
|
+
type: "variable",
|
|
125
|
+
expected: assertion.expectedVariation,
|
|
126
|
+
actual: undefined,
|
|
127
|
+
message: `schema for variable "${variableKey}" not found in feature`,
|
|
128
|
+
});
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (variableSchema.type === "json") {
|
|
132
|
+
// JSON type
|
|
133
|
+
const parsedExpectedValue = typeof expectedValue === "string" ? JSON.parse(expectedValue) : expectedValue;
|
|
134
|
+
if (Array.isArray(actualValue)) {
|
|
135
|
+
passed = (0, helpers_1.checkIfArraysAreEqual)(parsedExpectedValue, actualValue);
|
|
136
|
+
}
|
|
137
|
+
else if (typeof actualValue === "object") {
|
|
138
|
+
passed = (0, helpers_1.checkIfObjectsAreEqual)(parsedExpectedValue, actualValue);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
passed = JSON.stringify(parsedExpectedValue) === JSON.stringify(actualValue);
|
|
142
|
+
}
|
|
143
|
+
if (!passed) {
|
|
144
|
+
testResult.passed = false;
|
|
145
|
+
testResultAssertion.passed = false;
|
|
146
|
+
testResultAssertion.errors.push({
|
|
147
|
+
type: "variable",
|
|
148
|
+
expected: typeof expectedValue !== "string" ? JSON.stringify(expectedValue) : expectedValue,
|
|
149
|
+
actual: typeof actualValue !== "string" ? JSON.stringify(actualValue) : actualValue,
|
|
150
|
+
details: {
|
|
151
|
+
...details,
|
|
152
|
+
variableKey,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
// other types
|
|
159
|
+
if (typeof expectedValue === "object") {
|
|
160
|
+
passed = (0, helpers_1.checkIfObjectsAreEqual)(expectedValue, actualValue);
|
|
161
|
+
}
|
|
162
|
+
else if (Array.isArray(expectedValue)) {
|
|
163
|
+
passed = (0, helpers_1.checkIfArraysAreEqual)(expectedValue, actualValue);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
passed = expectedValue === actualValue;
|
|
167
|
+
}
|
|
168
|
+
if (!passed) {
|
|
169
|
+
testResult.passed = false;
|
|
170
|
+
testResultAssertion.passed = false;
|
|
171
|
+
testResultAssertion.errors.push({
|
|
172
|
+
type: "variable",
|
|
173
|
+
expected: expectedValue,
|
|
174
|
+
actual: actualValue,
|
|
175
|
+
details: {
|
|
176
|
+
...details,
|
|
177
|
+
variableKey,
|
|
178
|
+
},
|
|
208
179
|
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (typeof assertion.expectedVariables === "object") {
|
|
185
|
+
testExpectedVariables(sdk, assertion);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* expectedEvaluations
|
|
189
|
+
*/
|
|
190
|
+
function testExpectedEvaluations(sdk, assertion, rootDetails = {}) {
|
|
191
|
+
function testEvaluation(type, evaluation, expected, details = {}) {
|
|
192
|
+
for (const [key, value] of Object.entries(expected)) {
|
|
193
|
+
if (evaluation[key] !== value) {
|
|
194
|
+
testResult.passed = false;
|
|
195
|
+
testResultAssertion.passed = false;
|
|
196
|
+
testResultAssertion.errors.push({
|
|
197
|
+
type: "evaluation",
|
|
198
|
+
expected: value,
|
|
199
|
+
actual: evaluation[key],
|
|
200
|
+
details: {
|
|
201
|
+
...rootDetails,
|
|
202
|
+
...details,
|
|
203
|
+
evaluationType: type,
|
|
204
|
+
evaluationKey: key,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
229
209
|
}
|
|
230
|
-
|
|
231
|
-
|
|
210
|
+
if (assertion.expectedEvaluations.flag) {
|
|
211
|
+
const evaluation = sdk.evaluateFlag(featureKey, assertion.context || {});
|
|
212
|
+
testEvaluation("flag", evaluation, assertion.expectedEvaluations.flag);
|
|
213
|
+
}
|
|
214
|
+
if (assertion.expectedEvaluations.variation) {
|
|
215
|
+
const evaluation = sdk.evaluateVariation(featureKey, assertion.context || {});
|
|
216
|
+
testEvaluation("variation", evaluation, assertion.expectedEvaluations.variation);
|
|
217
|
+
}
|
|
218
|
+
if (assertion.expectedEvaluations.variables) {
|
|
219
|
+
const variableKeys = Object.keys(assertion.expectedEvaluations.variables);
|
|
220
|
+
for (const variableKey of variableKeys) {
|
|
221
|
+
const evaluation = sdk.evaluateVariable(featureKey, variableKey, assertion.context || {});
|
|
222
|
+
testEvaluation("variable", evaluation, assertion.expectedEvaluations.variables[variableKey], { variableKey });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (assertion.expectedEvaluations) {
|
|
227
|
+
testExpectedEvaluations(sdk, assertion);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* children
|
|
231
|
+
*/
|
|
232
|
+
if (Array.isArray(assertion.children)) {
|
|
233
|
+
let childIndex = 0;
|
|
234
|
+
for (const child of assertion.children) {
|
|
235
|
+
const childSdk = sdk.spawn(child.context || {}, {
|
|
236
|
+
sticky: assertion.sticky || {},
|
|
237
|
+
});
|
|
238
|
+
// expectedToBeEnabled
|
|
239
|
+
if (typeof child.expectedToBeEnabled !== "undefined") {
|
|
240
|
+
testExpectedToBeEnabled(childSdk, child, {
|
|
241
|
+
childIndex,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// expectedVariation
|
|
245
|
+
if (typeof child.expectedVariation !== "undefined") {
|
|
246
|
+
testExpectedVariation(childSdk, child, {
|
|
247
|
+
childIndex,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
// expectedVariables
|
|
251
|
+
if (typeof child.expectedVariables === "object") {
|
|
252
|
+
testExpectedVariables(childSdk, child, {
|
|
253
|
+
childIndex,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
// expectedEvaluations
|
|
257
|
+
if (typeof child.expectedEvaluations === "object") {
|
|
258
|
+
testExpectedEvaluations(childSdk, child, {
|
|
259
|
+
childIndex,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
childIndex++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
testResultAssertion.duration = Date.now() - assertionStartTime;
|
|
266
|
+
testResult.assertions.push(testResultAssertion);
|
|
267
|
+
}
|
|
268
|
+
testResult.duration = Date.now() - testStartTime;
|
|
269
|
+
return testResult;
|
|
232
270
|
}
|
|
233
271
|
//# sourceMappingURL=testFeature.js.map
|
|
@@ -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":";;AAqBA,kCA0UC;AAxVD,2CAM2B;AAK3B,uCAA0E;AAGnE,KAAK,UAAU,WAAW,CAC/B,UAAsB,EACtB,aAA4B,EAC5B,IAAiB,EACjB,UAA8F,EAAE,EAChG,4BAA0D;IAE1D,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;IAEhC,MAAM,UAAU,GAAe;QAC7B,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,UAAU;QAEf,sBAAsB;QACtB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,CAAC;QACX,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,EAAE;KACf,CAAC;IAEF,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;QAC/D,MAAM,kBAAkB,GAAG,IAAI,C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,CAAC,QAAQ,EAAE,KAAK,EAAE;wBACrC,UAAU;qBACX,CAAC,CAAC;gBACL,CAAC;gBAED,oBAAoB;gBACpB,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;oBAChD,qBAAqB,CAAC,QAAQ,EAAE,KAAK,EAAE;wBACrC,UAAU;qBACX,CAAC,CAAC;gBACL,CAAC;gBAED,sBAAsB;gBACtB,IAAI,OAAO,KAAK,CAAC,mBAAmB,KAAK,QAAQ,EAAE,CAAC;oBAClD,uBAAuB,CAAC,QAAQ,EAAE,KAAK,EAAE;wBACvC,UAAU;qBACX,CAAC,CAAC;gBACL,CAAC;gBAED,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC;QAED,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;QAC/D,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC;IAEjD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatafileContent } from "@featurevisor/types";
|
|
1
|
+
import type { Test, DatafileContent } from "@featurevisor/types";
|
|
2
2
|
import { Dependencies } from "../dependencies";
|
|
3
3
|
import { Plugin } from "../cli";
|
|
4
4
|
export interface TestProjectOptions {
|
|
@@ -10,10 +10,6 @@ export interface TestProjectOptions {
|
|
|
10
10
|
schemaVersion?: string;
|
|
11
11
|
inflate?: number;
|
|
12
12
|
}
|
|
13
|
-
export interface TestPatterns {
|
|
14
|
-
keyPattern?: RegExp;
|
|
15
|
-
assertionPattern?: RegExp;
|
|
16
|
-
}
|
|
17
13
|
export interface ExecutionResult {
|
|
18
14
|
passed: boolean;
|
|
19
15
|
assertionsCount: {
|
|
@@ -22,6 +18,6 @@ export interface ExecutionResult {
|
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
export type DatafileContentByEnvironment = Map<string | false, DatafileContent>;
|
|
25
|
-
export declare function executeTest(
|
|
26
|
-
export declare function testProject(deps: Dependencies,
|
|
21
|
+
export declare function executeTest(test: Test, deps: Dependencies, options: TestProjectOptions, datafileContentByEnvironment: DatafileContentByEnvironment): Promise<ExecutionResult | undefined>;
|
|
22
|
+
export declare function testProject(deps: Dependencies, testOptions?: TestProjectOptions): Promise<boolean>;
|
|
27
23
|
export declare const testPlugin: Plugin;
|