testeranto 0.167.0 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/src/NavBar.js +45 -0
- package/dist/common/src/PM/main.js +81 -59
- package/dist/common/src/Pure.js +16 -14
- package/dist/common/src/ReportServer.js +48 -5
- package/dist/common/src/Web.js +35 -20
- package/dist/common/src/components/SunriseAnimation.test/implementation.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/index.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/interface.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/specification.js +1 -0
- package/dist/common/src/components/TestStatusBadge.js +55 -0
- package/dist/common/src/components/pure/ProjectPageView.js +204 -0
- package/dist/common/src/components/pure/ProjectPageView.test/adapter.js +20 -0
- package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +71 -0
- package/dist/common/src/components/pure/ProjectPageView.test/index.js +10 -0
- package/dist/common/src/components/pure/ProjectPageView.test/specification.js +19 -0
- package/dist/common/src/components/pure/ProjectPageView.test/types.js +2 -0
- package/dist/common/src/lib/BaseSuite.js +3 -3
- package/dist/common/src/lib/BaseSuite.test/test.js +1 -1
- package/dist/common/src/lib/abstractBase.js +41 -14
- package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
- package/dist/common/src/lib/pmProxy.js +185 -64
- package/dist/common/testeranto.config.js +6 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/App.js +3 -3
- package/dist/module/src/PM/main.js +81 -59
- package/dist/module/src/ProjectsPage.js +1 -110
- package/dist/module/src/Pure.js +16 -14
- package/dist/module/src/ReportServer.js +48 -5
- package/dist/module/src/TestPage.js +45 -16
- package/dist/module/src/Web.js +35 -20
- package/dist/module/src/components/SunriseAnimation.test/implementation.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/index.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/interface.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/specification.js +1 -0
- package/dist/module/src/components/pure/ProjectPageView.js +197 -0
- package/dist/module/src/components/pure/ProjectPageView.test/adapter.js +17 -0
- package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +68 -0
- package/dist/module/src/components/pure/ProjectPageView.test/index.js +5 -0
- package/dist/module/src/components/pure/ProjectPageView.test/specification.js +15 -0
- package/dist/module/src/components/pure/ProjectPageView.test/types.js +1 -0
- package/dist/module/src/components/pure/ProjectsPageView.js +58 -0
- package/dist/module/src/components/pure/TestPageView.js +136 -0
- package/dist/module/src/components/stateful/ProjectPage.js +63 -0
- package/dist/module/src/components/stateful/ProjectsPage.js +55 -0
- package/dist/module/src/components/stateful/TestPage.js +82 -0
- package/dist/module/src/lib/BaseSuite.js +3 -3
- package/dist/module/src/lib/BaseSuite.test/test.js +1 -1
- package/dist/module/src/lib/abstractBase.js +41 -14
- package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
- package/dist/module/src/lib/pmProxy.js +185 -64
- package/dist/module/testeranto.config.js +6 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.css +13 -9
- package/dist/prebuild/App.js +600 -551
- package/dist/prebuild/ReportServer.mjs +44 -4
- package/dist/prebuild/run.mjs +67 -39
- package/dist/types/src/NavBar.d.ts +19 -0
- package/dist/types/src/PM/index.d.ts +3 -1
- package/dist/types/src/PM/main.d.ts +0 -4
- package/dist/types/src/PM/node.d.ts +2 -2
- package/dist/types/src/components/SunriseAnimation.test/interface.d.ts +0 -0
- package/dist/types/src/components/SunriseAnimation.test/specification.d.ts +0 -0
- package/dist/types/src/components/TestStatusBadge.d.ts +15 -0
- package/dist/types/src/components/pure/ProjectPageView.d.ts +14 -0
- package/dist/types/src/components/pure/ProjectPageView.test/adapter.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/implementation.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +2 -0
- package/dist/types/src/components/pure/ProjectPageView.test/specification.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/types.d.ts +39 -0
- package/dist/types/src/lib/BaseSuite.d.ts +2 -0
- package/dist/types/src/lib/abstractBase.d.ts +12 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/App.tsx +5 -9
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +87 -82
- package/src/PM/node.ts +2 -2
- package/src/ProjectsPage.tsx +1 -164
- package/src/Pure.ts +16 -16
- package/src/ReportServer.ts +49 -6
- package/src/TestPage.tsx +78 -5
- package/src/Web.ts +35 -35
- package/src/components/SunriseAnimation.test/implementation.ts +0 -0
- package/src/components/SunriseAnimation.test/index.ts +0 -0
- package/src/components/SunriseAnimation.test/interface.ts +0 -0
- package/src/components/SunriseAnimation.test/specification.ts +0 -0
- package/src/components/pure/ProjectPageView.test/adapter.ts +21 -0
- package/src/components/pure/ProjectPageView.test/implementation.tsx +84 -0
- package/src/components/pure/ProjectPageView.test/index.ts +8 -0
- package/src/components/pure/ProjectPageView.test/specification.ts +31 -0
- package/src/components/pure/ProjectPageView.test/types.ts +55 -0
- package/src/components/pure/ProjectPageView.tsx +332 -0
- package/src/components/pure/ProjectsPageView.tsx +99 -0
- package/src/components/pure/TestPageView.tsx +278 -0
- package/src/components/stateful/ProjectPage.tsx +83 -0
- package/src/components/stateful/ProjectsPage.tsx +73 -0
- package/src/components/stateful/TestPage.tsx +107 -0
- package/src/lib/BaseSuite.test/test.ts +1 -1
- package/src/lib/BaseSuite.ts +9 -4
- package/src/lib/abstractBase.ts +45 -14
- package/src/lib/baseBuilder.test/baseBuilder.test.adapter.ts +1 -1
- package/src/lib/pmProxy.ts +184 -87
- package/testeranto/App.css +13 -9
- package/testeranto/App.js +600 -551
- package/testeranto/bundles/node/allTests/{chunk-4ONUZRZ4.mjs → chunk-3EUGBAOM.mjs} +1 -1
- package/testeranto/bundles/node/allTests/{chunk-IDCUSTSM.mjs → chunk-E75CSRER.mjs} +246 -115
- package/testeranto/bundles/node/allTests/{chunk-NQEP7SN4.mjs → chunk-M6DO7VMB.mjs} +1 -1
- package/testeranto/bundles/node/allTests/metafile.json +37 -37
- package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +4 -4
- package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +3 -3
- package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +3 -3
- package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +2 -17
- package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +354 -252
- package/testeranto/bundles/pure/allTests/{chunk-5SBJWHSZ.mjs → chunk-KHDVEHF7.mjs} +2 -17
- package/testeranto/bundles/pure/allTests/{chunk-4ULDTZFU.mjs → chunk-VMUSFSZM.mjs} +246 -115
- package/testeranto/bundles/pure/allTests/metafile.json +72 -42
- package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +2 -2
- package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +3 -3
- package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +2 -29
- package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +2283 -0
- package/testeranto/bundles/web/allTests/{chunk-46E6YGGN.mjs → chunk-U7AW26HL.mjs} +292 -142
- package/testeranto/bundles/web/allTests/metafile.json +22 -943
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +19 -0
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +37524 -0
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +20 -2
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +26 -2
- package/testeranto/reports/allTests/config.json +8 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +9 -3
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/bdd_errors.txt +1 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +13 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +50 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +17 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +32 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +68 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +22 -39
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +9 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +66 -55
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +2 -2
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +16 -48
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +18 -9
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +62 -33
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +2 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +18 -9
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +37 -50
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +36 -18
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +2 -2
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +9 -3
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +28 -43
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +28 -14
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/summary.json +15 -8
- package/testeranto/reportsnode_build_errors +20 -0
- package/testeranto/reportspure_build_errors +343 -0
- package/testeranto/reportsweb_build_errors +25 -0
- package/testeranto.config.ts +7 -0
- package/tsc.log +100 -26
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/testeranto/bundles/node/allTests/chunk-FFBRDUBH.mjs +0 -677
- package/testeranto/bundles/node/allTests/chunk-H2IBV7SY.mjs +0 -113
- package/testeranto/bundles/node/allTests/chunk-ZHOULXPN.mjs +0 -252
- package/testeranto/bundles/pure/allTests/chunk-CSMXYJ65.mjs +0 -200
- package/testeranto/bundles/pure/allTests/chunk-QK4IXLF6.mjs +0 -674
- package/testeranto/bundles/web/allTests/chunk-TU3MJSSI.mjs +0 -855
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test/manifest.json +0 -1
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/manifest.json +0 -1
- package/testeranto/reports/allTests/src/Pure.test/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/manifest.json +0 -1
- /package/{testeranto/reports/allTests/src/Pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/implementation.d.ts} +0 -0
- /package/{testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/index.d.ts} +0 -0
|
@@ -1,674 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/lib/pmProxy.ts
|
|
4
|
-
var baseProxy = function(pm, mappings) {
|
|
5
|
-
return new Proxy(pm, {
|
|
6
|
-
get: (target, prop, receiver) => {
|
|
7
|
-
for (const mapping of mappings) {
|
|
8
|
-
const method = mapping[0];
|
|
9
|
-
const arger = mapping[1];
|
|
10
|
-
if (prop === method) {
|
|
11
|
-
return (...x) => target[prop](arger(...x));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return (...x) => target[prop](...x);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var butThenProxy = (pm, filepath) => baseProxy(pm, [
|
|
19
|
-
[
|
|
20
|
-
"screencast",
|
|
21
|
-
(opts, p) => [
|
|
22
|
-
{
|
|
23
|
-
...opts,
|
|
24
|
-
path: `${filepath}/butThen/${opts.path}`
|
|
25
|
-
},
|
|
26
|
-
p
|
|
27
|
-
]
|
|
28
|
-
],
|
|
29
|
-
["createWriteStream", (fp) => [`${filepath}/butThen/${fp}`]],
|
|
30
|
-
[
|
|
31
|
-
"writeFileSync",
|
|
32
|
-
(fp, contents) => [`${filepath}/butThen/${fp}`, contents]
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
"customScreenShot",
|
|
36
|
-
(opts, p) => [
|
|
37
|
-
{
|
|
38
|
-
...opts,
|
|
39
|
-
path: `${filepath}/butThen/${opts.path}`
|
|
40
|
-
},
|
|
41
|
-
p
|
|
42
|
-
]
|
|
43
|
-
]
|
|
44
|
-
]);
|
|
45
|
-
var andWhenProxy = (pm, filepath) => baseProxy(pm, [
|
|
46
|
-
[
|
|
47
|
-
"screencast",
|
|
48
|
-
(opts, p) => [
|
|
49
|
-
{
|
|
50
|
-
...opts,
|
|
51
|
-
path: `${filepath}/andWhen/${opts.path}`
|
|
52
|
-
},
|
|
53
|
-
p
|
|
54
|
-
]
|
|
55
|
-
],
|
|
56
|
-
["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
|
|
57
|
-
["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
|
|
58
|
-
[
|
|
59
|
-
"customScreenShot",
|
|
60
|
-
(opts, p) => [
|
|
61
|
-
{
|
|
62
|
-
...opts,
|
|
63
|
-
path: `${filepath}/andWhen${opts.path}`
|
|
64
|
-
},
|
|
65
|
-
p
|
|
66
|
-
]
|
|
67
|
-
]
|
|
68
|
-
]);
|
|
69
|
-
var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
|
|
70
|
-
[
|
|
71
|
-
"screencast",
|
|
72
|
-
(opts, p) => [
|
|
73
|
-
{
|
|
74
|
-
...opts,
|
|
75
|
-
path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
|
|
76
|
-
},
|
|
77
|
-
p
|
|
78
|
-
]
|
|
79
|
-
],
|
|
80
|
-
["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
|
|
81
|
-
[
|
|
82
|
-
"writeFileSync",
|
|
83
|
-
(fp, contents) => [
|
|
84
|
-
`suite-${suite}/given-${given}/afterEach/${fp}`,
|
|
85
|
-
contents
|
|
86
|
-
]
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
"customScreenShot",
|
|
90
|
-
(opts, p) => [
|
|
91
|
-
{
|
|
92
|
-
...opts,
|
|
93
|
-
path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
|
|
94
|
-
},
|
|
95
|
-
p
|
|
96
|
-
]
|
|
97
|
-
]
|
|
98
|
-
]);
|
|
99
|
-
var beforeEachProxy = (pm, suite) => baseProxy(pm, [
|
|
100
|
-
[
|
|
101
|
-
"screencast",
|
|
102
|
-
(opts, p) => [
|
|
103
|
-
{
|
|
104
|
-
...opts,
|
|
105
|
-
path: `suite-${suite}/beforeEach/${opts.path}`
|
|
106
|
-
},
|
|
107
|
-
p
|
|
108
|
-
]
|
|
109
|
-
],
|
|
110
|
-
[
|
|
111
|
-
"writeFileSync",
|
|
112
|
-
(fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
"customScreenShot",
|
|
116
|
-
(opts, p) => [
|
|
117
|
-
{
|
|
118
|
-
...opts,
|
|
119
|
-
path: `suite-${suite}/beforeEach/${opts.path}`
|
|
120
|
-
},
|
|
121
|
-
p
|
|
122
|
-
]
|
|
123
|
-
],
|
|
124
|
-
["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
|
|
125
|
-
]);
|
|
126
|
-
var beforeAllProxy = (pm, suite) => baseProxy(pm, [
|
|
127
|
-
[
|
|
128
|
-
"writeFileSync",
|
|
129
|
-
(fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
"customScreenShot",
|
|
133
|
-
(opts, p) => [
|
|
134
|
-
{
|
|
135
|
-
...opts,
|
|
136
|
-
path: `suite-${suite}/beforeAll/${opts.path}`
|
|
137
|
-
},
|
|
138
|
-
p
|
|
139
|
-
]
|
|
140
|
-
],
|
|
141
|
-
["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
|
|
142
|
-
]);
|
|
143
|
-
var afterAllProxy = (pm, suite) => baseProxy(pm, [
|
|
144
|
-
["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
|
|
145
|
-
[
|
|
146
|
-
"writeFileSync",
|
|
147
|
-
(fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
|
|
148
|
-
],
|
|
149
|
-
[
|
|
150
|
-
"customScreenShot",
|
|
151
|
-
(opts, p) => [
|
|
152
|
-
{
|
|
153
|
-
...opts,
|
|
154
|
-
path: `suite-${suite}/afterAll/${opts.path}`
|
|
155
|
-
},
|
|
156
|
-
p
|
|
157
|
-
]
|
|
158
|
-
]
|
|
159
|
-
]);
|
|
160
|
-
|
|
161
|
-
// src/lib/BaseSuite.ts
|
|
162
|
-
var BaseSuite = class {
|
|
163
|
-
constructor(name, index, givens = {}) {
|
|
164
|
-
const suiteName = name || "testSuite";
|
|
165
|
-
if (!suiteName) {
|
|
166
|
-
throw new Error("BaseSuite requires a non-empty name");
|
|
167
|
-
}
|
|
168
|
-
console.log("[DEBUG] BaseSuite constructor - name:", suiteName, "index:", index);
|
|
169
|
-
this.name = suiteName;
|
|
170
|
-
this.index = index;
|
|
171
|
-
this.givens = givens;
|
|
172
|
-
this.fails = 0;
|
|
173
|
-
console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
|
|
174
|
-
console.log("[DEBUG] BaseSuite givens:", Object.keys(givens));
|
|
175
|
-
}
|
|
176
|
-
features() {
|
|
177
|
-
try {
|
|
178
|
-
const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
|
|
179
|
-
return array.indexOf(value) === index;
|
|
180
|
-
});
|
|
181
|
-
console.debug("[DEBUG] Features extracted:", features);
|
|
182
|
-
return features || [];
|
|
183
|
-
} catch (e) {
|
|
184
|
-
console.error("[ERROR] Failed to extract features:", e);
|
|
185
|
-
return [];
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
toObj() {
|
|
189
|
-
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
190
|
-
return {
|
|
191
|
-
name: this.name,
|
|
192
|
-
givens,
|
|
193
|
-
fails: this.fails,
|
|
194
|
-
failed: this.failed,
|
|
195
|
-
features: this.features()
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
setup(s, artifactory, tr, pm) {
|
|
199
|
-
return new Promise((res) => res(s));
|
|
200
|
-
}
|
|
201
|
-
assertThat(t) {
|
|
202
|
-
return !!t;
|
|
203
|
-
}
|
|
204
|
-
afterAll(store, artifactory, pm) {
|
|
205
|
-
return store;
|
|
206
|
-
}
|
|
207
|
-
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
208
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
209
|
-
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
210
|
-
tLog("\nSuite:", this.index, this.name);
|
|
211
|
-
const sNdx = this.index;
|
|
212
|
-
const subject = await this.setup(
|
|
213
|
-
input,
|
|
214
|
-
suiteArtifactory,
|
|
215
|
-
testResourceConfiguration,
|
|
216
|
-
beforeAllProxy(pm, sNdx.toString())
|
|
217
|
-
);
|
|
218
|
-
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
219
|
-
const giver = this.givens[gKey];
|
|
220
|
-
this.store = await giver.give(
|
|
221
|
-
subject,
|
|
222
|
-
gKey,
|
|
223
|
-
testResourceConfiguration,
|
|
224
|
-
this.assertThat,
|
|
225
|
-
suiteArtifactory,
|
|
226
|
-
tLog,
|
|
227
|
-
pm,
|
|
228
|
-
sNdx
|
|
229
|
-
).catch((e) => {
|
|
230
|
-
this.failed = true;
|
|
231
|
-
this.fails = this.fails + 1;
|
|
232
|
-
console.error("Given error 1:", e);
|
|
233
|
-
throw e;
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
try {
|
|
237
|
-
this.afterAll(
|
|
238
|
-
this.store,
|
|
239
|
-
artifactory,
|
|
240
|
-
afterAllProxy(pm, sNdx.toString())
|
|
241
|
-
);
|
|
242
|
-
} catch (e) {
|
|
243
|
-
console.error(e);
|
|
244
|
-
}
|
|
245
|
-
return this;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// src/lib/index.ts
|
|
250
|
-
var BaseAdapter = () => ({
|
|
251
|
-
beforeAll: async (s) => s,
|
|
252
|
-
beforeEach: async function(subject, initialValues, x, testResource, pm) {
|
|
253
|
-
return subject;
|
|
254
|
-
},
|
|
255
|
-
afterEach: async (s) => s,
|
|
256
|
-
afterAll: (store) => void 0,
|
|
257
|
-
butThen: async (store, thenCb) => {
|
|
258
|
-
return thenCb(store);
|
|
259
|
-
},
|
|
260
|
-
andWhen: async (store, whenCB, testResource, pm) => {
|
|
261
|
-
try {
|
|
262
|
-
await whenCB(store, testResource, pm);
|
|
263
|
-
} catch (error) {
|
|
264
|
-
console.error("Error in andWhen:", error);
|
|
265
|
-
throw error;
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
assertThis: (x) => x
|
|
269
|
-
});
|
|
270
|
-
var DefaultAdapter = (p) => {
|
|
271
|
-
return {
|
|
272
|
-
...BaseAdapter,
|
|
273
|
-
...p
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
var defaultTestResourceRequirement = {
|
|
277
|
-
ports: 0
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// src/lib/basebuilder.ts
|
|
281
|
-
var BaseBuilder = class {
|
|
282
|
-
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
|
|
283
|
-
this.artifacts = [];
|
|
284
|
-
this.artifacts = [];
|
|
285
|
-
this.testResourceRequirement = testResourceRequirement;
|
|
286
|
-
this.suitesOverrides = suitesOverrides;
|
|
287
|
-
this.givenOverides = givenOverides;
|
|
288
|
-
this.whenOverides = whenOverides;
|
|
289
|
-
this.thenOverides = thenOverides;
|
|
290
|
-
this.testSpecification = testSpecification;
|
|
291
|
-
this.specs = testSpecification(
|
|
292
|
-
this.Suites(),
|
|
293
|
-
this.Given(),
|
|
294
|
-
this.When(),
|
|
295
|
-
this.Then()
|
|
296
|
-
);
|
|
297
|
-
this.testJobs = this.specs.map((suite) => {
|
|
298
|
-
const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
|
|
299
|
-
const x = await suite2.run(
|
|
300
|
-
input,
|
|
301
|
-
puppetMaster.testResourceConfiguration,
|
|
302
|
-
(fPath, value) => puppetMaster.testArtiFactoryfileWriter(
|
|
303
|
-
tLog,
|
|
304
|
-
(p) => {
|
|
305
|
-
this.artifacts.push(p);
|
|
306
|
-
}
|
|
307
|
-
)(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
|
|
308
|
-
tLog,
|
|
309
|
-
puppetMaster
|
|
310
|
-
);
|
|
311
|
-
return x;
|
|
312
|
-
};
|
|
313
|
-
const runner = suiteRunner(suite);
|
|
314
|
-
return {
|
|
315
|
-
test: suite,
|
|
316
|
-
toObj: () => {
|
|
317
|
-
return suite.toObj();
|
|
318
|
-
},
|
|
319
|
-
runner,
|
|
320
|
-
receiveTestResourceConfig: async function(puppetMaster) {
|
|
321
|
-
const logFilePath = "logs.txt";
|
|
322
|
-
const access = await puppetMaster.createWriteStream(
|
|
323
|
-
logFilePath
|
|
324
|
-
);
|
|
325
|
-
const tLog = async (...l) => {
|
|
326
|
-
};
|
|
327
|
-
const suiteDone = await runner(puppetMaster, tLog);
|
|
328
|
-
const logPromise = new Promise(async (res) => {
|
|
329
|
-
await puppetMaster.end(access);
|
|
330
|
-
res(true);
|
|
331
|
-
});
|
|
332
|
-
const fails = suiteDone.fails;
|
|
333
|
-
await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
|
|
334
|
-
await puppetMaster.writeFileSync(
|
|
335
|
-
`tests.json`,
|
|
336
|
-
JSON.stringify(this.toObj(), null, 2)
|
|
337
|
-
);
|
|
338
|
-
return {
|
|
339
|
-
failed: fails > 0,
|
|
340
|
-
fails,
|
|
341
|
-
artifacts: this.artifacts || [],
|
|
342
|
-
logPromise,
|
|
343
|
-
features: suiteDone.features()
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
// testsJson() {
|
|
350
|
-
// puppetMaster.writeFileSync(
|
|
351
|
-
// `tests.json`,
|
|
352
|
-
// JSON.stringify({ features: suiteDone.features() }, null, 2)
|
|
353
|
-
// );
|
|
354
|
-
// }
|
|
355
|
-
Specs() {
|
|
356
|
-
return this.specs;
|
|
357
|
-
}
|
|
358
|
-
Suites() {
|
|
359
|
-
return this.suitesOverrides;
|
|
360
|
-
}
|
|
361
|
-
Given() {
|
|
362
|
-
return this.givenOverides;
|
|
363
|
-
}
|
|
364
|
-
When() {
|
|
365
|
-
return this.whenOverides;
|
|
366
|
-
}
|
|
367
|
-
Then() {
|
|
368
|
-
return this.thenOverides;
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// src/lib/abstractBase.ts
|
|
373
|
-
var BaseGiven = class {
|
|
374
|
-
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
375
|
-
this.name = name;
|
|
376
|
-
this.features = features;
|
|
377
|
-
this.whens = whens;
|
|
378
|
-
this.thens = thens;
|
|
379
|
-
this.givenCB = givenCB;
|
|
380
|
-
this.initialValues = initialValues;
|
|
381
|
-
}
|
|
382
|
-
beforeAll(store) {
|
|
383
|
-
return store;
|
|
384
|
-
}
|
|
385
|
-
toObj() {
|
|
386
|
-
return {
|
|
387
|
-
key: this.key,
|
|
388
|
-
name: this.name,
|
|
389
|
-
whens: this.whens.map((w) => {
|
|
390
|
-
if (w && w.toObj)
|
|
391
|
-
return w.toObj();
|
|
392
|
-
console.error("w is not as expected!", w);
|
|
393
|
-
return {};
|
|
394
|
-
}),
|
|
395
|
-
thens: this.thens.map((t) => t.toObj()),
|
|
396
|
-
error: this.error ? [this.error, this.error.stack] : null,
|
|
397
|
-
failed: this.failed,
|
|
398
|
-
features: this.features
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
async afterEach(store, key, artifactory, pm) {
|
|
402
|
-
return store;
|
|
403
|
-
}
|
|
404
|
-
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
405
|
-
this.key = key;
|
|
406
|
-
tLog(`
|
|
407
|
-
${this.key}`);
|
|
408
|
-
tLog(`
|
|
409
|
-
Given: ${this.name}`);
|
|
410
|
-
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
411
|
-
this.uberCatcher((e) => {
|
|
412
|
-
console.error(e);
|
|
413
|
-
this.error = e.error;
|
|
414
|
-
tLog(e.stack);
|
|
415
|
-
});
|
|
416
|
-
try {
|
|
417
|
-
this.store = await this.givenThat(
|
|
418
|
-
subject,
|
|
419
|
-
testResourceConfiguration,
|
|
420
|
-
givenArtifactory,
|
|
421
|
-
this.givenCB,
|
|
422
|
-
this.initialValues,
|
|
423
|
-
beforeEachProxy(pm, suiteNdx.toString())
|
|
424
|
-
);
|
|
425
|
-
} catch (e) {
|
|
426
|
-
console.error("failure 4 ", e);
|
|
427
|
-
this.error = e;
|
|
428
|
-
throw e;
|
|
429
|
-
}
|
|
430
|
-
try {
|
|
431
|
-
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
432
|
-
await whenStep.test(
|
|
433
|
-
this.store,
|
|
434
|
-
testResourceConfiguration,
|
|
435
|
-
tLog,
|
|
436
|
-
pm,
|
|
437
|
-
`suite-${suiteNdx}/given-${key}/when/${whenNdx}`
|
|
438
|
-
);
|
|
439
|
-
}
|
|
440
|
-
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
441
|
-
const t = await thenStep.test(
|
|
442
|
-
this.store,
|
|
443
|
-
testResourceConfiguration,
|
|
444
|
-
tLog,
|
|
445
|
-
pm,
|
|
446
|
-
`suite-${suiteNdx}/given-${key}/then-${thenNdx}`
|
|
447
|
-
);
|
|
448
|
-
tester(t);
|
|
449
|
-
}
|
|
450
|
-
} catch (e) {
|
|
451
|
-
this.failed = true;
|
|
452
|
-
tLog(e.stack);
|
|
453
|
-
throw e;
|
|
454
|
-
} finally {
|
|
455
|
-
try {
|
|
456
|
-
await this.afterEach(
|
|
457
|
-
this.store,
|
|
458
|
-
this.key,
|
|
459
|
-
givenArtifactory,
|
|
460
|
-
afterEachProxy(pm, suiteNdx.toString(), key)
|
|
461
|
-
);
|
|
462
|
-
} catch (e) {
|
|
463
|
-
console.error("afterEach failed!", e);
|
|
464
|
-
this.failed = e;
|
|
465
|
-
throw e;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return this.store;
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
var BaseWhen = class {
|
|
472
|
-
constructor(name, whenCB) {
|
|
473
|
-
this.name = name;
|
|
474
|
-
this.whenCB = whenCB;
|
|
475
|
-
}
|
|
476
|
-
toObj() {
|
|
477
|
-
console.log("toObj error", this.error);
|
|
478
|
-
return {
|
|
479
|
-
name: this.name,
|
|
480
|
-
error: this.error && this.error.name + this.error.stack
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
484
|
-
try {
|
|
485
|
-
tLog(" When:", this.name);
|
|
486
|
-
console.debug("[DEBUG] Executing When step:", this.name);
|
|
487
|
-
const result = await this.andWhen(
|
|
488
|
-
store,
|
|
489
|
-
this.whenCB,
|
|
490
|
-
testResourceConfiguration,
|
|
491
|
-
andWhenProxy(pm, filepath)
|
|
492
|
-
);
|
|
493
|
-
console.debug("[DEBUG] When step completed:", this.name);
|
|
494
|
-
return result;
|
|
495
|
-
} catch (e) {
|
|
496
|
-
console.error("[ERROR] When step failed:", this.name, e);
|
|
497
|
-
this.error = e;
|
|
498
|
-
throw e;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
var BaseThen = class {
|
|
503
|
-
constructor(name, thenCB) {
|
|
504
|
-
this.name = name;
|
|
505
|
-
this.thenCB = thenCB;
|
|
506
|
-
this.error = false;
|
|
507
|
-
}
|
|
508
|
-
toObj() {
|
|
509
|
-
return {
|
|
510
|
-
name: this.name,
|
|
511
|
-
error: this.error
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
515
|
-
return this.butThen(
|
|
516
|
-
store,
|
|
517
|
-
async (s) => {
|
|
518
|
-
if (typeof this.thenCB === "function") {
|
|
519
|
-
return await this.thenCB(s);
|
|
520
|
-
} else {
|
|
521
|
-
return this.thenCB;
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
testResourceConfiguration,
|
|
525
|
-
butThenProxy(pm, filepath)
|
|
526
|
-
).catch((e) => {
|
|
527
|
-
this.error = e.toString();
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
// src/lib/classBuilder.ts
|
|
533
|
-
var ClassBuilder = class extends BaseBuilder {
|
|
534
|
-
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
|
|
535
|
-
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
536
|
-
(a, [key], index) => {
|
|
537
|
-
a[key] = (somestring, givens) => {
|
|
538
|
-
return new suiteKlasser.prototype.constructor(
|
|
539
|
-
somestring,
|
|
540
|
-
index,
|
|
541
|
-
givens
|
|
542
|
-
);
|
|
543
|
-
};
|
|
544
|
-
return a;
|
|
545
|
-
},
|
|
546
|
-
{}
|
|
547
|
-
);
|
|
548
|
-
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
549
|
-
(a, [key, g]) => {
|
|
550
|
-
a[key] = (features, whens, thens, ...initialValues) => {
|
|
551
|
-
return new givenKlasser.prototype.constructor(
|
|
552
|
-
key,
|
|
553
|
-
features,
|
|
554
|
-
whens,
|
|
555
|
-
thens,
|
|
556
|
-
testImplementation.givens[key],
|
|
557
|
-
initialValues
|
|
558
|
-
);
|
|
559
|
-
};
|
|
560
|
-
return a;
|
|
561
|
-
},
|
|
562
|
-
{}
|
|
563
|
-
);
|
|
564
|
-
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
565
|
-
(a, [key, whEn]) => {
|
|
566
|
-
a[key] = (...payload) => {
|
|
567
|
-
return new whenKlasser.prototype.constructor(
|
|
568
|
-
`${whEn.name}: ${payload && payload.toString()}`,
|
|
569
|
-
whEn(...payload)
|
|
570
|
-
);
|
|
571
|
-
};
|
|
572
|
-
return a;
|
|
573
|
-
},
|
|
574
|
-
{}
|
|
575
|
-
);
|
|
576
|
-
const classyThens = Object.entries(
|
|
577
|
-
testImplementation.thens
|
|
578
|
-
).reduce(
|
|
579
|
-
(a, [key, thEn]) => {
|
|
580
|
-
a[key] = (expected, ...x) => {
|
|
581
|
-
return new thenKlasser.prototype.constructor(
|
|
582
|
-
`${thEn.name}: ${expected && expected.toString()}`,
|
|
583
|
-
thEn(expected, ...x)
|
|
584
|
-
);
|
|
585
|
-
};
|
|
586
|
-
return a;
|
|
587
|
-
},
|
|
588
|
-
{}
|
|
589
|
-
);
|
|
590
|
-
super(
|
|
591
|
-
input,
|
|
592
|
-
classySuites,
|
|
593
|
-
classyGivens,
|
|
594
|
-
classyWhens,
|
|
595
|
-
classyThens,
|
|
596
|
-
testResourceRequirement,
|
|
597
|
-
testSpecification
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
// src/lib/core.ts
|
|
603
|
-
var TesterantoCore = class extends ClassBuilder {
|
|
604
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter, uberCatcher) {
|
|
605
|
-
const fullAdapter = DefaultAdapter(testAdapter);
|
|
606
|
-
super(
|
|
607
|
-
testImplementation,
|
|
608
|
-
testSpecification,
|
|
609
|
-
input,
|
|
610
|
-
class extends BaseSuite {
|
|
611
|
-
afterAll(store, artifactory, pm) {
|
|
612
|
-
return fullAdapter.afterAll(store, pm);
|
|
613
|
-
}
|
|
614
|
-
assertThat(t) {
|
|
615
|
-
return fullAdapter.assertThis(t);
|
|
616
|
-
}
|
|
617
|
-
async setup(s, artifactory, tr, pm) {
|
|
618
|
-
return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
|
|
619
|
-
s,
|
|
620
|
-
this.testResourceConfiguration,
|
|
621
|
-
// artifactory,
|
|
622
|
-
pm
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
class Given extends BaseGiven {
|
|
627
|
-
constructor() {
|
|
628
|
-
super(...arguments);
|
|
629
|
-
this.uberCatcher = uberCatcher;
|
|
630
|
-
}
|
|
631
|
-
async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
|
|
632
|
-
return fullAdapter.beforeEach(
|
|
633
|
-
subject,
|
|
634
|
-
initializer,
|
|
635
|
-
testResource,
|
|
636
|
-
initialValues,
|
|
637
|
-
pm
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
afterEach(store, key, artifactory, pm) {
|
|
641
|
-
return new Promise(
|
|
642
|
-
(res) => res(fullAdapter.afterEach(store, key, pm))
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
class When extends BaseWhen {
|
|
647
|
-
async andWhen(store, whenCB, testResource, pm) {
|
|
648
|
-
return await fullAdapter.andWhen(store, whenCB, testResource, pm);
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
class Then extends BaseThen {
|
|
652
|
-
async butThen(store, thenCB, testResource, pm) {
|
|
653
|
-
return await fullAdapter.butThen(store, thenCB, testResource, pm);
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
testResourceRequirement
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
|
|
661
|
-
// src/PM/index.ts
|
|
662
|
-
var PM = class {
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
export {
|
|
666
|
-
defaultTestResourceRequirement,
|
|
667
|
-
BaseGiven,
|
|
668
|
-
BaseWhen,
|
|
669
|
-
BaseThen,
|
|
670
|
-
BaseBuilder,
|
|
671
|
-
BaseSuite,
|
|
672
|
-
TesterantoCore,
|
|
673
|
-
PM
|
|
674
|
-
};
|