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