testeranto 0.49.10 → 0.70.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 (250) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +92 -9
  3. package/dist/cjs-shim.js +12 -0
  4. package/dist/common/Features.js +2 -3
  5. package/dist/common/Node.js +37 -62
  6. package/dist/common/NodeWriter.js +7 -9
  7. package/dist/common/Project.js +130 -627
  8. package/dist/common/SubPackages/puppeteer.js +19 -0
  9. package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
  10. package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
  11. package/dist/common/SubPackages/react/jsx/index.js +13 -0
  12. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  13. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  14. package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
  15. package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
  16. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  17. package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +19 -20
  18. package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
  19. package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -15
  20. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
  21. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
  22. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
  23. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
  24. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
  25. package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
  26. package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
  27. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
  28. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
  29. package/dist/common/Types.js +2 -0
  30. package/dist/common/Web.js +49 -113
  31. package/dist/common/electron.js +256 -42
  32. package/dist/common/esbuildConfigs/features.js +14 -0
  33. package/dist/common/esbuildConfigs/index.js +20 -0
  34. package/dist/common/esbuildConfigs/node.js +37 -0
  35. package/dist/common/esbuildConfigs/report.js +13 -0
  36. package/dist/common/esbuildConfigs/tests.js +13 -0
  37. package/dist/common/esbuildConfigs/web.js +53 -0
  38. package/dist/common/lib/abstractBase.js +200 -0
  39. package/dist/common/lib/basebuilder.js +86 -0
  40. package/dist/common/lib/classBuilder.js +40 -0
  41. package/dist/common/lib/core.js +81 -0
  42. package/dist/common/lib/index.js +21 -0
  43. package/dist/common/lib/types.js +2 -0
  44. package/dist/common/preload.js +15 -24
  45. package/dist/common/puppeteerConfiger.js +24 -0
  46. package/dist/common/report.html.js +31 -0
  47. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  48. package/dist/common/web.html.js +22 -0
  49. package/dist/module/Features.js +2 -3
  50. package/dist/module/Node.js +37 -62
  51. package/dist/module/NodeWriter.js +7 -9
  52. package/dist/module/Project.js +131 -605
  53. package/dist/module/SubPackages/puppeteer.js +14 -0
  54. package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
  55. package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
  56. package/dist/module/SubPackages/react/jsx/index.js +10 -0
  57. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  58. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  59. package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +7 -7
  60. package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
  61. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  62. package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +20 -21
  63. package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
  64. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -15
  65. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
  66. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
  67. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
  68. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
  69. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
  70. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  71. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  72. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
  73. package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
  74. package/dist/module/Types.js +2 -0
  75. package/dist/module/Web.js +49 -113
  76. package/dist/module/electron.js +257 -43
  77. package/dist/module/esbuildConfigs/features.js +12 -0
  78. package/dist/module/esbuildConfigs/index.js +18 -0
  79. package/dist/module/esbuildConfigs/node.js +32 -0
  80. package/dist/module/esbuildConfigs/report.js +11 -0
  81. package/dist/module/esbuildConfigs/tests.js +11 -0
  82. package/dist/module/esbuildConfigs/web.js +48 -0
  83. package/dist/module/lib/abstractBase.js +192 -0
  84. package/dist/module/lib/basebuilder.js +82 -0
  85. package/dist/module/lib/classBuilder.js +36 -0
  86. package/dist/module/lib/core.js +78 -0
  87. package/dist/module/lib/index.js +17 -0
  88. package/dist/module/lib/types.js +1 -0
  89. package/dist/module/preload.js +12 -24
  90. package/dist/module/puppeteerConfiger.js +19 -0
  91. package/dist/module/report.html.js +29 -0
  92. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  93. package/dist/module/web.html.js +20 -0
  94. package/dist/prebuild/Report.css +10326 -0
  95. package/dist/prebuild/Report.js +37456 -0
  96. package/dist/types/Features.d.ts +5 -5
  97. package/dist/types/Node.d.ts +5 -11
  98. package/dist/types/NodeWriter.d.ts +1 -1
  99. package/dist/types/Project.d.ts +2 -28
  100. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  101. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  102. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  103. package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
  104. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  105. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  106. package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
  107. package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
  108. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  109. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  110. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  111. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
  112. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
  113. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  114. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  115. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  116. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  117. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  118. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  119. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
  120. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  121. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  122. package/dist/types/Types.d.ts +49 -17
  123. package/dist/types/Web.d.ts +5 -11
  124. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  125. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  126. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  127. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  128. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  129. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  130. package/dist/types/lib/abstractBase.d.ts +103 -0
  131. package/dist/types/lib/basebuilder.d.ts +25 -0
  132. package/dist/types/lib/classBuilder.d.ts +7 -0
  133. package/dist/types/lib/core.d.ts +8 -0
  134. package/dist/types/lib/index.d.ts +58 -0
  135. package/dist/types/lib/types.d.ts +70 -0
  136. package/dist/types/puppeteerConfiger.d.ts +4 -0
  137. package/dist/types/report.html.d.ts +2 -0
  138. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  139. package/dist/types/web.html.d.ts +2 -0
  140. package/electronBuild.ts +32 -0
  141. package/index.html +30 -0
  142. package/package.json +123 -87
  143. package/src/Features.ts +2 -4
  144. package/src/Node.ts +79 -155
  145. package/src/NodeWriter.ts +22 -22
  146. package/src/Project.ts +185 -783
  147. package/src/Report.tsx +30 -15
  148. package/src/SubPackages/puppeteer.ts +51 -0
  149. package/src/SubPackages/react/component/node.ts +43 -0
  150. package/src/SubPackages/react/component/web.ts +43 -0
  151. package/src/SubPackages/react/jsx/index.ts +32 -0
  152. package/src/SubPackages/react/jsx/node.ts +29 -0
  153. package/src/SubPackages/react/jsx/web.ts +30 -0
  154. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
  155. package/src/SubPackages/react-dom/component/web.ts +104 -0
  156. package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
  157. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  158. package/src/SubPackages/react-dom/jsx/web.ts +102 -0
  159. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
  160. package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
  161. package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
  162. package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
  163. package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
  164. package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
  165. package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
  166. package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
  167. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  168. package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
  169. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  170. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  171. package/src/Types.ts +114 -17
  172. package/src/Web.ts +100 -225
  173. package/src/cjs-shim.js +12 -0
  174. package/src/electron.ts +303 -45
  175. package/src/esbuildConfigs/features.ts +17 -0
  176. package/src/esbuildConfigs/index.ts +22 -0
  177. package/src/esbuildConfigs/node.ts +60 -0
  178. package/src/esbuildConfigs/report.ts +15 -0
  179. package/src/esbuildConfigs/tests.ts +14 -0
  180. package/src/esbuildConfigs/web.ts +73 -0
  181. package/src/lib/abstractBase.ts +412 -0
  182. package/src/lib/basebuilder.ts +228 -0
  183. package/src/lib/classBuilder.ts +118 -0
  184. package/src/lib/core.ts +214 -0
  185. package/src/lib/index.ts +117 -0
  186. package/src/lib/types.ts +206 -0
  187. package/src/preload.ts +13 -27
  188. package/src/puppeteerConfiger.ts +26 -0
  189. package/src/report.html.ts +29 -0
  190. package/src/web.html.ts +20 -0
  191. package/tests/Rectangle.test.ts +189 -0
  192. package/tsconfig.json +19 -6
  193. package/tsconfig.module.json +15 -4
  194. package/tsconfig.types.json +14 -4
  195. package/yarn-error.log +3144 -0
  196. package/dist/common/core.js +0 -397
  197. package/dist/common/subPackages/react/jsx/index.js +0 -26
  198. package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
  199. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  200. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  201. package/dist/module/Report.js +0 -186
  202. package/dist/module/core.js +0 -388
  203. package/dist/module/subPackages/react/jsx/index.js +0 -22
  204. package/dist/module/subPackages/react/jsx/node.js +0 -5
  205. package/dist/module/subPackages/react/jsx/web.js +0 -5
  206. package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
  207. package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
  208. package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
  209. package/dist/types/core.d.ts +0 -220
  210. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  211. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  212. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  213. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  214. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  215. package/dist/types/subPackages/react-dom/component/node.d.ts +0 -14
  216. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  217. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
  218. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
  219. package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
  220. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  221. package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
  222. package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
  223. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  224. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  225. package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  226. package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  227. package/src/core.ts +0 -1399
  228. package/src/subPackages/react/component/node.ts +0 -75
  229. package/src/subPackages/react/component/web.ts +0 -80
  230. package/src/subPackages/react/jsx/index.ts +0 -64
  231. package/src/subPackages/react/jsx/node.ts +0 -29
  232. package/src/subPackages/react/jsx/web.ts +0 -29
  233. package/src/subPackages/react-dom/component/web.ts +0 -129
  234. package/src/subPackages/react-dom/jsx/node.ts +0 -145
  235. package/src/subPackages/react-dom/jsx/web.ts +0 -145
  236. package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
  237. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  238. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  239. package/src/subPackages/react-test-renderer/fc/node.ts +0 -77
  240. package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
  241. package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
  242. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  243. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  244. package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
  245. package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
  246. /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  247. /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  248. /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  249. /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  250. /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
@@ -0,0 +1,118 @@
1
+ import {
2
+ IBaseTest,
3
+ ITestImplementation,
4
+ ITestSpecification,
5
+ } from "../Types.js";
6
+
7
+ import { BaseBuilder } from "./basebuilder.js";
8
+
9
+ import { ILogWriter, ITTestResourceRequest } from ".";
10
+ import {
11
+ ISuiteKlasser,
12
+ IGivenKlasser,
13
+ IWhenKlasser,
14
+ IThenKlasser,
15
+ ICheckKlasser,
16
+ } from "./types.js";
17
+
18
+ export abstract class ClassBuilder<
19
+ ITestShape extends IBaseTest
20
+ > extends BaseBuilder<ITestShape, any, any, any, any, any> {
21
+ constructor(
22
+ testImplementation: ITestImplementation<ITestShape, any>,
23
+ testSpecification: ITestSpecification<ITestShape>,
24
+ input: ITestShape["iinput"],
25
+ suiteKlasser: ISuiteKlasser<ITestShape>,
26
+ givenKlasser: IGivenKlasser<ITestShape>,
27
+ whenKlasser: IWhenKlasser<ITestShape>,
28
+ thenKlasser: IThenKlasser<ITestShape>,
29
+ checkKlasser: ICheckKlasser<ITestShape>,
30
+ testResourceRequirement: ITTestResourceRequest,
31
+ logWriter: ILogWriter
32
+ ) {
33
+ const classySuites = Object.entries(testImplementation.suites).reduce(
34
+ (a, [key], index) => {
35
+ a[key] = (somestring, givens, checks) => {
36
+ return new suiteKlasser.prototype.constructor(
37
+ somestring,
38
+ index,
39
+ givens,
40
+ checks
41
+ );
42
+ };
43
+ return a;
44
+ },
45
+ {}
46
+ );
47
+ const classyGivens = Object.entries(testImplementation.givens).reduce(
48
+ (a, [key, givEn]) => {
49
+ a[key] = (features, whens, thens, givEn) => {
50
+ return new givenKlasser.prototype.constructor(
51
+ key,
52
+ features,
53
+ whens,
54
+ thens,
55
+ testImplementation.givens[key],
56
+ givEn
57
+ );
58
+ };
59
+ return a;
60
+ },
61
+ {}
62
+ );
63
+
64
+ const classyWhens = Object.entries(testImplementation.whens).reduce(
65
+ (a, [key, whEn]: [string, (x) => any]) => {
66
+ a[key] = (payload?: any) => {
67
+ return new whenKlasser.prototype.constructor(
68
+ `${whEn.name}: ${payload && payload.toString()}`,
69
+ whEn(payload)
70
+ );
71
+ };
72
+ return a;
73
+ },
74
+ {}
75
+ );
76
+
77
+ const classyThens = Object.entries(testImplementation.thens).reduce(
78
+ (a, [key, thEn]: [string, (x) => any]) => {
79
+ a[key] = (expected: any, x) => {
80
+ return new thenKlasser.prototype.constructor(
81
+ `${thEn.name}: ${expected && expected.toString()}`,
82
+ thEn(expected)
83
+ );
84
+ };
85
+ return a;
86
+ },
87
+ {}
88
+ );
89
+
90
+ const classyChecks = Object.entries(testImplementation.checks).reduce(
91
+ (a, [key, z]) => {
92
+ a[key] = (somestring, features, callback) => {
93
+ return new checkKlasser.prototype.constructor(
94
+ somestring,
95
+ features,
96
+ callback,
97
+ classyWhens,
98
+ classyThens
99
+ );
100
+ };
101
+ return a;
102
+ },
103
+ {}
104
+ );
105
+
106
+ super(
107
+ input,
108
+ classySuites,
109
+ classyGivens,
110
+ classyWhens,
111
+ classyThens,
112
+ classyChecks,
113
+ logWriter,
114
+ testResourceRequirement,
115
+ testSpecification
116
+ );
117
+ }
118
+ }
@@ -0,0 +1,214 @@
1
+ import { IStore } from "../SubPackages/react/jsx";
2
+ import {
3
+ IBaseTest,
4
+ ITestSpecification,
5
+ ITestImplementation,
6
+ } from "../Types.js";
7
+
8
+ import { ITestInterface, IUtils } from "./types.js";
9
+ import {
10
+ DefaultTestInterface,
11
+ ILogWriter,
12
+ ITTestResourceConfiguration,
13
+ ITTestResourceRequest,
14
+ ITestArtifactory,
15
+ ITestJob,
16
+ defaultTestResourceRequirement,
17
+ } from "./index.js";
18
+ import {
19
+ BaseSuite,
20
+ BaseGiven,
21
+ BaseWhen,
22
+ BaseThen,
23
+ BaseCheck,
24
+ } from "./abstractBase.js";
25
+ import { ClassBuilder } from "./classBuilder.js";
26
+
27
+ export default abstract class Testeranto<
28
+ ITestShape extends IBaseTest
29
+ > extends ClassBuilder<ITestShape> {
30
+ constructor(
31
+ input: ITestShape["iinput"],
32
+ testSpecification: ITestSpecification<ITestShape>,
33
+ testImplementation: ITestImplementation<ITestShape>,
34
+ testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
35
+ logWriter: ILogWriter,
36
+ testInterface: Partial<ITestInterface<ITestShape>>
37
+ ) {
38
+ const fullTestInterface = DefaultTestInterface(testInterface);
39
+
40
+ super(
41
+ testImplementation,
42
+ testSpecification,
43
+ input,
44
+
45
+ class extends BaseSuite<ITestShape> {
46
+ assertThat(t) {
47
+ fullTestInterface.assertThis(t);
48
+ }
49
+
50
+ async setup(
51
+ s: ITestShape["iinput"],
52
+ artifactory: ITestArtifactory,
53
+ tr,
54
+ utils
55
+ ): Promise<ITestShape["isubject"]> {
56
+ return (
57
+ fullTestInterface.beforeAll ||
58
+ (async (
59
+ input: ITestShape["iinput"],
60
+ artifactory: ITestArtifactory,
61
+ tr,
62
+ utils: ITestInterface<ITestShape>
63
+ ) => input as any)
64
+ )(s, this.testResourceConfiguration, artifactory, utils);
65
+ }
66
+ } as any,
67
+
68
+ class Given extends BaseGiven<ITestShape> {
69
+ async givenThat(subject, testResource, artifactory, initializer) {
70
+ return fullTestInterface.beforeEach(
71
+ subject,
72
+ initializer,
73
+ (fPath: string, value: unknown) =>
74
+ // TODO does not work?
75
+ artifactory(`beforeEach/${fPath}`, value),
76
+ testResource,
77
+ this.initialValues
78
+ // utils,
79
+ );
80
+ }
81
+
82
+ afterEach(
83
+ store: ITestShape["istore"],
84
+ key: string,
85
+ artifactory,
86
+ utils
87
+ ): Promise<unknown> {
88
+ return new Promise((res) =>
89
+ res(
90
+ fullTestInterface.afterEach(
91
+ store,
92
+ key,
93
+ (fPath: string, value: unknown) =>
94
+ artifactory(`after/${fPath}`, value),
95
+ utils
96
+ )
97
+ )
98
+ );
99
+ }
100
+ afterAll(store: IStore, artifactory: ITestArtifactory, utils: IUtils) {
101
+ const pagesHandler = {
102
+ get(target, prop) {
103
+ console.log(`Getting pages property ${prop}`);
104
+ return target[prop];
105
+ },
106
+ };
107
+
108
+ const browserHandler = {
109
+ get(target, prop) {
110
+ console.log(`Getting browser property ${prop}`);
111
+ if (prop === "pages") {
112
+ // return target[prop];
113
+ return new Proxy(target[prop], pagesHandler);
114
+ } else {
115
+ return target[prop];
116
+ }
117
+ },
118
+ };
119
+ const proxy = new Proxy(utils.browser, browserHandler);
120
+
121
+ return fullTestInterface.afterAll(
122
+ store,
123
+ (fPath: string, value: unknown) =>
124
+ // TODO does not work?
125
+ {
126
+ artifactory(`afterAll4-${this.name}/${fPath}`, value);
127
+ },
128
+ utils
129
+ // {
130
+ // ...utils,
131
+ // browser: proxy,
132
+ // }
133
+ );
134
+ }
135
+ } as any,
136
+
137
+ class When extends BaseWhen<ITestShape> {
138
+ async andWhen(store, whenCB, testResource) {
139
+ return await fullTestInterface.andWhen(store, whenCB, testResource);
140
+ }
141
+ } as any,
142
+
143
+ class Then extends BaseThen<ITestShape> {
144
+ async butThen(
145
+ store: any,
146
+ thenCB,
147
+ testResourceConfiguration?: any
148
+ ): Promise<ITestShape["iselection"]> {
149
+ return await fullTestInterface.butThen(
150
+ store,
151
+ thenCB,
152
+ testResourceConfiguration
153
+ );
154
+ }
155
+ } as any,
156
+
157
+ class Check extends BaseCheck<ITestShape> {
158
+ initialValues: any;
159
+
160
+ constructor(
161
+ name: string,
162
+ features: string[],
163
+ checkCallback: (a, b) => any,
164
+ whens,
165
+ thens,
166
+ initialValues: any
167
+ ) {
168
+ super(name, features, checkCallback, whens, thens);
169
+ this.initialValues = initialValues;
170
+ }
171
+
172
+ async checkThat(subject, testResourceConfiguration, artifactory) {
173
+ return fullTestInterface.beforeEach(
174
+ subject,
175
+ this.initialValues,
176
+ (fPath: string, value: unknown) =>
177
+ artifactory(`before/${fPath}`, value),
178
+ testResourceConfiguration,
179
+ this.initialValues
180
+ );
181
+ }
182
+
183
+ afterEach(
184
+ store: ITestShape["istore"],
185
+ key: string,
186
+ artifactory,
187
+ utils
188
+ ): Promise<unknown> {
189
+ return new Promise((res) =>
190
+ res(
191
+ fullTestInterface.afterEach(
192
+ store,
193
+ key,
194
+ (fPath: string, value: unknown) =>
195
+ // TODO does not work?
196
+ artifactory(`afterEach2-${this.name}/${fPath}`, value),
197
+ utils
198
+ )
199
+ )
200
+ );
201
+ }
202
+ } as any,
203
+
204
+ testResourceRequirement,
205
+ logWriter
206
+ );
207
+ }
208
+
209
+ abstract receiveTestResourceConfig(
210
+ t: ITestJob,
211
+ partialTestResource: ITTestResourceConfiguration,
212
+ utils: IUtils
213
+ );
214
+ }
@@ -0,0 +1,117 @@
1
+ import { IBaseTest } from "../Types.js";
2
+
3
+ import {
4
+ IGivens,
5
+ BaseCheck,
6
+ BaseSuite,
7
+ BaseWhen,
8
+ BaseThen,
9
+ } from "./abstractBase.js";
10
+
11
+ import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
12
+
13
+ export const BaseTestInterface: ITestInterface<IBaseTest> = {
14
+ beforeAll: async (s) => s,
15
+ beforeEach: async function (
16
+ subject: any,
17
+ initialValues: any,
18
+ testResource: any
19
+ ) {
20
+ return subject as any;
21
+ },
22
+ afterEach: async (s) => s,
23
+ afterAll: (store: IBaseTest["istore"]) => undefined,
24
+ butThen: async (store: IBaseTest["istore"], thenCb) => thenCb(store),
25
+ andWhen: (a) => a,
26
+ assertThis: () => null,
27
+ };
28
+
29
+ export const DefaultTestInterface = (
30
+ p: Partial<ITestInterface<any>>
31
+ ): ITestInterface<any> => {
32
+ return {
33
+ ...BaseTestInterface,
34
+ ...p,
35
+ };
36
+ };
37
+
38
+ export type ITTestResourceConfiguration = {
39
+ name: string;
40
+ fs: string;
41
+ ports: number[];
42
+ scheduled: boolean;
43
+ };
44
+
45
+ export type ITTestResourceRequirement = {
46
+ name: string;
47
+ ports: number;
48
+ fs: string;
49
+ };
50
+
51
+ export type ITTestResourceRequest = {
52
+ ports: number;
53
+ };
54
+
55
+ export type ITLog = (...string) => void;
56
+
57
+ export type ILogWriter = {
58
+ createWriteStream: (line: string) => any | any;
59
+ writeFileSync: (fp: string, contents: string) => any;
60
+ mkdirSync: (fp: string) => any;
61
+ testArtiFactoryfileWriter: (
62
+ tLog: ITLog,
63
+ n: (Promise) => void
64
+ ) => (fPath: string, value: unknown) => void;
65
+ };
66
+
67
+ export type ITestArtificer = (key: string, data: any) => void;
68
+
69
+ type ITest = {
70
+ toObj(): object;
71
+ name: string;
72
+ givens: IGivens<IBaseTest>;
73
+ checks: BaseCheck<IBaseTest>[];
74
+ testResourceConfiguration: ITTestResourceConfiguration;
75
+ };
76
+
77
+ export type ITestJob<T = INodeUtils | IWebUtils> = {
78
+ toObj(): object;
79
+ test: ITest;
80
+ runner: (
81
+ x: ITTestResourceConfiguration,
82
+ t: ITLog
83
+ ) => Promise<BaseSuite<IBaseTest>>;
84
+ testResourceRequirement: ITTestResourceRequirement;
85
+ receiveTestResourceConfig: (
86
+ testResource,
87
+ utils: T
88
+ ) => Promise<{
89
+ failed: number;
90
+ artifacts: Promise<unknown>[];
91
+ logPromise: Promise<unknown>;
92
+ }>;
93
+ };
94
+
95
+ export type ITestResults = Promise<{ test: ITest }>[];
96
+
97
+ export const defaultTestResourceRequirement: ITTestResourceRequest = {
98
+ ports: 0,
99
+ };
100
+
101
+ export type ITestArtifactory = (key: string, value: unknown) => unknown;
102
+
103
+ export type ITestCheckCallback<ITestShape extends IBaseTest> = {
104
+ [K in keyof ITestShape["checks"]]: (
105
+ name: string,
106
+ features: string[],
107
+ callbackA: (
108
+ whens: {
109
+ [K in keyof ITestShape["whens"]]: (...unknown) => BaseWhen<ITestShape>;
110
+ },
111
+ thens: {
112
+ [K in keyof ITestShape["thens"]]: (...unknown) => BaseThen<ITestShape>;
113
+ }
114
+ ) => Promise<any>,
115
+ ...xtrasA: ITestShape["checks"][K]
116
+ ) => BaseCheck<ITestShape>;
117
+ };
@@ -0,0 +1,206 @@
1
+ import { IBaseTest } from "../Types";
2
+
3
+ import puppeteer from "puppeteer-core";
4
+ import {
5
+ IGivens,
6
+ BaseCheck,
7
+ BaseSuite,
8
+ BaseGiven,
9
+ BaseWhen,
10
+ BaseThen,
11
+ } from "./abstractBase";
12
+ import { ITTestResourceConfiguration, ITestArtificer } from ".";
13
+
14
+ export type IRunTime = `node` | `web`;
15
+
16
+ export type ITestTypes = [string, IRunTime, ITestTypes[]];
17
+
18
+ export type IJsonConfig = {
19
+ outdir: string;
20
+ tests: ITestTypes[];
21
+ features: string;
22
+ };
23
+
24
+ export type IBaseConfig = {
25
+ clearScreen: boolean;
26
+ debugger: boolean;
27
+ devMode: boolean;
28
+ externals: string[];
29
+ features: string;
30
+ minify: boolean;
31
+ nodePlugins: any[];
32
+ outbase: string;
33
+ outdir: string;
34
+ ports: string[];
35
+ tests: ITestTypes[];
36
+ webPlugins: any[];
37
+ };
38
+
39
+ export type IBuiltConfig = { buildDir: string } & IBaseConfig;
40
+
41
+ export type INodeUtils = {
42
+ browser: puppeteer.Browser;
43
+ ipc: Electron.ParentPort;
44
+ };
45
+
46
+ export type IWebUtils = {
47
+ browser: puppeteer.Browser;
48
+ ipc: Electron.IpcRenderer;
49
+ };
50
+ export type IUtils = INodeUtils | IWebUtils;
51
+
52
+ export type IWebTestInterface<ITestShape extends IBaseTest> = {
53
+ assertThis: (x: ITestShape["then"]) => void;
54
+
55
+ andWhen: (
56
+ store: ITestShape["istore"],
57
+ whenCB: ITestShape["when"],
58
+ testResource: ITTestResourceConfiguration
59
+ ) => Promise<ITestShape["istore"]>;
60
+ butThen: (
61
+ store: ITestShape["istore"],
62
+ thenCB,
63
+ testResource: ITTestResourceConfiguration
64
+ ) => Promise<ITestShape["iselection"]>;
65
+
66
+ afterAll: (
67
+ store: ITestShape["istore"],
68
+ artificer: ITestArtificer,
69
+ browser: IWebUtils
70
+ ) => any;
71
+ afterEach: (
72
+ store: ITestShape["istore"],
73
+ key: string,
74
+ artificer: ITestArtificer,
75
+ utils: IWebUtils
76
+ ) => Promise<unknown>;
77
+ beforeAll: (
78
+ input: ITestShape["iinput"],
79
+ testResource: ITTestResourceConfiguration,
80
+ artificer: ITestArtificer,
81
+ utils: IWebUtils
82
+ ) => Promise<ITestShape["isubject"]>;
83
+ beforeEach: (
84
+ subject: ITestShape["isubject"],
85
+ initializer: (c?) => ITestShape["given"],
86
+ artificer: ITestArtificer,
87
+ testResource: ITTestResourceConfiguration,
88
+ initialValues
89
+ // utils: IUtils
90
+ ) => Promise<ITestShape["istore"]>;
91
+ };
92
+ // & ITestInterface<ITestShape>;
93
+
94
+ export type INodeTestInterface<ITestShape extends IBaseTest> = {
95
+ assertThis: (x: ITestShape["then"]) => void;
96
+ andWhen: (
97
+ store: ITestShape["istore"],
98
+ whenCB: ITestShape["when"],
99
+ testResource: ITTestResourceConfiguration
100
+ ) => Promise<ITestShape["istore"]>;
101
+ butThen: (
102
+ store: ITestShape["istore"],
103
+ thenCB,
104
+ testResource: ITTestResourceConfiguration
105
+ ) => Promise<ITestShape["iselection"]>;
106
+ afterAll: (
107
+ store: ITestShape["istore"],
108
+ artificer: ITestArtificer,
109
+ utils: INodeUtils
110
+ ) => any;
111
+ afterEach: (
112
+ store: ITestShape["istore"],
113
+ key: string,
114
+ artificer: ITestArtificer,
115
+ utils: INodeUtils
116
+ ) => Promise<unknown>;
117
+ beforeAll: (
118
+ input: ITestShape["iinput"],
119
+ testResource: ITTestResourceConfiguration,
120
+ artificer: ITestArtificer,
121
+ utils: INodeUtils
122
+ ) => Promise<ITestShape["isubject"]>;
123
+ beforeEach: (
124
+ subject: ITestShape["isubject"],
125
+ initializer: (c?) => ITestShape["given"],
126
+ artificer: ITestArtificer,
127
+ testResource: ITTestResourceConfiguration,
128
+ initialValues
129
+ // utils: IUtils
130
+ ) => Promise<ITestShape["istore"]>;
131
+ };
132
+ // & ITestInterface<ITestShape>;
133
+
134
+ export type ITestInterface<ITestShape extends IBaseTest> = {
135
+ assertThis: (x: ITestShape["then"]) => void;
136
+
137
+ andWhen: (
138
+ store: ITestShape["istore"],
139
+ whenCB: ITestShape["when"],
140
+ testResource: ITTestResourceConfiguration
141
+ ) => Promise<ITestShape["istore"]>;
142
+ butThen: (
143
+ store: ITestShape["istore"],
144
+ thenCB,
145
+ testResource: ITTestResourceConfiguration
146
+ ) => Promise<ITestShape["iselection"]>;
147
+
148
+ afterAll: (
149
+ store: ITestShape["istore"],
150
+ artificer: ITestArtificer,
151
+ utils: IUtils
152
+ ) => any;
153
+ afterEach: (
154
+ store: ITestShape["istore"],
155
+ key: string,
156
+ artificer: ITestArtificer,
157
+ utils: IUtils
158
+ ) => Promise<unknown>;
159
+ beforeAll: (
160
+ input: ITestShape["iinput"],
161
+ testResource: ITTestResourceConfiguration,
162
+ artificer: ITestArtificer,
163
+ utils: IUtils
164
+ ) => Promise<ITestShape["isubject"]>;
165
+ beforeEach: (
166
+ subject: ITestShape["isubject"],
167
+ initializer: (c?) => ITestShape["given"],
168
+ artificer: ITestArtificer,
169
+ testResource: ITTestResourceConfiguration,
170
+ initialValues
171
+ // utils: IUtils
172
+ ) => Promise<ITestShape["istore"]>;
173
+ };
174
+
175
+ export type ISuiteKlasser<ITestShape extends IBaseTest> = (
176
+ name: string,
177
+ index: number,
178
+ givens: IGivens<ITestShape>,
179
+ checks: BaseCheck<ITestShape>[]
180
+ ) => BaseSuite<ITestShape>;
181
+
182
+ export type IGivenKlasser<ITestShape extends IBaseTest> = (
183
+ name,
184
+ features,
185
+ whens,
186
+ thens,
187
+ givenCB
188
+ ) => BaseGiven<ITestShape>;
189
+
190
+ export type IWhenKlasser<ITestShape extends IBaseTest> = (
191
+ s,
192
+ o
193
+ ) => BaseWhen<ITestShape>;
194
+
195
+ export type IThenKlasser<ITestShape extends IBaseTest> = (
196
+ s,
197
+ o
198
+ ) => BaseThen<ITestShape>;
199
+
200
+ export type ICheckKlasser<ITestShape extends IBaseTest> = (
201
+ n,
202
+ f,
203
+ cb,
204
+ w,
205
+ t
206
+ ) => BaseCheck<ITestShape>;
package/src/preload.ts CHANGED
@@ -1,31 +1,17 @@
1
+ import puppeteer from "puppeteer-core";
2
+
1
3
  import { NodeWriter } from "./NodeWriter";
2
- import { ipcRenderer } from "electron";
4
+ import puppeteerConfiger from "./puppeteerConfiger";
3
5
 
4
6
  (window as any).NodeWriter = NodeWriter;
5
- (window as any).exit = (x) => {
6
- ipcRenderer.invoke('quit-app', x);
7
- }
8
-
9
- var oldLog = console.log;
10
- console.log = function (message) {
11
- ipcRenderer.invoke('web-log', message.toString());
12
- oldLog.apply(console, arguments);
13
- };
14
-
15
- var oldLog = console.error;
16
- console.error = function (message) {
17
- ipcRenderer.invoke('web-error', message.toString());
18
- oldLog.apply(console, arguments);
19
- };
20
-
21
- var oldLog = console.warn;
22
- console.warn = function (message) {
23
- ipcRenderer.invoke('web-warn', message.toString());
24
- oldLog.apply(console, arguments);
25
- };
26
7
 
27
- var oldLog = console.info;
28
- console.info = function (message) {
29
- ipcRenderer.invoke('web-info', message.toString());
30
- oldLog.apply(console, arguments);
31
- };
8
+ (window as any).browser = new Promise(async (res, rej) => {
9
+ const browser = await puppeteerConfiger("2999").then(async (json) => {
10
+ const b = await puppeteer.connect({
11
+ browserWSEndpoint: json.webSocketDebuggerUrl,
12
+ defaultViewport: null,
13
+ });
14
+ console.log("connected!", b.isConnected());
15
+ return res(b);
16
+ });
17
+ });