testeranto 0.171.0 → 0.173.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 +2 -4
- package/dist/common/src/PM/base.js +4 -0
- package/dist/common/src/PM/main.js +11 -4
- package/dist/common/src/PM/node.js +1 -1
- package/dist/common/src/PM/web.js +3 -3
- package/dist/common/src/ReportServer.js +2 -126
- package/dist/common/src/ReportServer.test.ts/index.js +78 -0
- package/dist/common/src/ReportServerLib.js +135 -0
- package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +1 -1
- package/dist/common/src/lib/abstractBase.js +2 -0
- package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +10 -9
- package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.specification.js +7 -7
- package/dist/common/src/lib/basebuilder.js +8 -2
- package/dist/common/src/lib/pmProxy.js +54 -150
- package/dist/common/testeranto.config.js +35 -20
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/PM/base.js +4 -0
- package/dist/module/src/PM/main.js +11 -4
- package/dist/module/src/PM/node.js +1 -1
- package/dist/module/src/PM/web.js +3 -3
- package/dist/module/src/ReportServer.js +2 -123
- package/dist/module/src/ReportServer.test.ts/index.js +73 -0
- package/dist/module/src/ReportServerLib.js +128 -0
- package/dist/module/src/TestPage.js +29 -17
- package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +1 -1
- package/dist/module/src/components/pure/TestPageView.js +29 -17
- package/dist/module/src/lib/abstractBase.js +2 -0
- package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +10 -9
- package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.specification.js +7 -7
- package/dist/module/src/lib/basebuilder.js +8 -2
- package/dist/module/src/lib/pmProxy.js +54 -150
- package/dist/module/testeranto.config.js +35 -20
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.css +13 -9
- package/dist/prebuild/App.js +102 -99
- package/dist/prebuild/ReportServer.mjs +15 -9
- package/dist/prebuild/run.mjs +14 -4
- package/dist/types/src/PM/node.d.ts +1 -1
- package/dist/types/src/PM/web.d.ts +1 -1
- package/dist/types/src/ReportServer.test.ts/index.d.ts +29 -0
- package/dist/types/src/ReportServerLib.d.ts +2 -0
- package/dist/types/src/Types.d.ts +0 -1
- package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +1 -1
- package/dist/types/src/lib/abstractBase.d.ts +1 -1
- package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.types.d.ts +7 -4
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/src/PM/base.ts +5 -0
- package/src/PM/main.ts +12 -4
- package/src/PM/node.ts +1 -1
- package/src/PM/web.ts +3 -3
- package/src/ReportServer.test.ts/index.ts +194 -0
- package/src/ReportServer.ts +2 -132
- package/src/ReportServerLib.ts +144 -0
- package/src/TestPage.tsx +65 -5
- package/src/Types.ts +0 -1
- package/src/components/pure/ProjectPageView.test/implementation.tsx +1 -1
- package/src/components/pure/TestPageView.tsx +65 -5
- package/src/lib/abstractBase.ts +4 -1
- package/src/lib/baseBuilder.test/baseBuilder.test.implementation.ts +22 -10
- package/src/lib/baseBuilder.test/baseBuilder.test.specification.ts +9 -9
- package/src/lib/baseBuilder.test/baseBuilder.test.types.ts +7 -4
- package/src/lib/basebuilder.ts +7 -4
- package/src/lib/pmProxy.ts +78 -155
- package/testeranto/App.css +13 -9
- package/testeranto/App.js +102 -99
- package/testeranto/bundles/node/allTests/metafile.json +38 -781
- package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +983 -24
- package/testeranto/bundles/node/core/metafile.json +486 -0
- package/testeranto/bundles/{pure/allTests/chunk-VMUSFSZM.mjs → node/core/src/lib/baseBuilder.test/baseBuilder.test.node.mjs} +797 -412
- package/testeranto/bundles/node/staticSite/metafile.json +593 -0
- package/testeranto/bundles/node/staticSite/src/ReportServer.test.ts/index.mjs +1594 -0
- package/testeranto/bundles/pure/allTests/metafile.json +157 -585
- package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +740 -27
- package/testeranto/bundles/pure/core/metafile.json +626 -0
- package/testeranto/bundles/{web/allTests/chunk-U7AW26HL.mjs → pure/core/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs} +507 -410
- package/testeranto/bundles/pure/staticSite/metafile.json +8 -0
- package/testeranto/bundles/web/allTests/metafile.json +107 -15292
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +893 -45
- package/testeranto/bundles/web/core/metafile.json +780 -0
- package/testeranto/bundles/web/core/src/lib/baseBuilder.test/baseBuilder.test.web.html +19 -0
- package/testeranto/bundles/web/{allTests/chunk-RLDR6LJN.mjs → core/src/lib/baseBuilder.test/baseBuilder.test.web.mjs} +580 -518
- package/testeranto/bundles/web/staticSite/metafile.json +8 -0
- package/testeranto/projects.json +2 -1
- package/testeranto/reports/allTests/config.json +0 -64
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +2 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +11 -13
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +10 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +10 -18
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +25 -13
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +2 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +24 -12
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +2 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +49 -55
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +12 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +10 -18
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +24 -12
- package/testeranto/reports/allTests/summary.json +6 -62
- package/testeranto/reports/core/config.json +24 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +32 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +26 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +69 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +74 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +26 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +74 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +61 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +2 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +26 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +69 -0
- package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +74 -0
- package/testeranto/reports/core/summary.json +23 -0
- package/testeranto/reports/staticSite/config.json +24 -0
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/lint_errors.txt +5 -0
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/logs.txt +44 -0
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/message.txt +2 -0
- package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/prompt.txt +23 -0
- package/testeranto/reports/{allTests/src/lib/core.test/core.test → staticSite/src/ReportServer.test.ts/index}/node/type_errors.txt +21 -32
- package/testeranto/reports/staticSite/summary.json +9 -0
- package/testeranto/reportsnode_build_errors +17 -0
- package/testeranto.config.ts +37 -20
- package/testeranto/bundles/node/allTests/chunk-3EUGBAOM.mjs +0 -113
- package/testeranto/bundles/node/allTests/chunk-E75CSRER.mjs +0 -800
- package/testeranto/bundles/node/allTests/chunk-M6DO7VMB.mjs +0 -252
- package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +0 -323
- package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +0 -411
- package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +0 -528
- package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +0 -4650
- package/testeranto/bundles/pure/allTests/chunk-KHDVEHF7.mjs +0 -185
- package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +0 -429
- package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +0 -425
- package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +0 -2283
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +0 -19
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +0 -37524
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.html +0 -19
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +0 -440
- package/testeranto/reports/allTests/src/Pure.test/pure/lint_errors.txt +0 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/message.txt +0 -2
- package/testeranto/reports/allTests/src/Pure.test/pure/prompt.txt +0 -13
- package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +0 -101
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +0 -13
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +0 -50
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +0 -2
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +0 -17
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +0 -32
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +0 -68
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +0 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +0 -52
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/prompt.txt +0 -13
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +0 -31
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +0 -111
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +0 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +0 -14
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +0 -31
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +0 -111
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +0 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +0 -108
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +0 -14
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +0 -31
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +0 -111
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/lint_errors.txt +0 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +0 -700
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/prompt.txt +0 -16
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +0 -164
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +0 -138
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/lint_errors.txt +0 -21
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +0 -7
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/prompt.txt +0 -18
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/bdd_errors.txt +0 -1
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/lint_errors.txt +0 -20
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +0 -31
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/message.txt +0 -2
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/prompt.txt +0 -16
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +0 -134
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +0 -76
- package/testeranto/reportsweb_build_errors +0 -25
- /package/testeranto/reports/{allTests/src/components/pure/ProjectPageView.test/index/web → core/src/lib/baseBuilder.test/baseBuilder.test.node/node}/bdd_errors.txt +0 -0
- /package/testeranto/reports/{allTests/src/lib/BaseSuite.test/node.test/node → core/src/lib/baseBuilder.test/baseBuilder.test.web/web}/bdd_errors.txt +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
defaultTestResourceRequirement
|
|
7
|
-
} from "../../../chunk-VMUSFSZM.mjs";
|
|
2
|
+
|
|
3
|
+
// src/PM/index.ts
|
|
4
|
+
var PM = class {
|
|
5
|
+
};
|
|
8
6
|
|
|
9
7
|
// src/PM/web.ts
|
|
10
8
|
var PM_Web = class extends PM {
|
|
@@ -82,8 +80,6 @@ var PM_Web = class extends PM {
|
|
|
82
80
|
customScreenShot(x, y) {
|
|
83
81
|
const opts2 = x[0];
|
|
84
82
|
const page2 = x[1];
|
|
85
|
-
console.log("customScreenShot 2 opts", opts2);
|
|
86
|
-
console.log("customScreenShot 2 page", page2);
|
|
87
83
|
return window["customScreenShot"](
|
|
88
84
|
{
|
|
89
85
|
...opts2,
|
|
@@ -102,7 +98,7 @@ var PM_Web = class extends PM {
|
|
|
102
98
|
write(uid, contents) {
|
|
103
99
|
return window["write"](uid, contents);
|
|
104
100
|
}
|
|
105
|
-
writeFileSync(filepath, contents) {
|
|
101
|
+
writeFileSync([filepath, contents]) {
|
|
106
102
|
return window["writeFileSync"](
|
|
107
103
|
this.testResourceConfiguration.fs + "/" + filepath,
|
|
108
104
|
contents,
|
|
@@ -135,6 +131,714 @@ var PM_Web = class extends PM {
|
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
133
|
|
|
134
|
+
// src/lib/index.ts
|
|
135
|
+
var BaseAdapter = () => ({
|
|
136
|
+
beforeAll: async (s) => s,
|
|
137
|
+
beforeEach: async function(subject, initialValues, x, testResource, pm) {
|
|
138
|
+
return subject;
|
|
139
|
+
},
|
|
140
|
+
afterEach: async (s) => s,
|
|
141
|
+
afterAll: (store) => void 0,
|
|
142
|
+
butThen: async (store, thenCb) => {
|
|
143
|
+
return thenCb(store);
|
|
144
|
+
},
|
|
145
|
+
andWhen: async (store, whenCB, testResource, pm) => {
|
|
146
|
+
try {
|
|
147
|
+
await whenCB(store, testResource, pm);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error("Error in andWhen:", error);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
assertThis: (x) => x
|
|
154
|
+
});
|
|
155
|
+
var DefaultAdapter = (p) => {
|
|
156
|
+
return {
|
|
157
|
+
...BaseAdapter,
|
|
158
|
+
...p
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
var defaultTestResourceRequirement = {
|
|
162
|
+
ports: 0
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// src/lib/pmProxy.ts
|
|
166
|
+
var baseProxy = function(pm, mappings) {
|
|
167
|
+
return new Proxy(pm, {
|
|
168
|
+
get: (target, prop, receiver) => {
|
|
169
|
+
for (const mapping of mappings) {
|
|
170
|
+
const method = mapping[0];
|
|
171
|
+
const arger = mapping[1];
|
|
172
|
+
if (prop === method) {
|
|
173
|
+
return (...x) => target[prop](arger(...x));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return (...x) => target[prop](...x);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
var butThenProxy = (pm, filepath) => {
|
|
181
|
+
return baseProxy(pm, [
|
|
182
|
+
[
|
|
183
|
+
"screencast",
|
|
184
|
+
(opts2, p) => {
|
|
185
|
+
const path = `${filepath}/butThen/${opts2.path}`;
|
|
186
|
+
pm.currentStep?.artifacts?.push(path);
|
|
187
|
+
return [
|
|
188
|
+
{
|
|
189
|
+
...opts2,
|
|
190
|
+
path
|
|
191
|
+
},
|
|
192
|
+
p
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"createWriteStream",
|
|
198
|
+
(fp) => {
|
|
199
|
+
const path = `${filepath}/butThen/${fp}`;
|
|
200
|
+
pm.currentStep?.artifacts?.push(path);
|
|
201
|
+
return [path];
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
[
|
|
205
|
+
"writeFileSync",
|
|
206
|
+
(fp, contents) => {
|
|
207
|
+
const path = `${filepath}/butThen/${fp}`;
|
|
208
|
+
pm.currentStep?.artifacts?.push(path);
|
|
209
|
+
return [path, contents];
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
"customScreenShot",
|
|
214
|
+
(opts2, p) => {
|
|
215
|
+
const path = `${filepath}/butThen/${opts2.path}`;
|
|
216
|
+
pm.currentStep?.artifacts?.push(path);
|
|
217
|
+
return [
|
|
218
|
+
{
|
|
219
|
+
...opts2,
|
|
220
|
+
path
|
|
221
|
+
},
|
|
222
|
+
p
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
]);
|
|
227
|
+
};
|
|
228
|
+
var andWhenProxy = (pm, filepath) => baseProxy(pm, [
|
|
229
|
+
[
|
|
230
|
+
"screencast",
|
|
231
|
+
(opts2, p) => [
|
|
232
|
+
{
|
|
233
|
+
...opts2,
|
|
234
|
+
path: `${filepath}/andWhen/${opts2.path}`
|
|
235
|
+
},
|
|
236
|
+
p
|
|
237
|
+
]
|
|
238
|
+
],
|
|
239
|
+
["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
|
|
240
|
+
["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
|
|
241
|
+
[
|
|
242
|
+
"customScreenShot",
|
|
243
|
+
(opts2, p) => [
|
|
244
|
+
{
|
|
245
|
+
...opts2,
|
|
246
|
+
path: `${filepath}/andWhen${opts2.path}`
|
|
247
|
+
},
|
|
248
|
+
p
|
|
249
|
+
]
|
|
250
|
+
]
|
|
251
|
+
]);
|
|
252
|
+
var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
|
|
253
|
+
[
|
|
254
|
+
"screencast",
|
|
255
|
+
(opts2, p) => [
|
|
256
|
+
{
|
|
257
|
+
...opts2,
|
|
258
|
+
path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
|
|
259
|
+
},
|
|
260
|
+
p
|
|
261
|
+
]
|
|
262
|
+
],
|
|
263
|
+
["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
|
|
264
|
+
[
|
|
265
|
+
"writeFileSync",
|
|
266
|
+
(fp, contents) => [
|
|
267
|
+
`suite-${suite}/given-${given}/afterEach/${fp}`,
|
|
268
|
+
contents
|
|
269
|
+
]
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"customScreenShot",
|
|
273
|
+
(opts2, p) => [
|
|
274
|
+
{
|
|
275
|
+
...opts2,
|
|
276
|
+
path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
|
|
277
|
+
},
|
|
278
|
+
p
|
|
279
|
+
]
|
|
280
|
+
]
|
|
281
|
+
]);
|
|
282
|
+
var beforeEachProxy = (pm, suite) => baseProxy(pm, [
|
|
283
|
+
[
|
|
284
|
+
"screencast",
|
|
285
|
+
(opts2, p) => [
|
|
286
|
+
{
|
|
287
|
+
...opts2,
|
|
288
|
+
path: `suite-${suite}/beforeEach/${opts2.path}`
|
|
289
|
+
},
|
|
290
|
+
p
|
|
291
|
+
]
|
|
292
|
+
],
|
|
293
|
+
[
|
|
294
|
+
"writeFileSync",
|
|
295
|
+
(fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
"customScreenShot",
|
|
299
|
+
(opts2, p) => [
|
|
300
|
+
{
|
|
301
|
+
...opts2,
|
|
302
|
+
path: `suite-${suite}/beforeEach/${opts2.path}`
|
|
303
|
+
},
|
|
304
|
+
p
|
|
305
|
+
]
|
|
306
|
+
],
|
|
307
|
+
["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
|
|
308
|
+
]);
|
|
309
|
+
var beforeAllProxy = (pm, suite) => baseProxy(pm, [
|
|
310
|
+
[
|
|
311
|
+
"writeFileSync",
|
|
312
|
+
(fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
|
|
313
|
+
],
|
|
314
|
+
[
|
|
315
|
+
"customScreenShot",
|
|
316
|
+
(opts2, p) => [
|
|
317
|
+
{
|
|
318
|
+
...opts2,
|
|
319
|
+
path: `suite-${suite}/beforeAll/${opts2.path}`
|
|
320
|
+
},
|
|
321
|
+
p
|
|
322
|
+
]
|
|
323
|
+
],
|
|
324
|
+
["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
|
|
325
|
+
]);
|
|
326
|
+
var afterAllProxy = (pm, suite) => baseProxy(pm, [
|
|
327
|
+
["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
|
|
328
|
+
[
|
|
329
|
+
"writeFileSync",
|
|
330
|
+
(fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
|
|
331
|
+
],
|
|
332
|
+
[
|
|
333
|
+
"customScreenShot",
|
|
334
|
+
(opts2, p) => [
|
|
335
|
+
{
|
|
336
|
+
...opts2,
|
|
337
|
+
path: `suite-${suite}/afterAll/${opts2.path}`
|
|
338
|
+
},
|
|
339
|
+
p
|
|
340
|
+
]
|
|
341
|
+
]
|
|
342
|
+
]);
|
|
343
|
+
|
|
344
|
+
// src/lib/abstractBase.ts
|
|
345
|
+
var BaseGiven = class {
|
|
346
|
+
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
347
|
+
this.artifacts = [];
|
|
348
|
+
this.name = name;
|
|
349
|
+
this.features = features;
|
|
350
|
+
this.whens = whens;
|
|
351
|
+
this.thens = thens;
|
|
352
|
+
this.givenCB = givenCB;
|
|
353
|
+
this.initialValues = initialValues;
|
|
354
|
+
}
|
|
355
|
+
addArtifact(path) {
|
|
356
|
+
console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
|
|
357
|
+
this.artifacts.push(path);
|
|
358
|
+
}
|
|
359
|
+
beforeAll(store) {
|
|
360
|
+
return store;
|
|
361
|
+
}
|
|
362
|
+
toObj() {
|
|
363
|
+
return {
|
|
364
|
+
key: this.key,
|
|
365
|
+
name: this.name,
|
|
366
|
+
whens: this.whens.map((w) => {
|
|
367
|
+
if (w && w.toObj)
|
|
368
|
+
return w.toObj();
|
|
369
|
+
console.error("w is not as expected!", w.toString());
|
|
370
|
+
return {};
|
|
371
|
+
}),
|
|
372
|
+
thens: this.thens.map((t) => t.toObj()),
|
|
373
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
374
|
+
failed: this.failed,
|
|
375
|
+
features: this.features,
|
|
376
|
+
artifacts: this.artifacts
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
async afterEach(store, key, artifactory, pm) {
|
|
380
|
+
return store;
|
|
381
|
+
}
|
|
382
|
+
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
383
|
+
this.key = key;
|
|
384
|
+
tLog(`
|
|
385
|
+
${this.key}`);
|
|
386
|
+
tLog(`
|
|
387
|
+
Given: ${this.name}`);
|
|
388
|
+
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
389
|
+
this.uberCatcher((e) => {
|
|
390
|
+
console.error(e.toString());
|
|
391
|
+
this.error = e.error;
|
|
392
|
+
tLog(e.stack);
|
|
393
|
+
});
|
|
394
|
+
try {
|
|
395
|
+
const proxiedPm = beforeEachProxy(pm, suiteNdx.toString());
|
|
396
|
+
console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
|
|
397
|
+
proxiedPm.currentStep = this;
|
|
398
|
+
this.store = await this.givenThat(
|
|
399
|
+
subject,
|
|
400
|
+
testResourceConfiguration,
|
|
401
|
+
givenArtifactory,
|
|
402
|
+
this.givenCB,
|
|
403
|
+
this.initialValues,
|
|
404
|
+
proxiedPm
|
|
405
|
+
);
|
|
406
|
+
} catch (e) {
|
|
407
|
+
console.error("Given failure: ", e.toString());
|
|
408
|
+
this.error = e;
|
|
409
|
+
throw e;
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
413
|
+
await whenStep.test(
|
|
414
|
+
this.store,
|
|
415
|
+
testResourceConfiguration,
|
|
416
|
+
tLog,
|
|
417
|
+
pm,
|
|
418
|
+
`suite-${suiteNdx}/given-${key}/when/${whenNdx}`
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
422
|
+
const t = await thenStep.test(
|
|
423
|
+
this.store,
|
|
424
|
+
testResourceConfiguration,
|
|
425
|
+
tLog,
|
|
426
|
+
pm,
|
|
427
|
+
`suite-${suiteNdx}/given-${key}/then-${thenNdx}`
|
|
428
|
+
);
|
|
429
|
+
tester(t);
|
|
430
|
+
}
|
|
431
|
+
} catch (e) {
|
|
432
|
+
this.failed = true;
|
|
433
|
+
tLog(e.stack);
|
|
434
|
+
throw e;
|
|
435
|
+
} finally {
|
|
436
|
+
try {
|
|
437
|
+
await this.afterEach(
|
|
438
|
+
this.store,
|
|
439
|
+
this.key,
|
|
440
|
+
givenArtifactory,
|
|
441
|
+
afterEachProxy(pm, suiteNdx.toString(), key)
|
|
442
|
+
);
|
|
443
|
+
} catch (e) {
|
|
444
|
+
console.error("afterEach failed!", e.toString());
|
|
445
|
+
this.failed = e;
|
|
446
|
+
throw e;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return this.store;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
var BaseWhen = class {
|
|
453
|
+
constructor(name, whenCB) {
|
|
454
|
+
this.artifacts = [];
|
|
455
|
+
this.name = name;
|
|
456
|
+
this.whenCB = whenCB;
|
|
457
|
+
}
|
|
458
|
+
toObj() {
|
|
459
|
+
console.log("toObj error", this.error);
|
|
460
|
+
if (this.error) {
|
|
461
|
+
return {
|
|
462
|
+
name: this.name,
|
|
463
|
+
error: this.error && this.error.name + this.error.stack,
|
|
464
|
+
artifacts: this.artifacts
|
|
465
|
+
};
|
|
466
|
+
} else {
|
|
467
|
+
return {
|
|
468
|
+
name: this.name,
|
|
469
|
+
artifacts: this.artifacts
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
474
|
+
try {
|
|
475
|
+
tLog(" When:", this.name);
|
|
476
|
+
console.debug("[DEBUG] Executing When step:", this.name.toString());
|
|
477
|
+
const proxiedPm = andWhenProxy(pm, filepath);
|
|
478
|
+
console.log(`[When] Setting currentStep for andWhen:`, this.name);
|
|
479
|
+
proxiedPm.currentStep = this;
|
|
480
|
+
const result = await this.andWhen(
|
|
481
|
+
store,
|
|
482
|
+
this.whenCB,
|
|
483
|
+
testResourceConfiguration,
|
|
484
|
+
proxiedPm
|
|
485
|
+
);
|
|
486
|
+
console.debug("[DEBUG] When step completed:", this.name.toString());
|
|
487
|
+
return result;
|
|
488
|
+
} catch (e) {
|
|
489
|
+
console.error(
|
|
490
|
+
"[ERROR] When step failed:",
|
|
491
|
+
this.name.toString(),
|
|
492
|
+
e.toString()
|
|
493
|
+
);
|
|
494
|
+
this.error = e;
|
|
495
|
+
throw e;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
var BaseThen = class {
|
|
500
|
+
constructor(name, thenCB) {
|
|
501
|
+
this.artifacts = [];
|
|
502
|
+
this.name = name;
|
|
503
|
+
this.thenCB = thenCB;
|
|
504
|
+
this.error = false;
|
|
505
|
+
}
|
|
506
|
+
toObj() {
|
|
507
|
+
return {
|
|
508
|
+
name: this.name,
|
|
509
|
+
error: this.error,
|
|
510
|
+
artifacts: this.artifacts
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
514
|
+
const proxiedPm = butThenProxy(pm, filepath);
|
|
515
|
+
console.log(`[Then] Setting currentStep for butThen:`, this.name);
|
|
516
|
+
proxiedPm.currentStep = this;
|
|
517
|
+
return this.butThen(
|
|
518
|
+
store,
|
|
519
|
+
async (s) => {
|
|
520
|
+
if (typeof this.thenCB === "function") {
|
|
521
|
+
return await this.thenCB(s, proxiedPm);
|
|
522
|
+
} else {
|
|
523
|
+
return this.thenCB;
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
testResourceConfiguration,
|
|
527
|
+
butThenProxy(pm, filepath)
|
|
528
|
+
).catch((e) => {
|
|
529
|
+
this.error = e.toString();
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
// src/lib/basebuilder.ts
|
|
535
|
+
var BaseBuilder = class {
|
|
536
|
+
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
|
|
537
|
+
this.artifacts = [];
|
|
538
|
+
this.artifacts = [];
|
|
539
|
+
this.testResourceRequirement = testResourceRequirement;
|
|
540
|
+
this.suitesOverrides = suitesOverrides;
|
|
541
|
+
this.givenOverides = givenOverides;
|
|
542
|
+
this.whenOverides = whenOverides;
|
|
543
|
+
this.thenOverides = thenOverides;
|
|
544
|
+
this.testSpecification = testSpecification;
|
|
545
|
+
this.specs = testSpecification(
|
|
546
|
+
this.Suites(),
|
|
547
|
+
this.Given(),
|
|
548
|
+
this.When(),
|
|
549
|
+
this.Then()
|
|
550
|
+
);
|
|
551
|
+
this.testJobs = this.specs.map((suite) => {
|
|
552
|
+
const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
|
|
553
|
+
const x = await suite2.run(
|
|
554
|
+
input,
|
|
555
|
+
puppetMaster.testResourceConfiguration,
|
|
556
|
+
(fPath, value) => puppetMaster.testArtiFactoryfileWriter(
|
|
557
|
+
tLog,
|
|
558
|
+
(p) => {
|
|
559
|
+
this.artifacts.push(p);
|
|
560
|
+
}
|
|
561
|
+
)(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
|
|
562
|
+
tLog,
|
|
563
|
+
puppetMaster
|
|
564
|
+
);
|
|
565
|
+
return x;
|
|
566
|
+
};
|
|
567
|
+
const runner = suiteRunner(suite);
|
|
568
|
+
return {
|
|
569
|
+
test: suite,
|
|
570
|
+
toObj: () => {
|
|
571
|
+
return suite.toObj();
|
|
572
|
+
},
|
|
573
|
+
runner,
|
|
574
|
+
receiveTestResourceConfig: async function(puppetMaster) {
|
|
575
|
+
const tLog = async (...l) => {
|
|
576
|
+
};
|
|
577
|
+
const suiteDone = await runner(puppetMaster, tLog);
|
|
578
|
+
const fails = suiteDone.fails;
|
|
579
|
+
await puppetMaster.writeFileSync([
|
|
580
|
+
`bdd_errors.txt`,
|
|
581
|
+
fails.toString()
|
|
582
|
+
]);
|
|
583
|
+
await puppetMaster.writeFileSync([
|
|
584
|
+
`tests.json`,
|
|
585
|
+
JSON.stringify(this.toObj(), null, 2)
|
|
586
|
+
]);
|
|
587
|
+
return {
|
|
588
|
+
failed: fails > 0,
|
|
589
|
+
fails,
|
|
590
|
+
artifacts: this.artifacts || [],
|
|
591
|
+
// logPromise,
|
|
592
|
+
features: suiteDone.features()
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
// testsJson() {
|
|
599
|
+
// puppetMaster.writeFileSync(
|
|
600
|
+
// `tests.json`,
|
|
601
|
+
// JSON.stringify({ features: suiteDone.features() }, null, 2)
|
|
602
|
+
// );
|
|
603
|
+
// }
|
|
604
|
+
Specs() {
|
|
605
|
+
return this.specs;
|
|
606
|
+
}
|
|
607
|
+
Suites() {
|
|
608
|
+
return this.suitesOverrides;
|
|
609
|
+
}
|
|
610
|
+
Given() {
|
|
611
|
+
return this.givenOverides;
|
|
612
|
+
}
|
|
613
|
+
When() {
|
|
614
|
+
return this.whenOverides;
|
|
615
|
+
}
|
|
616
|
+
Then() {
|
|
617
|
+
return this.thenOverides;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
// src/lib/classBuilder.ts
|
|
622
|
+
var ClassBuilder = class extends BaseBuilder {
|
|
623
|
+
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
|
|
624
|
+
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
625
|
+
(a, [key], index) => {
|
|
626
|
+
a[key] = (somestring, givens) => {
|
|
627
|
+
return new suiteKlasser.prototype.constructor(
|
|
628
|
+
somestring,
|
|
629
|
+
index,
|
|
630
|
+
givens
|
|
631
|
+
);
|
|
632
|
+
};
|
|
633
|
+
return a;
|
|
634
|
+
},
|
|
635
|
+
{}
|
|
636
|
+
);
|
|
637
|
+
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
638
|
+
(a, [key, g]) => {
|
|
639
|
+
a[key] = (features, whens, thens, ...initialValues) => {
|
|
640
|
+
return new givenKlasser.prototype.constructor(
|
|
641
|
+
key,
|
|
642
|
+
features,
|
|
643
|
+
whens,
|
|
644
|
+
thens,
|
|
645
|
+
testImplementation.givens[key],
|
|
646
|
+
initialValues
|
|
647
|
+
);
|
|
648
|
+
};
|
|
649
|
+
return a;
|
|
650
|
+
},
|
|
651
|
+
{}
|
|
652
|
+
);
|
|
653
|
+
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
654
|
+
(a, [key, whEn]) => {
|
|
655
|
+
a[key] = (...payload) => {
|
|
656
|
+
return new whenKlasser.prototype.constructor(
|
|
657
|
+
`${whEn.name}: ${payload && payload.toString()}`,
|
|
658
|
+
whEn(...payload)
|
|
659
|
+
);
|
|
660
|
+
};
|
|
661
|
+
return a;
|
|
662
|
+
},
|
|
663
|
+
{}
|
|
664
|
+
);
|
|
665
|
+
const classyThens = Object.entries(
|
|
666
|
+
testImplementation.thens
|
|
667
|
+
).reduce(
|
|
668
|
+
(a, [key, thEn]) => {
|
|
669
|
+
a[key] = (expected, ...x) => {
|
|
670
|
+
return new thenKlasser.prototype.constructor(
|
|
671
|
+
`${thEn.name}: ${expected && expected.toString()}`,
|
|
672
|
+
thEn(expected, ...x)
|
|
673
|
+
);
|
|
674
|
+
};
|
|
675
|
+
return a;
|
|
676
|
+
},
|
|
677
|
+
{}
|
|
678
|
+
);
|
|
679
|
+
super(
|
|
680
|
+
input,
|
|
681
|
+
classySuites,
|
|
682
|
+
classyGivens,
|
|
683
|
+
classyWhens,
|
|
684
|
+
classyThens,
|
|
685
|
+
testResourceRequirement,
|
|
686
|
+
testSpecification
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// src/lib/BaseSuite.ts
|
|
692
|
+
var BaseSuite = class {
|
|
693
|
+
constructor(name, index, givens = {}) {
|
|
694
|
+
const suiteName = name || "testSuite";
|
|
695
|
+
if (!suiteName) {
|
|
696
|
+
throw new Error("BaseSuite requires a non-empty name");
|
|
697
|
+
}
|
|
698
|
+
console.log(
|
|
699
|
+
"[DEBUG] BaseSuite constructor - name:",
|
|
700
|
+
suiteName,
|
|
701
|
+
"index:",
|
|
702
|
+
index
|
|
703
|
+
);
|
|
704
|
+
this.name = suiteName;
|
|
705
|
+
this.index = index;
|
|
706
|
+
this.givens = givens;
|
|
707
|
+
this.fails = 0;
|
|
708
|
+
console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
|
|
709
|
+
console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
|
|
710
|
+
}
|
|
711
|
+
features() {
|
|
712
|
+
try {
|
|
713
|
+
const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
|
|
714
|
+
return array.indexOf(value) === index;
|
|
715
|
+
});
|
|
716
|
+
console.debug("[DEBUG] Features extracted:", features.toString());
|
|
717
|
+
return features || [];
|
|
718
|
+
} catch (e) {
|
|
719
|
+
console.error("[ERROR] Failed to extract features:", e);
|
|
720
|
+
return [];
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
toObj() {
|
|
724
|
+
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
725
|
+
return {
|
|
726
|
+
name: this.name,
|
|
727
|
+
givens,
|
|
728
|
+
fails: this.fails,
|
|
729
|
+
failed: this.failed,
|
|
730
|
+
features: this.features()
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
setup(s, artifactory, tr, pm) {
|
|
734
|
+
return new Promise((res) => res(s));
|
|
735
|
+
}
|
|
736
|
+
assertThat(t) {
|
|
737
|
+
return !!t;
|
|
738
|
+
}
|
|
739
|
+
afterAll(store, artifactory, pm) {
|
|
740
|
+
return store;
|
|
741
|
+
}
|
|
742
|
+
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
743
|
+
this.testResourceConfiguration = testResourceConfiguration;
|
|
744
|
+
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
745
|
+
tLog("\nSuite:", this.index, this.name);
|
|
746
|
+
const sNdx = this.index;
|
|
747
|
+
const subject = await this.setup(
|
|
748
|
+
input,
|
|
749
|
+
suiteArtifactory,
|
|
750
|
+
testResourceConfiguration,
|
|
751
|
+
beforeAllProxy(pm, sNdx.toString())
|
|
752
|
+
);
|
|
753
|
+
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
754
|
+
const giver = this.givens[gKey];
|
|
755
|
+
this.store = await giver.give(
|
|
756
|
+
subject,
|
|
757
|
+
gKey,
|
|
758
|
+
testResourceConfiguration,
|
|
759
|
+
this.assertThat,
|
|
760
|
+
suiteArtifactory,
|
|
761
|
+
tLog,
|
|
762
|
+
pm,
|
|
763
|
+
sNdx
|
|
764
|
+
).catch((e) => {
|
|
765
|
+
this.failed = true;
|
|
766
|
+
this.fails = this.fails + 1;
|
|
767
|
+
throw e;
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
this.afterAll(
|
|
772
|
+
this.store,
|
|
773
|
+
artifactory,
|
|
774
|
+
afterAllProxy(pm, sNdx.toString())
|
|
775
|
+
);
|
|
776
|
+
} catch (e) {
|
|
777
|
+
console.error(e);
|
|
778
|
+
}
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// src/lib/core.ts
|
|
784
|
+
var TesterantoCore = class extends ClassBuilder {
|
|
785
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter2, uberCatcher) {
|
|
786
|
+
const fullAdapter = DefaultAdapter(testAdapter2);
|
|
787
|
+
super(
|
|
788
|
+
testImplementation,
|
|
789
|
+
testSpecification,
|
|
790
|
+
input,
|
|
791
|
+
class extends BaseSuite {
|
|
792
|
+
afterAll(store, artifactory, pm) {
|
|
793
|
+
return fullAdapter.afterAll(store, pm);
|
|
794
|
+
}
|
|
795
|
+
assertThat(t) {
|
|
796
|
+
return fullAdapter.assertThis(t);
|
|
797
|
+
}
|
|
798
|
+
async setup(s, artifactory, tr, pm) {
|
|
799
|
+
return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
|
|
800
|
+
s,
|
|
801
|
+
this.testResourceConfiguration,
|
|
802
|
+
// artifactory,
|
|
803
|
+
pm
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
class Given extends BaseGiven {
|
|
808
|
+
constructor() {
|
|
809
|
+
super(...arguments);
|
|
810
|
+
this.uberCatcher = uberCatcher;
|
|
811
|
+
}
|
|
812
|
+
async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
|
|
813
|
+
return fullAdapter.beforeEach(
|
|
814
|
+
subject,
|
|
815
|
+
initializer,
|
|
816
|
+
testResource,
|
|
817
|
+
initialValues,
|
|
818
|
+
pm
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
afterEach(store, key, artifactory, pm) {
|
|
822
|
+
return new Promise(
|
|
823
|
+
(res) => res(fullAdapter.afterEach(store, key, pm))
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
class When extends BaseWhen {
|
|
828
|
+
async andWhen(store, whenCB, testResource, pm) {
|
|
829
|
+
return await fullAdapter.andWhen(store, whenCB, testResource, pm);
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
class Then extends BaseThen {
|
|
833
|
+
async butThen(store, thenCB, testResource, pm) {
|
|
834
|
+
return await fullAdapter.butThen(store, thenCB, testResource, pm);
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
testResourceRequirement
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
|
|
138
842
|
// src/Web.ts
|
|
139
843
|
var WebTesteranto = class extends TesterantoCore {
|
|
140
844
|
constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter2) {
|
|
@@ -168,25 +872,25 @@ var Web_default = async (input, testSpecification, testImplementation, testAdapt
|
|
|
168
872
|
var specification = (Suite, Given, When, Then) => {
|
|
169
873
|
return [
|
|
170
874
|
Suite.Default("Testing BaseBuilder functionality", {
|
|
171
|
-
testInitialization: Given
|
|
875
|
+
testInitialization: Given["the default BaseBuilder"](
|
|
172
876
|
["BaseBuilder should initialize correctly"],
|
|
173
877
|
[],
|
|
174
878
|
[
|
|
175
|
-
Then
|
|
176
|
-
Then
|
|
177
|
-
Then
|
|
178
|
-
Then
|
|
879
|
+
Then["it is initialized"](),
|
|
880
|
+
Then["it tracks artifacts"]()
|
|
881
|
+
// Then["it creates jobs"](),
|
|
882
|
+
// Then["it generates TestSpecifications"](),
|
|
179
883
|
]
|
|
180
884
|
),
|
|
181
|
-
testSpecsGeneration: Given
|
|
885
|
+
testSpecsGeneration: Given["the default BaseBuilder"](
|
|
182
886
|
["BaseBuilder should generate specs from test specification"],
|
|
183
887
|
[],
|
|
184
|
-
[Then
|
|
888
|
+
[Then["it generates TestSpecifications"]()]
|
|
185
889
|
),
|
|
186
|
-
testJobsCreation: Given
|
|
890
|
+
testJobsCreation: Given["the default BaseBuilder"](
|
|
187
891
|
["BaseBuilder should create test jobs"],
|
|
188
892
|
[],
|
|
189
|
-
[Then
|
|
893
|
+
[Then["it creates jobs"]()]
|
|
190
894
|
)
|
|
191
895
|
})
|
|
192
896
|
];
|
|
@@ -235,7 +939,7 @@ var implementation = {
|
|
|
235
939
|
Default: "BaseBuilder test suite"
|
|
236
940
|
},
|
|
237
941
|
givens: {
|
|
238
|
-
|
|
942
|
+
"the default BaseBuilder": () => {
|
|
239
943
|
return new MockBaseBuilder(
|
|
240
944
|
{},
|
|
241
945
|
// input
|
|
@@ -253,11 +957,19 @@ var implementation = {
|
|
|
253
957
|
// testSpecification
|
|
254
958
|
);
|
|
255
959
|
},
|
|
256
|
-
|
|
257
|
-
return new MockBaseBuilder(
|
|
960
|
+
"a BaseBuilder with TestInput": (input) => {
|
|
961
|
+
return new MockBaseBuilder(
|
|
962
|
+
input,
|
|
963
|
+
{},
|
|
964
|
+
{},
|
|
965
|
+
{},
|
|
966
|
+
{},
|
|
967
|
+
{ ports: [] },
|
|
968
|
+
() => []
|
|
969
|
+
);
|
|
258
970
|
},
|
|
259
|
-
|
|
260
|
-
return new MockBaseBuilder({}, {}, {}, {}, {},
|
|
971
|
+
"a BaseBuilder with Test Resource Requirements": (requirements) => {
|
|
972
|
+
return new MockBaseBuilder({}, {}, {}, {}, {}, requirements, () => []);
|
|
261
973
|
}
|
|
262
974
|
},
|
|
263
975
|
whens: {
|
|
@@ -271,7 +983,8 @@ var implementation = {
|
|
|
271
983
|
}
|
|
272
984
|
},
|
|
273
985
|
thens: {
|
|
274
|
-
|
|
986
|
+
"it is initialized": () => (builder, utils) => {
|
|
987
|
+
utils.writeFileSync("hello.txt", "world");
|
|
275
988
|
if (!(builder instanceof BaseBuilder)) {
|
|
276
989
|
console.error("Builder instance:", builder);
|
|
277
990
|
throw new Error(
|
|
@@ -293,19 +1006,19 @@ var implementation = {
|
|
|
293
1006
|
});
|
|
294
1007
|
return builder;
|
|
295
1008
|
},
|
|
296
|
-
|
|
1009
|
+
"it generates TestSpecifications": () => (builder) => {
|
|
297
1010
|
if (!Array.isArray(builder.specs)) {
|
|
298
1011
|
throw new Error("Specs were not generated");
|
|
299
1012
|
}
|
|
300
1013
|
return builder;
|
|
301
1014
|
},
|
|
302
|
-
|
|
1015
|
+
"it creates jobs": () => (builder) => {
|
|
303
1016
|
if (!Array.isArray(builder.testJobs)) {
|
|
304
1017
|
throw new Error("Test jobs were not created");
|
|
305
1018
|
}
|
|
306
1019
|
return builder;
|
|
307
1020
|
},
|
|
308
|
-
|
|
1021
|
+
"it tracks artifacts": () => (builder) => {
|
|
309
1022
|
if (!Array.isArray(builder.artifacts)) {
|
|
310
1023
|
throw new Error("Artifacts array not initialized");
|
|
311
1024
|
}
|