testeranto 0.110.0 → 0.111.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.
Files changed (176) hide show
  1. package/package.json +1 -1
  2. package/src/PM/main.ts +418 -92
  3. package/src/ReportClient.tsx +38 -30
  4. package/src/run.ts +4 -371
  5. package/tsc.log +8 -6
  6. package/dist/common/Init.js +0 -68
  7. package/dist/common/Node.js +0 -27
  8. package/dist/common/PM/index.js +0 -7
  9. package/dist/common/PM/main.js +0 -984
  10. package/dist/common/PM/node.js +0 -128
  11. package/dist/common/PM/web.js +0 -121
  12. package/dist/common/ReportServer.js +0 -22
  13. package/dist/common/SubPackages/react/component/node.js +0 -19
  14. package/dist/common/SubPackages/react/component/web.js +0 -19
  15. package/dist/common/SubPackages/react/jsx/index.js +0 -21
  16. package/dist/common/SubPackages/react/jsx/node.js +0 -10
  17. package/dist/common/SubPackages/react/jsx/web.js +0 -10
  18. package/dist/common/SubPackages/react-dom/component/node.js +0 -88
  19. package/dist/common/SubPackages/react-dom/component/web.js +0 -67
  20. package/dist/common/SubPackages/react-dom/jsx/index.js +0 -2
  21. package/dist/common/SubPackages/react-dom/jsx/node.js +0 -39
  22. package/dist/common/SubPackages/react-dom/jsx/web.js +0 -128
  23. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -54
  24. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -2
  25. package/dist/common/SubPackages/react-test-renderer/component/interface.js +0 -70
  26. package/dist/common/SubPackages/react-test-renderer/component/node.js +0 -8
  27. package/dist/common/SubPackages/react-test-renderer/component/web.js +0 -8
  28. package/dist/common/SubPackages/react-test-renderer/fc/node.js +0 -60
  29. package/dist/common/SubPackages/react-test-renderer/fc/web.js +0 -60
  30. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -67
  31. package/dist/common/SubPackages/react-test-renderer/jsx/node.js +0 -10
  32. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +0 -10
  33. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +0 -52
  34. package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  35. package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  36. package/dist/common/Types.js +0 -2
  37. package/dist/common/Web.js +0 -49
  38. package/dist/common/build.js +0 -222
  39. package/dist/common/defaultConfig.js +0 -20
  40. package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +0 -6
  41. package/dist/common/esbuildConfigs/featuresPlugin.js +0 -39
  42. package/dist/common/esbuildConfigs/index.js +0 -21
  43. package/dist/common/esbuildConfigs/inputFilesPlugin.js +0 -27
  44. package/dist/common/esbuildConfigs/node.js +0 -37
  45. package/dist/common/esbuildConfigs/web.js +0 -50
  46. package/dist/common/init-docs.js +0 -53
  47. package/dist/common/lib/abstractBase.js +0 -329
  48. package/dist/common/lib/basebuilder.js +0 -98
  49. package/dist/common/lib/classBuilder.js +0 -40
  50. package/dist/common/lib/core.js +0 -117
  51. package/dist/common/lib/index.js +0 -21
  52. package/dist/common/lib/types.js +0 -2
  53. package/dist/common/package.json +0 -3
  54. package/dist/common/puppeteerConfiger.js +0 -24
  55. package/dist/common/run.js +0 -297
  56. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  57. package/dist/common/utils.js +0 -43
  58. package/dist/common/web.html.js +0 -22
  59. package/dist/module/Footer.js +0 -4
  60. package/dist/module/Init.js +0 -63
  61. package/dist/module/Node.js +0 -20
  62. package/dist/module/PM/index.js +0 -3
  63. package/dist/module/PM/main.js +0 -944
  64. package/dist/module/PM/node.js +0 -121
  65. package/dist/module/PM/web.js +0 -117
  66. package/dist/module/ReportClient.js +0 -97
  67. package/dist/module/ReportServer.js +0 -17
  68. package/dist/module/SubPackages/react/component/node.js +0 -14
  69. package/dist/module/SubPackages/react/component/web.js +0 -14
  70. package/dist/module/SubPackages/react/jsx/index.js +0 -15
  71. package/dist/module/SubPackages/react/jsx/node.js +0 -5
  72. package/dist/module/SubPackages/react/jsx/web.js +0 -5
  73. package/dist/module/SubPackages/react-dom/component/node.js +0 -80
  74. package/dist/module/SubPackages/react-dom/component/web.js +0 -62
  75. package/dist/module/SubPackages/react-dom/jsx/index.js +0 -1
  76. package/dist/module/SubPackages/react-dom/jsx/node.js +0 -31
  77. package/dist/module/SubPackages/react-dom/jsx/web.js +0 -90
  78. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  79. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  80. package/dist/module/SubPackages/react-test-renderer/component/interface.js +0 -31
  81. package/dist/module/SubPackages/react-test-renderer/component/node.js +0 -3
  82. package/dist/module/SubPackages/react-test-renderer/component/web.js +0 -3
  83. package/dist/module/SubPackages/react-test-renderer/fc/node.js +0 -22
  84. package/dist/module/SubPackages/react-test-renderer/fc/web.js +0 -22
  85. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -28
  86. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +0 -5
  87. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +0 -5
  88. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  89. package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  90. package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  91. package/dist/module/TestReport.js +0 -91
  92. package/dist/module/Types.js +0 -1
  93. package/dist/module/Web.js +0 -42
  94. package/dist/module/build.js +0 -184
  95. package/dist/module/defaultConfig.js +0 -18
  96. package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +0 -3
  97. package/dist/module/esbuildConfigs/featuresPlugin.js +0 -34
  98. package/dist/module/esbuildConfigs/index.js +0 -19
  99. package/dist/module/esbuildConfigs/inputFilesPlugin.js +0 -22
  100. package/dist/module/esbuildConfigs/node.js +0 -32
  101. package/dist/module/esbuildConfigs/web.js +0 -45
  102. package/dist/module/init-docs.js +0 -15
  103. package/dist/module/lib/abstractBase.js +0 -321
  104. package/dist/module/lib/basebuilder.js +0 -94
  105. package/dist/module/lib/classBuilder.js +0 -36
  106. package/dist/module/lib/core.js +0 -114
  107. package/dist/module/lib/index.js +0 -17
  108. package/dist/module/lib/types.js +0 -1
  109. package/dist/module/package.json +0 -3
  110. package/dist/module/puppeteerConfiger.js +0 -19
  111. package/dist/module/run.js +0 -259
  112. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  113. package/dist/module/utils.js +0 -29
  114. package/dist/module/web.html.js +0 -20
  115. package/dist/prebuild/ReportClient.css +0 -11367
  116. package/dist/prebuild/ReportClient.js +0 -23641
  117. package/dist/prebuild/ReportServer.mjs +0 -16
  118. package/dist/prebuild/TestReport.css +0 -11367
  119. package/dist/prebuild/TestReport.js +0 -27484
  120. package/dist/prebuild/build.mjs +0 -376
  121. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -9
  122. package/dist/prebuild/init-docs.mjs +0 -104
  123. package/dist/prebuild/run.mjs +0 -1190
  124. package/dist/tsconfig.tsbuildinfo +0 -1
  125. package/dist/types/Init.d.ts +0 -2
  126. package/dist/types/Node.d.ts +0 -12
  127. package/dist/types/PM/index.d.ts +0 -34
  128. package/dist/types/PM/main.d.ts +0 -59
  129. package/dist/types/PM/node.d.ts +0 -40
  130. package/dist/types/PM/web.d.ts +0 -38
  131. package/dist/types/ReportServer.d.ts +0 -1
  132. package/dist/types/SubPackages/react/component/node.d.ts +0 -7
  133. package/dist/types/SubPackages/react/component/web.d.ts +0 -7
  134. package/dist/types/SubPackages/react/jsx/index.d.ts +0 -12
  135. package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
  136. package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
  137. package/dist/types/SubPackages/react-dom/component/node.d.ts +0 -11
  138. package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -20
  139. package/dist/types/SubPackages/react-dom/jsx/index.d.ts +0 -6
  140. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -7
  141. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
  142. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -6
  143. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  144. package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  145. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +0 -4
  146. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
  147. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  148. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +0 -9
  149. package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +0 -16
  150. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  151. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +0 -9
  152. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -15
  153. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
  154. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
  155. package/dist/types/Types.d.ts +0 -61
  156. package/dist/types/Web.d.ts +0 -9
  157. package/dist/types/build.d.ts +0 -1
  158. package/dist/types/defaultConfig.d.ts +0 -3
  159. package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
  160. package/dist/types/esbuildConfigs/featuresPlugin.d.ts +0 -5
  161. package/dist/types/esbuildConfigs/index.d.ts +0 -4
  162. package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +0 -6
  163. package/dist/types/esbuildConfigs/node.d.ts +0 -4
  164. package/dist/types/esbuildConfigs/web.d.ts +0 -4
  165. package/dist/types/init-docs.d.ts +0 -1
  166. package/dist/types/lib/abstractBase.d.ts +0 -110
  167. package/dist/types/lib/basebuilder.d.ts +0 -27
  168. package/dist/types/lib/classBuilder.d.ts +0 -7
  169. package/dist/types/lib/core.d.ts +0 -7
  170. package/dist/types/lib/index.d.ts +0 -83
  171. package/dist/types/lib/types.d.ts +0 -14
  172. package/dist/types/puppeteerConfiger.d.ts +0 -4
  173. package/dist/types/run.d.ts +0 -1
  174. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  175. package/dist/types/utils.d.ts +0 -9
  176. package/dist/types/web.html.d.ts +0 -2
@@ -1,329 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseCheck = exports.BaseThen = exports.BaseWhen = exports.BaseGiven = exports.BaseSuite = void 0;
4
- class BaseSuite {
5
- constructor(name, index, givens = {}, checks = []) {
6
- this.name = name;
7
- this.index = index;
8
- this.givens = givens;
9
- this.checks = checks;
10
- this.fails = [];
11
- }
12
- features() {
13
- const features = Object.keys(this.givens)
14
- .map((k) => this.givens[k].features)
15
- .flat()
16
- .filter((value, index, array) => {
17
- return array.indexOf(value) === index;
18
- });
19
- // .reduce((mm, lm) => {
20
- // mm[lm] = lm;
21
- // return mm;
22
- // }, {});
23
- return features || [];
24
- }
25
- toObj() {
26
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
27
- return {
28
- name: this.name,
29
- givens,
30
- fails: this.fails,
31
- features: this.features(),
32
- };
33
- }
34
- setup(s, artifactory, tr, pm) {
35
- return new Promise((res) => res(s));
36
- }
37
- assertThat(t) {
38
- return t;
39
- }
40
- afterAll(store, artifactory, pm) {
41
- return store;
42
- }
43
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
44
- this.testResourceConfiguration = testResourceConfiguration;
45
- tLog("test resources: ", JSON.stringify(testResourceConfiguration));
46
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
47
- // console.log("\nSuite:", this.index, this.name);
48
- tLog("\nSuite:", this.index, this.name);
49
- const sNdx = this.index;
50
- const sName = this.name;
51
- for (const [gKey, g] of Object.entries(this.givens)) {
52
- // console.log("gKey", gKey);
53
- const beforeAllProxy = new Proxy(pm, {
54
- get(target, prop, receiver) {
55
- if (prop === "customScreenShot") {
56
- return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
57
- // path: `${filepath}/${opts.path}`,
58
- path: `suite-${sNdx}/beforeAll/${opts.path}` }), p);
59
- }
60
- if (prop === "writeFileSync") {
61
- return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
62
- }
63
- /* @ts-ignore:next-line */
64
- return Reflect.get(...arguments);
65
- },
66
- });
67
- const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
68
- const giver = this.givens[gKey];
69
- try {
70
- this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
71
- }
72
- catch (e) {
73
- console.error(e);
74
- this.fails.push(giver);
75
- // return this;
76
- }
77
- }
78
- try {
79
- this.afterAll(this.store, artifactory,
80
- // afterAllProxy
81
- pm);
82
- }
83
- catch (e) {
84
- console.error(e);
85
- // this.fails.push(this);
86
- // return this;
87
- }
88
- // for (const [ndx, thater] of this.checks.entries()) {
89
- // await thater.check(
90
- // subject,
91
- // thater.name,
92
- // testResourceConfiguration,
93
- // this.assertThat,
94
- // suiteArtifactory,
95
- // tLog,
96
- // pm
97
- // );
98
- // }
99
- // @TODO fix me
100
- // for (const k of Object.keys(this.givens)) {
101
- // const giver = this.givens[k];
102
- // try {
103
- // giver.afterAll(this.store, artifactory, pm);
104
- // } catch (e) {
105
- // console.error(e);
106
- // this.fails.push(giver);
107
- // return this;
108
- // }
109
- // }
110
- ////////////////
111
- return this;
112
- }
113
- }
114
- exports.BaseSuite = BaseSuite;
115
- class BaseGiven {
116
- constructor(name, features, whens, thens, givenCB, initialValues
117
- // key: string
118
- ) {
119
- this.name = name;
120
- this.features = features;
121
- this.whens = whens;
122
- this.thens = thens;
123
- this.givenCB = givenCB;
124
- this.initialValues = initialValues;
125
- }
126
- beforeAll(store,
127
- // artifactory: ITestArtifactory
128
- // subject,
129
- initializer, artifactory, testResource, initialValues, pm) {
130
- return store;
131
- }
132
- toObj() {
133
- return {
134
- key: this.key,
135
- name: this.name,
136
- whens: this.whens.map((w) => w.toObj()),
137
- thens: this.thens.map((t) => t.toObj()),
138
- error: this.error ? [this.error, this.error.stack] : null,
139
- // fail: this.fail ? [this.fail] : false,
140
- features: this.features,
141
- };
142
- }
143
- async afterEach(store, key, artifactory, pm) {
144
- return store;
145
- }
146
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
147
- this.key = key;
148
- tLog(`\n ${this.key}`);
149
- tLog(`\n Given: ${this.name}`);
150
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
151
- try {
152
- // tLog(`\n Given this.store`, this.store);
153
- const beforeEachProxy = new Proxy(pm, {
154
- get(target, prop, receiver) {
155
- if (prop === "writeFileSync") {
156
- return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
157
- }
158
- if (prop === "customScreenShot") {
159
- return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
160
- }
161
- if (prop === "screencast") {
162
- return (opts, p) => target.screencast(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
163
- }
164
- /* @ts-ignore:next-line */
165
- return Reflect.get(...arguments);
166
- },
167
- });
168
- this.uberCatcher((e) => {
169
- console.error(e);
170
- this.error = e.error;
171
- tLog(e.stack);
172
- });
173
- this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
174
- for (const [whenNdx, whenStep] of this.whens.entries()) {
175
- await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
176
- }
177
- for (const [thenNdx, thenStep] of this.thens.entries()) {
178
- const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
179
- tester(t);
180
- }
181
- }
182
- catch (e) {
183
- console.error(e);
184
- this.error = e;
185
- tLog(e.stack);
186
- // tLog("\u0007"); // bell
187
- // throw e;
188
- }
189
- finally {
190
- try {
191
- const afterEachProxy = new Proxy(pm, {
192
- get(target, prop, receiver) {
193
- if (prop === "customScreenShot") {
194
- return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }), p);
195
- }
196
- if (prop === "writeFileSync") {
197
- return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
198
- }
199
- /* @ts-ignore:next-line */
200
- return Reflect.get(...arguments);
201
- },
202
- });
203
- await this.afterEach(this.store, this.key, givenArtifactory,
204
- // pm
205
- afterEachProxy);
206
- }
207
- catch (e) {
208
- console.error("afterEach failed! no error will be recorded!", e);
209
- }
210
- }
211
- return this.store;
212
- }
213
- }
214
- exports.BaseGiven = BaseGiven;
215
- class BaseWhen {
216
- constructor(name, whenCB) {
217
- this.name = name;
218
- this.whenCB = whenCB;
219
- }
220
- toObj() {
221
- return {
222
- name: this.name,
223
- error: this.error,
224
- };
225
- }
226
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
227
- tLog(" When:", this.name);
228
- const name = this.name;
229
- const andWhenProxy = new Proxy(pm, {
230
- get(target, prop, receiver) {
231
- if (prop === "customScreenShot") {
232
- return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
233
- }
234
- if (prop === "writeFileSync") {
235
- return (fp, contents) => target[prop](`${filepath}/andWhen/${fp}`, contents);
236
- }
237
- /* @ts-ignore:next-line */
238
- return Reflect.get(...arguments);
239
- },
240
- });
241
- return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
242
- this.error = true;
243
- // throw e;
244
- });
245
- // try {
246
- // return await this.andWhen(
247
- // store,
248
- // this.whenCB,
249
- // testResourceConfiguration,
250
- // andWhenProxy
251
- // );
252
- // } catch (e) {
253
- // this.error = true;
254
- // throw e;
255
- // }
256
- }
257
- }
258
- exports.BaseWhen = BaseWhen;
259
- class BaseThen {
260
- constructor(name, thenCB) {
261
- this.name = name;
262
- this.thenCB = thenCB;
263
- this.error = false;
264
- }
265
- toObj() {
266
- return {
267
- name: this.name,
268
- error: this.error,
269
- };
270
- }
271
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
272
- tLog(" Then:", this.name);
273
- try {
274
- const butThenProxy = new Proxy(pm, {
275
- get(target, prop, receiver) {
276
- if (prop === "customScreenShot") {
277
- return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
278
- }
279
- if (prop === "writeFileSync") {
280
- return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
281
- }
282
- /* @ts-ignore:next-line */
283
- return Reflect.get(...arguments);
284
- },
285
- });
286
- return this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy).catch((e) => {
287
- this.error = true;
288
- throw e;
289
- });
290
- }
291
- catch (e) {
292
- console.log("test failed", e);
293
- this.error = e.message;
294
- throw e;
295
- }
296
- }
297
- }
298
- exports.BaseThen = BaseThen;
299
- class BaseCheck {
300
- constructor(name, features, checkCB, whens, thens) {
301
- this.name = name;
302
- this.features = features;
303
- this.checkCB = checkCB;
304
- this.whens = whens;
305
- this.thens = thens;
306
- }
307
- async afterEach(store, key, cb, pm) {
308
- return;
309
- }
310
- async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm) {
311
- tLog(`\n Check: ${this.name}`);
312
- const store = await this.checkThat(subject, testResourceConfiguration, artifactory, pm);
313
- await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
314
- a[key] = async (payload) => {
315
- return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm, "x");
316
- };
317
- return a;
318
- }, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
319
- a[key] = async (payload) => {
320
- const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm);
321
- tester(t);
322
- };
323
- return a;
324
- }, {}));
325
- await this.afterEach(store, key, () => { }, pm);
326
- return;
327
- }
328
- }
329
- exports.BaseCheck = BaseCheck;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseBuilder = void 0;
4
- class BaseBuilder {
5
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, testResourceRequirement, testSpecification) {
6
- this.input = input;
7
- this.artifacts = [];
8
- this.artifacts = [];
9
- this.testResourceRequirement = testResourceRequirement;
10
- this.suitesOverrides = suitesOverrides;
11
- this.givenOverides = givenOverides;
12
- this.whenOverides = whenOverides;
13
- this.thenOverides = thenOverides;
14
- this.checkOverides = checkOverides;
15
- this.testSpecification = testSpecification;
16
- this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
17
- this.testJobs = this.specs.map((suite) => {
18
- const suiteRunner = (suite) => async (puppetMaster, tLog) => {
19
- const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
20
- this.artifacts.push(p);
21
- })(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
22
- return x;
23
- };
24
- const runner = suiteRunner(suite);
25
- return {
26
- test: suite,
27
- toObj: () => {
28
- return suite.toObj();
29
- },
30
- runner,
31
- receiveTestResourceConfig: async function (puppetMaster) {
32
- const logFilePath = "log.txt";
33
- const access = await puppetMaster.createWriteStream(logFilePath);
34
- const tLog = (...l) => {
35
- puppetMaster.write(access, `${l.toString()}\n`);
36
- };
37
- const suiteDone = await runner(puppetMaster, tLog);
38
- const logPromise = new Promise((res, rej) => {
39
- puppetMaster.end(access);
40
- res(true);
41
- });
42
- const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
43
- return suiteDone.givens[k].error;
44
- }).length;
45
- puppetMaster.writeFileSync(`bdd_errors.txt`, numberOfFailures.toString());
46
- const o = this.toObj();
47
- puppetMaster.writeFileSync(`littleBoard.html`, `
48
- <!DOCTYPE html>
49
- <html lang="en">
50
-
51
- <head>
52
- <meta name="description" content="Webpage description goes here" />
53
- <meta charset="utf-8" />
54
- <title>kokomoBay - testeranto</title>
55
- <meta name="viewport" content="width=device-width, initial-scale=1" />
56
- <meta name="author" content="" />
57
-
58
- <link rel="stylesheet" href="/kokomoBay/docs/TestReport.css" />
59
- <script src="/kokomoBay/docs/TestReport.js"></script>
60
-
61
- </head>
62
-
63
- <body>
64
- <h1>Test report</h1>
65
- <div id="root"/>
66
- </body>
67
- `);
68
- puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
69
- return {
70
- failed: numberOfFailures,
71
- artifacts: this.artifacts || [],
72
- logPromise,
73
- features: suiteDone.features(),
74
- };
75
- },
76
- };
77
- });
78
- }
79
- Specs() {
80
- return this.specs;
81
- }
82
- Suites() {
83
- return this.suitesOverrides;
84
- }
85
- Given() {
86
- return this.givenOverides;
87
- }
88
- When() {
89
- return this.whenOverides;
90
- }
91
- Then() {
92
- return this.thenOverides;
93
- }
94
- Check() {
95
- return this.checkOverides;
96
- }
97
- }
98
- exports.BaseBuilder = BaseBuilder;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClassBuilder = void 0;
4
- const basebuilder_js_1 = require("./basebuilder.js");
5
- class ClassBuilder extends basebuilder_js_1.BaseBuilder {
6
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement) {
7
- const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
8
- a[key] = (somestring, givens, checks) => {
9
- return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
10
- };
11
- return a;
12
- }, {});
13
- const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, g]) => {
14
- a[key] = (features, whens, thens, givEn) => {
15
- return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
16
- };
17
- return a;
18
- }, {});
19
- const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
20
- a[key] = (payload) => {
21
- return new whenKlasser.prototype.constructor(`${whEn.name}: ${payload && payload.toString()}`, whEn(payload));
22
- };
23
- return a;
24
- }, {});
25
- const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
26
- a[key] = (expected, x) => {
27
- return new thenKlasser.prototype.constructor(`${thEn.name}: ${expected && expected.toString()}`, thEn(expected));
28
- };
29
- return a;
30
- }, {});
31
- const classyChecks = Object.entries(testImplementation.checks).reduce((a, [key, z]) => {
32
- a[key] = (somestring, features, callback) => {
33
- return new checkKlasser.prototype.constructor(somestring, features, callback, classyWhens, classyThens);
34
- };
35
- return a;
36
- }, {});
37
- super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, testResourceRequirement, testSpecification);
38
- }
39
- }
40
- exports.ClassBuilder = ClassBuilder;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_js_1 = require("./index.js");
4
- const abstractBase_js_1 = require("./abstractBase.js");
5
- const classBuilder_js_1 = require("./classBuilder.js");
6
- class Testeranto extends classBuilder_js_1.ClassBuilder {
7
- constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, testInterface, uberCatcher) {
8
- const fullTestInterface = (0, index_js_1.DefaultTestInterface)(testInterface);
9
- super(testImplementation, testSpecification, input, class extends abstractBase_js_1.BaseSuite {
10
- afterAll(store, artifactory, pm) {
11
- return fullTestInterface.afterAll(store,
12
- // (fPath: string, value: unknown) =>
13
- // // TODO does not work?
14
- // {
15
- // artifactory(`afterAll4-${this.name}/${fPath}`, value);
16
- // },
17
- pm);
18
- }
19
- assertThat(t) {
20
- fullTestInterface.assertThis(t);
21
- }
22
- async setup(s, artifactory, tr, pm) {
23
- return (fullTestInterface.beforeAll ||
24
- (async (input, artifactory, tr, pm) => input))(s, this.testResourceConfiguration,
25
- // artifactory,
26
- pm);
27
- }
28
- }, class Given extends abstractBase_js_1.BaseGiven {
29
- constructor() {
30
- super(...arguments);
31
- this.uberCatcher = uberCatcher;
32
- }
33
- async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
34
- return fullTestInterface.beforeEach(subject, initializer,
35
- // artifactory,
36
- testResource, initialValues, pm);
37
- }
38
- afterEach(store, key, artifactory, pm) {
39
- return new Promise((res) => res(fullTestInterface.afterEach(store, key,
40
- // (fPath: string, value: unknown) =>
41
- // artifactory(`after/${fPath}`, value),
42
- pm)));
43
- }
44
- }, class When extends abstractBase_js_1.BaseWhen {
45
- async andWhen(store, whenCB, testResource, pm) {
46
- try {
47
- return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
48
- }
49
- catch (e) {
50
- throw e;
51
- }
52
- // return fullTestInterface
53
- // .andWhen(store, whenCB, testResource, pm)
54
- // .catch((e) => {
55
- // throw e;
56
- // });
57
- // return new Promise((res, rej) => {
58
- // fullTestInterface.andWhen(store, whenCB, testResource, pm);
59
- // });
60
- // return await fullTestInterface.andWhen(
61
- // store,
62
- // whenCB,
63
- // testResource,
64
- // pm
65
- // );
66
- }
67
- }, class Then extends abstractBase_js_1.BaseThen {
68
- async butThen(store, thenCB, testResource, pm) {
69
- return await fullTestInterface
70
- .butThen(store, thenCB, testResource, pm)
71
- .then((v) => {
72
- return v;
73
- }, (e) => {
74
- console.log(" ERROR ", e);
75
- throw e;
76
- });
77
- // try {
78
- // console.log("mark 4");
79
- // return await fullTestInterface.butThen(
80
- // store,
81
- // thenCB,
82
- // testResource,
83
- // pm
84
- // );
85
- // } catch (e) {
86
- // console.log("mar123");
87
- // throw e;
88
- // }
89
- // return await fullTestInterface.butThen(
90
- // store,
91
- // thenCB,
92
- // testResourceConfiguration,
93
- // pm
94
- // );
95
- }
96
- }, class Check extends abstractBase_js_1.BaseCheck {
97
- constructor(name, features, checkCallback, whens, thens, initialValues) {
98
- super(name, features, checkCallback, whens, thens);
99
- this.initialValues = initialValues;
100
- }
101
- async checkThat(subject, testResourceConfiguration, artifactory, pm) {
102
- return fullTestInterface.beforeEach(subject, this.initialValues,
103
- // (fPath: string, value: unknown) =>
104
- // artifactory(`before/${fPath}`, value),
105
- testResourceConfiguration, this.initialValues, pm);
106
- }
107
- afterEach(store, key, artifactory, pm) {
108
- return new Promise((res) => res(fullTestInterface.afterEach(store, key,
109
- // (fPath: string, value: unknown) =>
110
- // // TODO does not work?
111
- // artifactory(`afterEach2-${this.name}/${fPath}`, value),
112
- pm)));
113
- }
114
- }, testResourceRequirement);
115
- }
116
- }
117
- exports.default = Testeranto;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultTestResourceRequirement = exports.DefaultTestInterface = exports.BaseTestInterface = void 0;
4
- exports.BaseTestInterface = {
5
- beforeAll: async (s) => s,
6
- beforeEach: async function (subject, initialValues, x, testResource, pm) {
7
- return subject;
8
- },
9
- afterEach: async (s) => s,
10
- afterAll: (store) => undefined,
11
- butThen: async (store, thenCb) => thenCb(store),
12
- andWhen: (a) => a,
13
- assertThis: () => null,
14
- };
15
- const DefaultTestInterface = (p) => {
16
- return Object.assign(Object.assign({}, exports.BaseTestInterface), p);
17
- };
18
- exports.DefaultTestInterface = DefaultTestInterface;
19
- exports.defaultTestResourceRequirement = {
20
- ports: 0,
21
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const http_1 = __importDefault(require("http"));
7
- exports.default = async (port) => new Promise((resolve, reject) => {
8
- let json = "";
9
- const request = http_1.default.request({
10
- host: "127.0.0.1",
11
- path: "/json/version",
12
- port,
13
- }, (response) => {
14
- response.on("error", reject);
15
- response.on("data", (chunk) => {
16
- json += chunk.toString();
17
- });
18
- response.on("end", () => {
19
- resolve(JSON.parse(json));
20
- });
21
- });
22
- request.on("error", reject);
23
- request.end();
24
- });