testeranto 0.173.0 → 0.177.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/common/src/PM/base.js +5 -5
- package/dist/common/src/PM/main.js +48 -52
- package/dist/common/src/PM/node.js +4 -1
- package/dist/common/src/PM/pure.js +4 -1
- package/dist/common/src/PM/web.js +4 -1
- package/dist/common/src/Pure.js +0 -4
- package/dist/common/src/Pure.test.js +1 -1
- package/dist/common/src/ReportServerLib.js +11 -5
- package/dist/common/src/esbuildConfigs/node.js +1 -3
- package/dist/common/src/lib/BaseSuite.js +13 -11
- package/dist/common/src/lib/abstractBase.js +39 -42
- package/dist/common/src/lib/basebuilder.js +5 -0
- package/dist/common/src/lib/core.js +1 -0
- package/dist/common/src/lib/pmProxy.js +210 -100
- package/dist/common/src/lib/pmProxy.test/adapter.js +2 -2
- package/dist/common/src/lib/pmProxy.test/implementation.js +1 -1
- package/dist/common/testeranto.config.js +39 -39
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/PM/base.js +5 -5
- package/dist/module/src/PM/main.js +13 -17
- package/dist/module/src/PM/node.js +4 -1
- package/dist/module/src/PM/pure.js +4 -1
- package/dist/module/src/PM/web.js +4 -1
- package/dist/module/src/Pure.js +0 -4
- package/dist/module/src/Pure.test.js +1 -1
- package/dist/module/src/ReportServerLib.js +11 -5
- package/dist/module/src/esbuildConfigs/node.js +1 -3
- package/dist/module/src/lib/BaseSuite.js +13 -11
- package/dist/module/src/lib/abstractBase.js +39 -42
- package/dist/module/src/lib/basebuilder.js +5 -0
- package/dist/module/src/lib/core.js +1 -0
- package/dist/module/src/lib/pmProxy.js +210 -100
- package/dist/module/src/lib/pmProxy.test/adapter.js +2 -2
- package/dist/module/src/lib/pmProxy.test/implementation.js +1 -1
- package/dist/module/testeranto.config.js +39 -39
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/ReportServer.mjs +10 -4
- package/dist/prebuild/build.mjs +1 -1
- package/dist/prebuild/run.mjs +19 -22
- package/dist/types/src/PM/base.d.ts +1 -1
- package/dist/types/src/PM/node.d.ts +1 -1
- package/dist/types/src/PM/pure.d.ts +1 -1
- package/dist/types/src/PM/web.d.ts +1 -1
- package/dist/types/src/ReportServerLib.d.ts +1 -2
- package/dist/types/src/lib/BaseSuite.d.ts +2 -0
- package/dist/types/src/lib/abstractBase.d.ts +4 -6
- package/dist/types/src/lib/pmProxy.d.ts +3 -3
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/PM/base.ts +6 -9
- package/src/PM/main.ts +17 -20
- package/src/PM/node.ts +6 -1
- package/src/PM/pure.ts +6 -1
- package/src/PM/web.ts +5 -1
- package/src/Pure.test.ts +6 -6
- package/src/Pure.ts +0 -8
- package/src/ReportServerLib.ts +10 -7
- package/src/esbuildConfigs/node.ts +1 -1
- package/src/lib/BaseSuite.ts +16 -21
- package/src/lib/abstractBase.ts +57 -49
- package/src/lib/basebuilder.ts +6 -0
- package/src/lib/core.ts +1 -0
- package/src/lib/pmProxy.test/adapter.ts +2 -2
- package/src/lib/pmProxy.test/implementation.ts +3 -3
- package/src/lib/pmProxy.test/types.ts +0 -2
- package/src/lib/pmProxy.ts +224 -92
- package/testeranto/bundles/node/core/metafile.json +2 -480
- package/testeranto/bundles/pure/core/metafile.json +3 -621
- package/testeranto/bundles/web/core/metafile.json +14384 -78
- package/testeranto/bundles/web/core/src/{lib/baseBuilder.test/baseBuilder.test.web.html → components/pure/ProjectPageView.test/index.html} +2 -2
- package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.mjs +39991 -0
- package/testeranto/projects.json +0 -1
- package/testeranto/reports/core/config.json +5 -5
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +18 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/logs.txt +59 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/prompt.txt +27 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/suite-0/given-basicRender/then-0/butThen/happyPath.png +0 -0
- package/testeranto/reports/{staticSite/src/ReportServer.test.ts/index/node → core/src/components/pure/ProjectPageView.test/index/web}/type_errors.txt +20 -22
- package/testeranto/reports/core/summary.json +5 -19
- package/testeranto.config.ts +39 -39
- package/tsc.log +78 -92
- package/testeranto/bundles/node/allTests/metafile.json +0 -486
- package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +0 -1182
- package/testeranto/bundles/node/core/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +0 -1182
- package/testeranto/bundles/node/staticSite/metafile.json +0 -593
- package/testeranto/bundles/node/staticSite/src/ReportServer.test.ts/index.mjs +0 -1594
- package/testeranto/bundles/pure/allTests/metafile.json +0 -626
- package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +0 -1094
- package/testeranto/bundles/pure/core/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +0 -1094
- package/testeranto/bundles/pure/staticSite/metafile.json +0 -8
- package/testeranto/bundles/web/allTests/metafile.json +0 -780
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.html +0 -19
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +0 -1092
- package/testeranto/bundles/web/core/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +0 -1092
- package/testeranto/bundles/web/staticSite/metafile.json +0 -8
- package/testeranto/reports/allTests/config.json +0 -40
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +0 -33
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +0 -26
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +0 -69
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +0 -74
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +0 -26
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +0 -74
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -63
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +0 -26
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +0 -69
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +0 -74
- package/testeranto/reports/allTests/summary.json +0 -23
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/bdd_errors.txt +0 -1
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +0 -32
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +0 -26
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +0 -69
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +0 -74
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +0 -26
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +0 -74
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +0 -1
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -61
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +0 -2
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +0 -26
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +0 -69
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +0 -74
- package/testeranto/reports/staticSite/config.json +0 -24
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/lint_errors.txt +0 -5
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/logs.txt +0 -44
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/message.txt +0 -2
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/prompt.txt +0 -23
- package/testeranto/reports/staticSite/summary.json +0 -9
- package/testeranto/reportsnode_build_errors +0 -17
|
@@ -1,1092 +0,0 @@
|
|
|
1
|
-
// src/PM/index.ts
|
|
2
|
-
var PM = class {
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
// src/PM/web.ts
|
|
6
|
-
var PM_Web = class extends PM {
|
|
7
|
-
constructor(t) {
|
|
8
|
-
super();
|
|
9
|
-
this.testResourceConfiguration = t;
|
|
10
|
-
}
|
|
11
|
-
start() {
|
|
12
|
-
return new Promise((r) => r());
|
|
13
|
-
}
|
|
14
|
-
stop() {
|
|
15
|
-
return new Promise((r) => r());
|
|
16
|
-
}
|
|
17
|
-
getInnerHtml(selector, page2) {
|
|
18
|
-
throw new Error("web.ts getInnHtml not implemented");
|
|
19
|
-
}
|
|
20
|
-
pages() {
|
|
21
|
-
throw new Error("Method not implemented.");
|
|
22
|
-
}
|
|
23
|
-
stopSideCar(n) {
|
|
24
|
-
return window["stopSideCar"](n, this.testResourceConfiguration.name);
|
|
25
|
-
}
|
|
26
|
-
launchSideCar(n) {
|
|
27
|
-
return window["launchSideCar"](n, this.testResourceConfiguration.name);
|
|
28
|
-
}
|
|
29
|
-
waitForSelector(p, s) {
|
|
30
|
-
return window["waitForSelector"](p, s);
|
|
31
|
-
}
|
|
32
|
-
screencast(o, p) {
|
|
33
|
-
return window["screencast"](
|
|
34
|
-
{
|
|
35
|
-
...opts,
|
|
36
|
-
path: this.testResourceConfiguration.fs + "/" + opts.path
|
|
37
|
-
},
|
|
38
|
-
page.mainFrame()._id,
|
|
39
|
-
this.testResourceConfiguration.name
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
screencastStop(recorder) {
|
|
43
|
-
return window["screencastStop"](recorder);
|
|
44
|
-
}
|
|
45
|
-
closePage(p) {
|
|
46
|
-
return window["closePage"](p);
|
|
47
|
-
}
|
|
48
|
-
goto(p, url) {
|
|
49
|
-
return window["goto"](p, url);
|
|
50
|
-
}
|
|
51
|
-
newPage() {
|
|
52
|
-
return window["newPage"]();
|
|
53
|
-
}
|
|
54
|
-
$(selector) {
|
|
55
|
-
return window["$"](selector);
|
|
56
|
-
}
|
|
57
|
-
isDisabled(selector) {
|
|
58
|
-
return window["isDisabled"](selector);
|
|
59
|
-
}
|
|
60
|
-
getAttribute(selector, attribute) {
|
|
61
|
-
return window["getAttribute"](selector, attribute);
|
|
62
|
-
}
|
|
63
|
-
getValue(selector) {
|
|
64
|
-
return window["getValue"](selector);
|
|
65
|
-
}
|
|
66
|
-
focusOn(selector) {
|
|
67
|
-
return window["focusOn"](selector);
|
|
68
|
-
}
|
|
69
|
-
typeInto(value) {
|
|
70
|
-
return window["typeInto"](value);
|
|
71
|
-
}
|
|
72
|
-
async page(x) {
|
|
73
|
-
return window["page"](x);
|
|
74
|
-
}
|
|
75
|
-
click(selector) {
|
|
76
|
-
return window["click"](selector);
|
|
77
|
-
}
|
|
78
|
-
customScreenShot(x, y) {
|
|
79
|
-
const opts2 = x[0];
|
|
80
|
-
const page2 = x[1];
|
|
81
|
-
return window["customScreenShot"](
|
|
82
|
-
{
|
|
83
|
-
...opts2,
|
|
84
|
-
path: this.testResourceConfiguration.fs + "/" + opts2.path
|
|
85
|
-
},
|
|
86
|
-
this.testResourceConfiguration.name,
|
|
87
|
-
page2
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
existsSync(destFolder) {
|
|
91
|
-
return window["existsSync"](destFolder);
|
|
92
|
-
}
|
|
93
|
-
mkdirSync(x) {
|
|
94
|
-
return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
|
|
95
|
-
}
|
|
96
|
-
write(uid, contents) {
|
|
97
|
-
return window["write"](uid, contents);
|
|
98
|
-
}
|
|
99
|
-
writeFileSync([filepath, contents]) {
|
|
100
|
-
return window["writeFileSync"](
|
|
101
|
-
this.testResourceConfiguration.fs + "/" + filepath,
|
|
102
|
-
contents,
|
|
103
|
-
this.testResourceConfiguration.name
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
createWriteStream(filepath) {
|
|
107
|
-
return window["createWriteStream"](
|
|
108
|
-
this.testResourceConfiguration.fs + "/" + filepath,
|
|
109
|
-
this.testResourceConfiguration.name
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
end(uid) {
|
|
113
|
-
return window["end"](uid);
|
|
114
|
-
}
|
|
115
|
-
customclose() {
|
|
116
|
-
window["customclose"](
|
|
117
|
-
this.testResourceConfiguration.fs,
|
|
118
|
-
this.testResourceConfiguration.name
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
testArtiFactoryfileWriter(tLog, callback) {
|
|
122
|
-
return (fPath, value) => {
|
|
123
|
-
callback(
|
|
124
|
-
new Promise((res, rej) => {
|
|
125
|
-
tLog("testArtiFactory =>", fPath);
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// src/lib/index.ts
|
|
133
|
-
var BaseAdapter = () => ({
|
|
134
|
-
beforeAll: async (s) => s,
|
|
135
|
-
beforeEach: async function(subject, initialValues, x, testResource, pm) {
|
|
136
|
-
return subject;
|
|
137
|
-
},
|
|
138
|
-
afterEach: async (s) => s,
|
|
139
|
-
afterAll: (store) => void 0,
|
|
140
|
-
butThen: async (store, thenCb) => {
|
|
141
|
-
return thenCb(store);
|
|
142
|
-
},
|
|
143
|
-
andWhen: async (store, whenCB, testResource, pm) => {
|
|
144
|
-
try {
|
|
145
|
-
await whenCB(store, testResource, pm);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error("Error in andWhen:", error);
|
|
148
|
-
throw error;
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
assertThis: (x) => x
|
|
152
|
-
});
|
|
153
|
-
var DefaultAdapter = (p) => {
|
|
154
|
-
return {
|
|
155
|
-
...BaseAdapter,
|
|
156
|
-
...p
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
var defaultTestResourceRequirement = {
|
|
160
|
-
ports: 0
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// src/lib/pmProxy.ts
|
|
164
|
-
var baseProxy = function(pm, mappings) {
|
|
165
|
-
return new Proxy(pm, {
|
|
166
|
-
get: (target, prop, receiver) => {
|
|
167
|
-
for (const mapping of mappings) {
|
|
168
|
-
const method = mapping[0];
|
|
169
|
-
const arger = mapping[1];
|
|
170
|
-
if (prop === method) {
|
|
171
|
-
return (...x) => target[prop](arger(...x));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return (...x) => target[prop](...x);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
var butThenProxy = (pm, filepath) => {
|
|
179
|
-
return baseProxy(pm, [
|
|
180
|
-
[
|
|
181
|
-
"screencast",
|
|
182
|
-
(opts2, p) => {
|
|
183
|
-
const path = `${filepath}/butThen/${opts2.path}`;
|
|
184
|
-
pm.currentStep?.artifacts?.push(path);
|
|
185
|
-
return [
|
|
186
|
-
{
|
|
187
|
-
...opts2,
|
|
188
|
-
path
|
|
189
|
-
},
|
|
190
|
-
p
|
|
191
|
-
];
|
|
192
|
-
}
|
|
193
|
-
],
|
|
194
|
-
[
|
|
195
|
-
"createWriteStream",
|
|
196
|
-
(fp) => {
|
|
197
|
-
const path = `${filepath}/butThen/${fp}`;
|
|
198
|
-
pm.currentStep?.artifacts?.push(path);
|
|
199
|
-
return [path];
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
[
|
|
203
|
-
"writeFileSync",
|
|
204
|
-
(fp, contents) => {
|
|
205
|
-
const path = `${filepath}/butThen/${fp}`;
|
|
206
|
-
pm.currentStep?.artifacts?.push(path);
|
|
207
|
-
return [path, contents];
|
|
208
|
-
}
|
|
209
|
-
],
|
|
210
|
-
[
|
|
211
|
-
"customScreenShot",
|
|
212
|
-
(opts2, p) => {
|
|
213
|
-
const path = `${filepath}/butThen/${opts2.path}`;
|
|
214
|
-
pm.currentStep?.artifacts?.push(path);
|
|
215
|
-
return [
|
|
216
|
-
{
|
|
217
|
-
...opts2,
|
|
218
|
-
path
|
|
219
|
-
},
|
|
220
|
-
p
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
]);
|
|
225
|
-
};
|
|
226
|
-
var andWhenProxy = (pm, filepath) => baseProxy(pm, [
|
|
227
|
-
[
|
|
228
|
-
"screencast",
|
|
229
|
-
(opts2, p) => [
|
|
230
|
-
{
|
|
231
|
-
...opts2,
|
|
232
|
-
path: `${filepath}/andWhen/${opts2.path}`
|
|
233
|
-
},
|
|
234
|
-
p
|
|
235
|
-
]
|
|
236
|
-
],
|
|
237
|
-
["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
|
|
238
|
-
["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
|
|
239
|
-
[
|
|
240
|
-
"customScreenShot",
|
|
241
|
-
(opts2, p) => [
|
|
242
|
-
{
|
|
243
|
-
...opts2,
|
|
244
|
-
path: `${filepath}/andWhen${opts2.path}`
|
|
245
|
-
},
|
|
246
|
-
p
|
|
247
|
-
]
|
|
248
|
-
]
|
|
249
|
-
]);
|
|
250
|
-
var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
|
|
251
|
-
[
|
|
252
|
-
"screencast",
|
|
253
|
-
(opts2, p) => [
|
|
254
|
-
{
|
|
255
|
-
...opts2,
|
|
256
|
-
path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
|
|
257
|
-
},
|
|
258
|
-
p
|
|
259
|
-
]
|
|
260
|
-
],
|
|
261
|
-
["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
|
|
262
|
-
[
|
|
263
|
-
"writeFileSync",
|
|
264
|
-
(fp, contents) => [
|
|
265
|
-
`suite-${suite}/given-${given}/afterEach/${fp}`,
|
|
266
|
-
contents
|
|
267
|
-
]
|
|
268
|
-
],
|
|
269
|
-
[
|
|
270
|
-
"customScreenShot",
|
|
271
|
-
(opts2, p) => [
|
|
272
|
-
{
|
|
273
|
-
...opts2,
|
|
274
|
-
path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
|
|
275
|
-
},
|
|
276
|
-
p
|
|
277
|
-
]
|
|
278
|
-
]
|
|
279
|
-
]);
|
|
280
|
-
var beforeEachProxy = (pm, suite) => baseProxy(pm, [
|
|
281
|
-
[
|
|
282
|
-
"screencast",
|
|
283
|
-
(opts2, p) => [
|
|
284
|
-
{
|
|
285
|
-
...opts2,
|
|
286
|
-
path: `suite-${suite}/beforeEach/${opts2.path}`
|
|
287
|
-
},
|
|
288
|
-
p
|
|
289
|
-
]
|
|
290
|
-
],
|
|
291
|
-
[
|
|
292
|
-
"writeFileSync",
|
|
293
|
-
(fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
|
|
294
|
-
],
|
|
295
|
-
[
|
|
296
|
-
"customScreenShot",
|
|
297
|
-
(opts2, p) => [
|
|
298
|
-
{
|
|
299
|
-
...opts2,
|
|
300
|
-
path: `suite-${suite}/beforeEach/${opts2.path}`
|
|
301
|
-
},
|
|
302
|
-
p
|
|
303
|
-
]
|
|
304
|
-
],
|
|
305
|
-
["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
|
|
306
|
-
]);
|
|
307
|
-
var beforeAllProxy = (pm, suite) => baseProxy(pm, [
|
|
308
|
-
[
|
|
309
|
-
"writeFileSync",
|
|
310
|
-
(fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
|
|
311
|
-
],
|
|
312
|
-
[
|
|
313
|
-
"customScreenShot",
|
|
314
|
-
(opts2, p) => [
|
|
315
|
-
{
|
|
316
|
-
...opts2,
|
|
317
|
-
path: `suite-${suite}/beforeAll/${opts2.path}`
|
|
318
|
-
},
|
|
319
|
-
p
|
|
320
|
-
]
|
|
321
|
-
],
|
|
322
|
-
["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
|
|
323
|
-
]);
|
|
324
|
-
var afterAllProxy = (pm, suite) => baseProxy(pm, [
|
|
325
|
-
["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
|
|
326
|
-
[
|
|
327
|
-
"writeFileSync",
|
|
328
|
-
(fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
|
|
329
|
-
],
|
|
330
|
-
[
|
|
331
|
-
"customScreenShot",
|
|
332
|
-
(opts2, p) => [
|
|
333
|
-
{
|
|
334
|
-
...opts2,
|
|
335
|
-
path: `suite-${suite}/afterAll/${opts2.path}`
|
|
336
|
-
},
|
|
337
|
-
p
|
|
338
|
-
]
|
|
339
|
-
]
|
|
340
|
-
]);
|
|
341
|
-
|
|
342
|
-
// src/lib/abstractBase.ts
|
|
343
|
-
var BaseGiven = class {
|
|
344
|
-
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
345
|
-
this.artifacts = [];
|
|
346
|
-
this.name = name;
|
|
347
|
-
this.features = features;
|
|
348
|
-
this.whens = whens;
|
|
349
|
-
this.thens = thens;
|
|
350
|
-
this.givenCB = givenCB;
|
|
351
|
-
this.initialValues = initialValues;
|
|
352
|
-
}
|
|
353
|
-
addArtifact(path) {
|
|
354
|
-
console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
|
|
355
|
-
this.artifacts.push(path);
|
|
356
|
-
}
|
|
357
|
-
beforeAll(store) {
|
|
358
|
-
return store;
|
|
359
|
-
}
|
|
360
|
-
toObj() {
|
|
361
|
-
return {
|
|
362
|
-
key: this.key,
|
|
363
|
-
name: this.name,
|
|
364
|
-
whens: this.whens.map((w) => {
|
|
365
|
-
if (w && w.toObj)
|
|
366
|
-
return w.toObj();
|
|
367
|
-
console.error("w is not as expected!", w.toString());
|
|
368
|
-
return {};
|
|
369
|
-
}),
|
|
370
|
-
thens: this.thens.map((t) => t.toObj()),
|
|
371
|
-
error: this.error ? [this.error, this.error.stack] : null,
|
|
372
|
-
failed: this.failed,
|
|
373
|
-
features: this.features,
|
|
374
|
-
artifacts: this.artifacts
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
async afterEach(store, key, artifactory, pm) {
|
|
378
|
-
return store;
|
|
379
|
-
}
|
|
380
|
-
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
381
|
-
this.key = key;
|
|
382
|
-
tLog(`
|
|
383
|
-
${this.key}`);
|
|
384
|
-
tLog(`
|
|
385
|
-
Given: ${this.name}`);
|
|
386
|
-
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
387
|
-
this.uberCatcher((e) => {
|
|
388
|
-
console.error(e.toString());
|
|
389
|
-
this.error = e.error;
|
|
390
|
-
tLog(e.stack);
|
|
391
|
-
});
|
|
392
|
-
try {
|
|
393
|
-
const proxiedPm = beforeEachProxy(pm, suiteNdx.toString());
|
|
394
|
-
console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
|
|
395
|
-
proxiedPm.currentStep = this;
|
|
396
|
-
this.store = await this.givenThat(
|
|
397
|
-
subject,
|
|
398
|
-
testResourceConfiguration,
|
|
399
|
-
givenArtifactory,
|
|
400
|
-
this.givenCB,
|
|
401
|
-
this.initialValues,
|
|
402
|
-
proxiedPm
|
|
403
|
-
);
|
|
404
|
-
} catch (e) {
|
|
405
|
-
console.error("Given failure: ", e.toString());
|
|
406
|
-
this.error = e;
|
|
407
|
-
throw e;
|
|
408
|
-
}
|
|
409
|
-
try {
|
|
410
|
-
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
411
|
-
await whenStep.test(
|
|
412
|
-
this.store,
|
|
413
|
-
testResourceConfiguration,
|
|
414
|
-
tLog,
|
|
415
|
-
pm,
|
|
416
|
-
`suite-${suiteNdx}/given-${key}/when/${whenNdx}`
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
420
|
-
const t = await thenStep.test(
|
|
421
|
-
this.store,
|
|
422
|
-
testResourceConfiguration,
|
|
423
|
-
tLog,
|
|
424
|
-
pm,
|
|
425
|
-
`suite-${suiteNdx}/given-${key}/then-${thenNdx}`
|
|
426
|
-
);
|
|
427
|
-
tester(t);
|
|
428
|
-
}
|
|
429
|
-
} catch (e) {
|
|
430
|
-
this.failed = true;
|
|
431
|
-
tLog(e.stack);
|
|
432
|
-
throw e;
|
|
433
|
-
} finally {
|
|
434
|
-
try {
|
|
435
|
-
await this.afterEach(
|
|
436
|
-
this.store,
|
|
437
|
-
this.key,
|
|
438
|
-
givenArtifactory,
|
|
439
|
-
afterEachProxy(pm, suiteNdx.toString(), key)
|
|
440
|
-
);
|
|
441
|
-
} catch (e) {
|
|
442
|
-
console.error("afterEach failed!", e.toString());
|
|
443
|
-
this.failed = e;
|
|
444
|
-
throw e;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return this.store;
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
var BaseWhen = class {
|
|
451
|
-
constructor(name, whenCB) {
|
|
452
|
-
this.artifacts = [];
|
|
453
|
-
this.name = name;
|
|
454
|
-
this.whenCB = whenCB;
|
|
455
|
-
}
|
|
456
|
-
toObj() {
|
|
457
|
-
console.log("toObj error", this.error);
|
|
458
|
-
if (this.error) {
|
|
459
|
-
return {
|
|
460
|
-
name: this.name,
|
|
461
|
-
error: this.error && this.error.name + this.error.stack,
|
|
462
|
-
artifacts: this.artifacts
|
|
463
|
-
};
|
|
464
|
-
} else {
|
|
465
|
-
return {
|
|
466
|
-
name: this.name,
|
|
467
|
-
artifacts: this.artifacts
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
472
|
-
try {
|
|
473
|
-
tLog(" When:", this.name);
|
|
474
|
-
console.debug("[DEBUG] Executing When step:", this.name.toString());
|
|
475
|
-
const proxiedPm = andWhenProxy(pm, filepath);
|
|
476
|
-
console.log(`[When] Setting currentStep for andWhen:`, this.name);
|
|
477
|
-
proxiedPm.currentStep = this;
|
|
478
|
-
const result = await this.andWhen(
|
|
479
|
-
store,
|
|
480
|
-
this.whenCB,
|
|
481
|
-
testResourceConfiguration,
|
|
482
|
-
proxiedPm
|
|
483
|
-
);
|
|
484
|
-
console.debug("[DEBUG] When step completed:", this.name.toString());
|
|
485
|
-
return result;
|
|
486
|
-
} catch (e) {
|
|
487
|
-
console.error(
|
|
488
|
-
"[ERROR] When step failed:",
|
|
489
|
-
this.name.toString(),
|
|
490
|
-
e.toString()
|
|
491
|
-
);
|
|
492
|
-
this.error = e;
|
|
493
|
-
throw e;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
var BaseThen = class {
|
|
498
|
-
constructor(name, thenCB) {
|
|
499
|
-
this.artifacts = [];
|
|
500
|
-
this.name = name;
|
|
501
|
-
this.thenCB = thenCB;
|
|
502
|
-
this.error = false;
|
|
503
|
-
}
|
|
504
|
-
toObj() {
|
|
505
|
-
return {
|
|
506
|
-
name: this.name,
|
|
507
|
-
error: this.error,
|
|
508
|
-
artifacts: this.artifacts
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
512
|
-
const proxiedPm = butThenProxy(pm, filepath);
|
|
513
|
-
console.log(`[Then] Setting currentStep for butThen:`, this.name);
|
|
514
|
-
proxiedPm.currentStep = this;
|
|
515
|
-
return this.butThen(
|
|
516
|
-
store,
|
|
517
|
-
async (s) => {
|
|
518
|
-
if (typeof this.thenCB === "function") {
|
|
519
|
-
return await this.thenCB(s, proxiedPm);
|
|
520
|
-
} else {
|
|
521
|
-
return this.thenCB;
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
testResourceConfiguration,
|
|
525
|
-
butThenProxy(pm, filepath)
|
|
526
|
-
).catch((e) => {
|
|
527
|
-
this.error = e.toString();
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
// src/lib/basebuilder.ts
|
|
533
|
-
var BaseBuilder = class {
|
|
534
|
-
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
|
|
535
|
-
this.artifacts = [];
|
|
536
|
-
this.artifacts = [];
|
|
537
|
-
this.testResourceRequirement = testResourceRequirement;
|
|
538
|
-
this.suitesOverrides = suitesOverrides;
|
|
539
|
-
this.givenOverides = givenOverides;
|
|
540
|
-
this.whenOverides = whenOverides;
|
|
541
|
-
this.thenOverides = thenOverides;
|
|
542
|
-
this.testSpecification = testSpecification;
|
|
543
|
-
this.specs = testSpecification(
|
|
544
|
-
this.Suites(),
|
|
545
|
-
this.Given(),
|
|
546
|
-
this.When(),
|
|
547
|
-
this.Then()
|
|
548
|
-
);
|
|
549
|
-
this.testJobs = this.specs.map((suite) => {
|
|
550
|
-
const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
|
|
551
|
-
const x = await suite2.run(
|
|
552
|
-
input,
|
|
553
|
-
puppetMaster.testResourceConfiguration,
|
|
554
|
-
(fPath, value) => puppetMaster.testArtiFactoryfileWriter(
|
|
555
|
-
tLog,
|
|
556
|
-
(p) => {
|
|
557
|
-
this.artifacts.push(p);
|
|
558
|
-
}
|
|
559
|
-
)(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
|
|
560
|
-
tLog,
|
|
561
|
-
puppetMaster
|
|
562
|
-
);
|
|
563
|
-
return x;
|
|
564
|
-
};
|
|
565
|
-
const runner = suiteRunner(suite);
|
|
566
|
-
return {
|
|
567
|
-
test: suite,
|
|
568
|
-
toObj: () => {
|
|
569
|
-
return suite.toObj();
|
|
570
|
-
},
|
|
571
|
-
runner,
|
|
572
|
-
receiveTestResourceConfig: async function(puppetMaster) {
|
|
573
|
-
const tLog = async (...l) => {
|
|
574
|
-
};
|
|
575
|
-
const suiteDone = await runner(puppetMaster, tLog);
|
|
576
|
-
const fails = suiteDone.fails;
|
|
577
|
-
await puppetMaster.writeFileSync([
|
|
578
|
-
`bdd_errors.txt`,
|
|
579
|
-
fails.toString()
|
|
580
|
-
]);
|
|
581
|
-
await puppetMaster.writeFileSync([
|
|
582
|
-
`tests.json`,
|
|
583
|
-
JSON.stringify(this.toObj(), null, 2)
|
|
584
|
-
]);
|
|
585
|
-
return {
|
|
586
|
-
failed: fails > 0,
|
|
587
|
-
fails,
|
|
588
|
-
artifacts: this.artifacts || [],
|
|
589
|
-
// logPromise,
|
|
590
|
-
features: suiteDone.features()
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
// testsJson() {
|
|
597
|
-
// puppetMaster.writeFileSync(
|
|
598
|
-
// `tests.json`,
|
|
599
|
-
// JSON.stringify({ features: suiteDone.features() }, null, 2)
|
|
600
|
-
// );
|
|
601
|
-
// }
|
|
602
|
-
Specs() {
|
|
603
|
-
return this.specs;
|
|
604
|
-
}
|
|
605
|
-
Suites() {
|
|
606
|
-
return this.suitesOverrides;
|
|
607
|
-
}
|
|
608
|
-
Given() {
|
|
609
|
-
return this.givenOverides;
|
|
610
|
-
}
|
|
611
|
-
When() {
|
|
612
|
-
return this.whenOverides;
|
|
613
|
-
}
|
|
614
|
-
Then() {
|
|
615
|
-
return this.thenOverides;
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
// src/lib/classBuilder.ts
|
|
620
|
-
var ClassBuilder = class extends BaseBuilder {
|
|
621
|
-
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
|
|
622
|
-
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
623
|
-
(a, [key], index) => {
|
|
624
|
-
a[key] = (somestring, givens) => {
|
|
625
|
-
return new suiteKlasser.prototype.constructor(
|
|
626
|
-
somestring,
|
|
627
|
-
index,
|
|
628
|
-
givens
|
|
629
|
-
);
|
|
630
|
-
};
|
|
631
|
-
return a;
|
|
632
|
-
},
|
|
633
|
-
{}
|
|
634
|
-
);
|
|
635
|
-
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
636
|
-
(a, [key, g]) => {
|
|
637
|
-
a[key] = (features, whens, thens, ...initialValues) => {
|
|
638
|
-
return new givenKlasser.prototype.constructor(
|
|
639
|
-
key,
|
|
640
|
-
features,
|
|
641
|
-
whens,
|
|
642
|
-
thens,
|
|
643
|
-
testImplementation.givens[key],
|
|
644
|
-
initialValues
|
|
645
|
-
);
|
|
646
|
-
};
|
|
647
|
-
return a;
|
|
648
|
-
},
|
|
649
|
-
{}
|
|
650
|
-
);
|
|
651
|
-
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
652
|
-
(a, [key, whEn]) => {
|
|
653
|
-
a[key] = (...payload) => {
|
|
654
|
-
return new whenKlasser.prototype.constructor(
|
|
655
|
-
`${whEn.name}: ${payload && payload.toString()}`,
|
|
656
|
-
whEn(...payload)
|
|
657
|
-
);
|
|
658
|
-
};
|
|
659
|
-
return a;
|
|
660
|
-
},
|
|
661
|
-
{}
|
|
662
|
-
);
|
|
663
|
-
const classyThens = Object.entries(
|
|
664
|
-
testImplementation.thens
|
|
665
|
-
).reduce(
|
|
666
|
-
(a, [key, thEn]) => {
|
|
667
|
-
a[key] = (expected, ...x) => {
|
|
668
|
-
return new thenKlasser.prototype.constructor(
|
|
669
|
-
`${thEn.name}: ${expected && expected.toString()}`,
|
|
670
|
-
thEn(expected, ...x)
|
|
671
|
-
);
|
|
672
|
-
};
|
|
673
|
-
return a;
|
|
674
|
-
},
|
|
675
|
-
{}
|
|
676
|
-
);
|
|
677
|
-
super(
|
|
678
|
-
input,
|
|
679
|
-
classySuites,
|
|
680
|
-
classyGivens,
|
|
681
|
-
classyWhens,
|
|
682
|
-
classyThens,
|
|
683
|
-
testResourceRequirement,
|
|
684
|
-
testSpecification
|
|
685
|
-
);
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
// src/lib/BaseSuite.ts
|
|
690
|
-
var BaseSuite = class {
|
|
691
|
-
constructor(name, index, givens = {}) {
|
|
692
|
-
const suiteName = name || "testSuite";
|
|
693
|
-
if (!suiteName) {
|
|
694
|
-
throw new Error("BaseSuite requires a non-empty name");
|
|
695
|
-
}
|
|
696
|
-
console.log(
|
|
697
|
-
"[DEBUG] BaseSuite constructor - name:",
|
|
698
|
-
suiteName,
|
|
699
|
-
"index:",
|
|
700
|
-
index
|
|
701
|
-
);
|
|
702
|
-
this.name = suiteName;
|
|
703
|
-
this.index = index;
|
|
704
|
-
this.givens = givens;
|
|
705
|
-
this.fails = 0;
|
|
706
|
-
console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
|
|
707
|
-
console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
|
|
708
|
-
}
|
|
709
|
-
features() {
|
|
710
|
-
try {
|
|
711
|
-
const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
|
|
712
|
-
return array.indexOf(value) === index;
|
|
713
|
-
});
|
|
714
|
-
console.debug("[DEBUG] Features extracted:", features.toString());
|
|
715
|
-
return features || [];
|
|
716
|
-
} catch (e) {
|
|
717
|
-
console.error("[ERROR] Failed to extract features:", e);
|
|
718
|
-
return [];
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
toObj() {
|
|
722
|
-
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
723
|
-
return {
|
|
724
|
-
name: this.name,
|
|
725
|
-
givens,
|
|
726
|
-
fails: this.fails,
|
|
727
|
-
failed: this.failed,
|
|
728
|
-
features: this.features()
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
setup(s, artifactory, tr, pm) {
|
|
732
|
-
return new Promise((res) => res(s));
|
|
733
|
-
}
|
|
734
|
-
assertThat(t) {
|
|
735
|
-
return !!t;
|
|
736
|
-
}
|
|
737
|
-
afterAll(store, artifactory, pm) {
|
|
738
|
-
return store;
|
|
739
|
-
}
|
|
740
|
-
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
741
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
742
|
-
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
743
|
-
tLog("\nSuite:", this.index, this.name);
|
|
744
|
-
const sNdx = this.index;
|
|
745
|
-
const subject = await this.setup(
|
|
746
|
-
input,
|
|
747
|
-
suiteArtifactory,
|
|
748
|
-
testResourceConfiguration,
|
|
749
|
-
beforeAllProxy(pm, sNdx.toString())
|
|
750
|
-
);
|
|
751
|
-
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
752
|
-
const giver = this.givens[gKey];
|
|
753
|
-
this.store = await giver.give(
|
|
754
|
-
subject,
|
|
755
|
-
gKey,
|
|
756
|
-
testResourceConfiguration,
|
|
757
|
-
this.assertThat,
|
|
758
|
-
suiteArtifactory,
|
|
759
|
-
tLog,
|
|
760
|
-
pm,
|
|
761
|
-
sNdx
|
|
762
|
-
).catch((e) => {
|
|
763
|
-
this.failed = true;
|
|
764
|
-
this.fails = this.fails + 1;
|
|
765
|
-
throw e;
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
try {
|
|
769
|
-
this.afterAll(
|
|
770
|
-
this.store,
|
|
771
|
-
artifactory,
|
|
772
|
-
afterAllProxy(pm, sNdx.toString())
|
|
773
|
-
);
|
|
774
|
-
} catch (e) {
|
|
775
|
-
console.error(e);
|
|
776
|
-
}
|
|
777
|
-
return this;
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
|
|
781
|
-
// src/lib/core.ts
|
|
782
|
-
var TesterantoCore = class extends ClassBuilder {
|
|
783
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter2, uberCatcher) {
|
|
784
|
-
const fullAdapter = DefaultAdapter(testAdapter2);
|
|
785
|
-
super(
|
|
786
|
-
testImplementation,
|
|
787
|
-
testSpecification,
|
|
788
|
-
input,
|
|
789
|
-
class extends BaseSuite {
|
|
790
|
-
afterAll(store, artifactory, pm) {
|
|
791
|
-
return fullAdapter.afterAll(store, pm);
|
|
792
|
-
}
|
|
793
|
-
assertThat(t) {
|
|
794
|
-
return fullAdapter.assertThis(t);
|
|
795
|
-
}
|
|
796
|
-
async setup(s, artifactory, tr, pm) {
|
|
797
|
-
return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
|
|
798
|
-
s,
|
|
799
|
-
this.testResourceConfiguration,
|
|
800
|
-
// artifactory,
|
|
801
|
-
pm
|
|
802
|
-
);
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
class Given extends BaseGiven {
|
|
806
|
-
constructor() {
|
|
807
|
-
super(...arguments);
|
|
808
|
-
this.uberCatcher = uberCatcher;
|
|
809
|
-
}
|
|
810
|
-
async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
|
|
811
|
-
return fullAdapter.beforeEach(
|
|
812
|
-
subject,
|
|
813
|
-
initializer,
|
|
814
|
-
testResource,
|
|
815
|
-
initialValues,
|
|
816
|
-
pm
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
afterEach(store, key, artifactory, pm) {
|
|
820
|
-
return new Promise(
|
|
821
|
-
(res) => res(fullAdapter.afterEach(store, key, pm))
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
-
},
|
|
825
|
-
class When extends BaseWhen {
|
|
826
|
-
async andWhen(store, whenCB, testResource, pm) {
|
|
827
|
-
return await fullAdapter.andWhen(store, whenCB, testResource, pm);
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
class Then extends BaseThen {
|
|
831
|
-
async butThen(store, thenCB, testResource, pm) {
|
|
832
|
-
return await fullAdapter.butThen(store, thenCB, testResource, pm);
|
|
833
|
-
}
|
|
834
|
-
},
|
|
835
|
-
testResourceRequirement
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
// src/Web.ts
|
|
841
|
-
var WebTesteranto = class extends TesterantoCore {
|
|
842
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter2) {
|
|
843
|
-
super(
|
|
844
|
-
input,
|
|
845
|
-
testSpecification,
|
|
846
|
-
testImplementation,
|
|
847
|
-
testResourceRequirement,
|
|
848
|
-
testAdapter2,
|
|
849
|
-
(cb) => {
|
|
850
|
-
}
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
async receiveTestResourceConfig(partialTestResource) {
|
|
854
|
-
const t = partialTestResource;
|
|
855
|
-
const pm = new PM_Web(t);
|
|
856
|
-
return await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
var Web_default = async (input, testSpecification, testImplementation, testAdapter2, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
860
|
-
return new WebTesteranto(
|
|
861
|
-
input,
|
|
862
|
-
testSpecification,
|
|
863
|
-
testImplementation,
|
|
864
|
-
testResourceRequirement,
|
|
865
|
-
testAdapter2
|
|
866
|
-
);
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
// src/lib/baseBuilder.test/baseBuilder.test.specification.ts
|
|
870
|
-
var specification = (Suite, Given, When, Then) => {
|
|
871
|
-
return [
|
|
872
|
-
Suite.Default("Testing BaseBuilder functionality", {
|
|
873
|
-
testInitialization: Given["the default BaseBuilder"](
|
|
874
|
-
["BaseBuilder should initialize correctly"],
|
|
875
|
-
[],
|
|
876
|
-
[
|
|
877
|
-
Then["it is initialized"](),
|
|
878
|
-
Then["it tracks artifacts"]()
|
|
879
|
-
// Then["it creates jobs"](),
|
|
880
|
-
// Then["it generates TestSpecifications"](),
|
|
881
|
-
]
|
|
882
|
-
),
|
|
883
|
-
testSpecsGeneration: Given["the default BaseBuilder"](
|
|
884
|
-
["BaseBuilder should generate specs from test specification"],
|
|
885
|
-
[],
|
|
886
|
-
[Then["it generates TestSpecifications"]()]
|
|
887
|
-
),
|
|
888
|
-
testJobsCreation: Given["the default BaseBuilder"](
|
|
889
|
-
["BaseBuilder should create test jobs"],
|
|
890
|
-
[],
|
|
891
|
-
[Then["it creates jobs"]()]
|
|
892
|
-
)
|
|
893
|
-
})
|
|
894
|
-
];
|
|
895
|
-
};
|
|
896
|
-
|
|
897
|
-
// src/lib/baseBuilder.test/baseBuilder.test.mock.ts
|
|
898
|
-
var MockBaseBuilder = class extends BaseBuilder {
|
|
899
|
-
constructor(input, suitesOverrides = {}, givenOverrides = {}, whenOverrides = {}, thenOverrides = {}, testResourceRequirement = { ports: 0 }, testSpecification = () => []) {
|
|
900
|
-
super(
|
|
901
|
-
input,
|
|
902
|
-
suitesOverrides,
|
|
903
|
-
givenOverrides,
|
|
904
|
-
whenOverrides,
|
|
905
|
-
thenOverrides,
|
|
906
|
-
testResourceRequirement,
|
|
907
|
-
testSpecification
|
|
908
|
-
);
|
|
909
|
-
this.summary = {};
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Simplified version for testing that doesn't actually run tests
|
|
913
|
-
*/
|
|
914
|
-
testRun(puppetMaster) {
|
|
915
|
-
this.summary = {
|
|
916
|
-
[puppetMaster.testResourceConfiguration.name]: {
|
|
917
|
-
typeErrors: 0,
|
|
918
|
-
staticErrors: 0,
|
|
919
|
-
runTimeError: "",
|
|
920
|
-
prompt: "",
|
|
921
|
-
failingFeatures: {}
|
|
922
|
-
}
|
|
923
|
-
};
|
|
924
|
-
return Promise.resolve({
|
|
925
|
-
failed: false,
|
|
926
|
-
fails: 0,
|
|
927
|
-
artifacts: [],
|
|
928
|
-
// logPromise: Promise.resolve(),
|
|
929
|
-
features: []
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
};
|
|
933
|
-
|
|
934
|
-
// src/lib/baseBuilder.test/baseBuilder.test.implementation.ts
|
|
935
|
-
var implementation = {
|
|
936
|
-
suites: {
|
|
937
|
-
Default: "BaseBuilder test suite"
|
|
938
|
-
},
|
|
939
|
-
givens: {
|
|
940
|
-
"the default BaseBuilder": () => {
|
|
941
|
-
return new MockBaseBuilder(
|
|
942
|
-
{},
|
|
943
|
-
// input
|
|
944
|
-
{},
|
|
945
|
-
// suitesOverrides
|
|
946
|
-
{},
|
|
947
|
-
// givenOverrides
|
|
948
|
-
{},
|
|
949
|
-
// whenOverrides
|
|
950
|
-
{},
|
|
951
|
-
// thenOverrides
|
|
952
|
-
{ ports: 0 },
|
|
953
|
-
// testResourceRequirement
|
|
954
|
-
() => []
|
|
955
|
-
// testSpecification
|
|
956
|
-
);
|
|
957
|
-
},
|
|
958
|
-
"a BaseBuilder with TestInput": (input) => {
|
|
959
|
-
return new MockBaseBuilder(
|
|
960
|
-
input,
|
|
961
|
-
{},
|
|
962
|
-
{},
|
|
963
|
-
{},
|
|
964
|
-
{},
|
|
965
|
-
{ ports: [] },
|
|
966
|
-
() => []
|
|
967
|
-
);
|
|
968
|
-
},
|
|
969
|
-
"a BaseBuilder with Test Resource Requirements": (requirements) => {
|
|
970
|
-
return new MockBaseBuilder({}, {}, {}, {}, {}, requirements, () => []);
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
whens: {
|
|
974
|
-
addArtifact: (artifact) => (builder) => {
|
|
975
|
-
builder.artifacts.push(artifact);
|
|
976
|
-
return builder;
|
|
977
|
-
},
|
|
978
|
-
setTestJobs: (jobs) => (builder) => {
|
|
979
|
-
builder.testJobs = jobs;
|
|
980
|
-
return builder;
|
|
981
|
-
}
|
|
982
|
-
},
|
|
983
|
-
thens: {
|
|
984
|
-
"it is initialized": () => (builder, utils) => {
|
|
985
|
-
utils.writeFileSync("hello.txt", "world");
|
|
986
|
-
if (!(builder instanceof BaseBuilder)) {
|
|
987
|
-
console.error("Builder instance:", builder);
|
|
988
|
-
throw new Error(
|
|
989
|
-
`Builder was not properly initialized - expected BaseBuilder instance but got ${builder?.constructor?.name}`
|
|
990
|
-
);
|
|
991
|
-
}
|
|
992
|
-
[
|
|
993
|
-
"artifacts",
|
|
994
|
-
"testJobs",
|
|
995
|
-
"specs",
|
|
996
|
-
"suitesOverrides",
|
|
997
|
-
"givenOverides",
|
|
998
|
-
"whenOverides",
|
|
999
|
-
"thenOverides"
|
|
1000
|
-
].forEach((prop) => {
|
|
1001
|
-
if (!(prop in builder)) {
|
|
1002
|
-
throw new Error(`Builder missing required property: ${prop}`);
|
|
1003
|
-
}
|
|
1004
|
-
});
|
|
1005
|
-
return builder;
|
|
1006
|
-
},
|
|
1007
|
-
"it generates TestSpecifications": () => (builder) => {
|
|
1008
|
-
if (!Array.isArray(builder.specs)) {
|
|
1009
|
-
throw new Error("Specs were not generated");
|
|
1010
|
-
}
|
|
1011
|
-
return builder;
|
|
1012
|
-
},
|
|
1013
|
-
"it creates jobs": () => (builder) => {
|
|
1014
|
-
if (!Array.isArray(builder.testJobs)) {
|
|
1015
|
-
throw new Error("Test jobs were not created");
|
|
1016
|
-
}
|
|
1017
|
-
return builder;
|
|
1018
|
-
},
|
|
1019
|
-
"it tracks artifacts": () => (builder) => {
|
|
1020
|
-
if (!Array.isArray(builder.artifacts)) {
|
|
1021
|
-
throw new Error("Artifacts array not initialized");
|
|
1022
|
-
}
|
|
1023
|
-
return builder;
|
|
1024
|
-
},
|
|
1025
|
-
resourceRequirementsSet: () => (builder) => {
|
|
1026
|
-
if (!builder.testResourceRequirement) {
|
|
1027
|
-
throw new Error("Resource requirements not set");
|
|
1028
|
-
}
|
|
1029
|
-
return builder;
|
|
1030
|
-
},
|
|
1031
|
-
suitesOverridesConfigured: () => (builder) => {
|
|
1032
|
-
if (!builder.suitesOverrides) {
|
|
1033
|
-
throw new Error("Suites overrides not configured");
|
|
1034
|
-
}
|
|
1035
|
-
return builder;
|
|
1036
|
-
},
|
|
1037
|
-
givensOverridesConfigured: () => (builder) => {
|
|
1038
|
-
if (!builder.givenOverides) {
|
|
1039
|
-
throw new Error("Givens overrides not configured");
|
|
1040
|
-
}
|
|
1041
|
-
return builder;
|
|
1042
|
-
},
|
|
1043
|
-
whensOverridesConfigured: () => (builder) => {
|
|
1044
|
-
if (!builder.whenOverides) {
|
|
1045
|
-
throw new Error("Whens overrides not configured");
|
|
1046
|
-
}
|
|
1047
|
-
return builder;
|
|
1048
|
-
},
|
|
1049
|
-
thensOverridesConfigured: () => (builder) => {
|
|
1050
|
-
if (!builder.thenOverides) {
|
|
1051
|
-
throw new Error("Thens overrides not configured");
|
|
1052
|
-
}
|
|
1053
|
-
return builder;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
|
-
// src/lib/baseBuilder.test/baseBuilder.test.adapter.ts
|
|
1059
|
-
var testAdapter = {
|
|
1060
|
-
beforeAll: async (input, testResource, pm) => input,
|
|
1061
|
-
beforeEach: async (subject, initializer, testResource, initialValues, pm) => {
|
|
1062
|
-
console.log("Initializing test with:", {
|
|
1063
|
-
subject,
|
|
1064
|
-
initializer,
|
|
1065
|
-
initialValues
|
|
1066
|
-
});
|
|
1067
|
-
const result = initializer();
|
|
1068
|
-
console.log("Initialization result:", result.toString());
|
|
1069
|
-
return result;
|
|
1070
|
-
},
|
|
1071
|
-
andWhen: async (store, whenCB, testResource, utils) => {
|
|
1072
|
-
return whenCB(store, utils);
|
|
1073
|
-
},
|
|
1074
|
-
butThen: async (store, thenCB, testResource, pm) => {
|
|
1075
|
-
return thenCB(store, pm);
|
|
1076
|
-
},
|
|
1077
|
-
afterEach: (store) => store,
|
|
1078
|
-
afterAll: () => {
|
|
1079
|
-
},
|
|
1080
|
-
assertThis: (x) => x
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
// src/lib/baseBuilder.test/baseBuilder.test.web.ts
|
|
1084
|
-
var baseBuilder_test_web_default = Web_default(
|
|
1085
|
-
MockBaseBuilder.prototype,
|
|
1086
|
-
specification,
|
|
1087
|
-
implementation,
|
|
1088
|
-
testAdapter
|
|
1089
|
-
);
|
|
1090
|
-
export {
|
|
1091
|
-
baseBuilder_test_web_default as default
|
|
1092
|
-
};
|