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