testeranto 0.75.0 → 0.79.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 (257) hide show
  1. package/.eslintrc.js +5 -2
  2. package/Bundle.Dockerfile +52 -0
  3. package/README.md +25 -24
  4. package/build-tests.ts +16 -0
  5. package/dist/common/build-tests.js +38 -0
  6. package/dist/common/init-docs.js +8 -0
  7. package/dist/common/run-tests.js +34 -0
  8. package/dist/common/src/Aider.js +96 -0
  9. package/dist/common/src/Init.js +10 -0
  10. package/dist/common/{Node.js → src/Node.js} +1 -0
  11. package/dist/common/src/PM/index.js +7 -0
  12. package/dist/common/{PM → src/PM}/main.js +287 -10
  13. package/dist/common/{PM → src/PM}/node.js +4 -0
  14. package/dist/common/{PM → src/PM}/web.js +3 -0
  15. package/dist/common/{Project.js → src/Project.js} +15 -57
  16. package/dist/common/{Puppeteer.js → src/Puppeteer.js} +65 -26
  17. package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
  18. package/dist/common/src/SubPackages/react-dom/jsx/web.js +117 -0
  19. package/dist/common/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
  20. package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +2 -2
  21. package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +2 -2
  22. package/dist/common/{Types.js → src/Types.js} +0 -2
  23. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
  24. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +52 -0
  25. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
  26. package/dist/common/src/esbuildConfigs/report.js +14 -0
  27. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
  28. package/dist/common/src/lib/abstractBase.js +581 -0
  29. package/dist/common/{lib → src/lib}/basebuilder.js +12 -38
  30. package/dist/common/{lib → src/lib}/classBuilder.js +1 -3
  31. package/dist/common/{lib → src/lib}/core.js +3 -5
  32. package/dist/common/src/lib/types.js +2 -0
  33. package/dist/common/src/utils.js +16 -0
  34. package/dist/common/testeranto.js +15 -0
  35. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  36. package/dist/module/build-tests.js +10 -0
  37. package/dist/module/init-docs.js +3 -0
  38. package/dist/module/run-tests.js +6 -0
  39. package/dist/module/src/Aider.js +89 -0
  40. package/dist/module/src/Init.js +5 -0
  41. package/dist/module/{Node.js → src/Node.js} +1 -0
  42. package/dist/module/src/PM/index.js +3 -0
  43. package/dist/module/src/PM/main.js +617 -0
  44. package/dist/module/{PM → src/PM}/node.js +4 -0
  45. package/dist/module/{PM → src/PM}/web.js +3 -0
  46. package/dist/module/{Project.js → src/Project.js} +15 -57
  47. package/dist/module/{Puppeteer.js → src/Puppeteer.js} +65 -26
  48. package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
  49. package/dist/module/src/SubPackages/react-dom/jsx/web.js +89 -0
  50. package/dist/module/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
  51. package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +1 -1
  52. package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +1 -1
  53. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
  54. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +47 -0
  55. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
  56. package/dist/module/src/esbuildConfigs/report.js +14 -0
  57. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
  58. package/dist/module/src/lib/abstractBase.js +573 -0
  59. package/dist/module/{lib → src/lib}/basebuilder.js +12 -38
  60. package/dist/module/{lib → src/lib}/classBuilder.js +1 -3
  61. package/dist/module/{lib → src/lib}/core.js +3 -5
  62. package/dist/module/src/utils.js +9 -0
  63. package/dist/module/testeranto.js +13 -0
  64. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  65. package/dist/types/build-tests.d.ts +3 -0
  66. package/dist/types/init-docs.d.ts +2 -0
  67. package/dist/types/run-tests.d.ts +2 -0
  68. package/dist/types/src/Aider.d.ts +1 -0
  69. package/dist/types/src/Init.d.ts +2 -0
  70. package/dist/types/src/Node.d.ts +6 -0
  71. package/dist/types/{PM → src/PM}/index.d.ts +3 -2
  72. package/dist/types/{PM → src/PM}/main.d.ts +6 -3
  73. package/dist/types/{PM → src/PM}/node.d.ts +2 -0
  74. package/dist/types/{PM → src/PM}/web.d.ts +1 -0
  75. package/dist/types/{Project.d.ts → src/Project.d.ts} +1 -1
  76. package/dist/types/src/Puppeteer.d.ts +2 -0
  77. package/dist/types/src/SubPackages/puppeteer.d.ts +6 -0
  78. package/dist/types/{SubPackages → src/SubPackages}/react/component/node.d.ts +1 -1
  79. package/dist/types/{SubPackages → src/SubPackages}/react/component/web.d.ts +1 -1
  80. package/dist/types/src/SubPackages/react/jsx/node.d.ts +4 -0
  81. package/dist/types/src/SubPackages/react/jsx/web.d.ts +4 -0
  82. package/dist/types/{SubPackages → src/SubPackages}/react-dom/component/node.d.ts +2 -2
  83. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +11 -0
  84. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +6 -0
  85. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +5 -0
  86. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  87. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/index.d.ts +0 -7
  88. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
  89. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/node.d.ts +1 -2
  90. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +3 -0
  91. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.d.ts +1 -1
  92. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.d.ts +1 -1
  93. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.d.ts +1 -2
  94. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.d.ts +1 -2
  95. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +4 -0
  96. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +4 -0
  97. package/dist/types/src/Types.d.ts +51 -0
  98. package/dist/types/src/Web.d.ts +6 -0
  99. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
  100. package/dist/types/{lib → src/lib}/abstractBase.d.ts +8 -8
  101. package/dist/types/{lib → src/lib}/basebuilder.d.ts +1 -1
  102. package/dist/types/{lib → src/lib}/classBuilder.d.ts +1 -1
  103. package/dist/types/{lib → src/lib}/core.d.ts +1 -1
  104. package/dist/types/{lib → src/lib}/index.d.ts +5 -5
  105. package/dist/types/{lib → src/lib}/types.d.ts +15 -15
  106. package/dist/types/src/utils.d.ts +2 -0
  107. package/dist/types/testeranto.d.ts +16 -0
  108. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  109. package/docker-compose.yml +37 -0
  110. package/init-docs.ts +5 -0
  111. package/package.json +72 -25
  112. package/run-tests.ts +9 -0
  113. package/src/Aider.ts +125 -0
  114. package/src/Init.ts +20 -0
  115. package/src/Node.ts +31 -2
  116. package/src/PM/index.ts +7 -84
  117. package/src/PM/main.ts +400 -16
  118. package/src/PM/node.ts +6 -0
  119. package/src/PM/web.ts +4 -0
  120. package/src/Project.ts +33 -84
  121. package/src/Puppeteer.ts +115 -62
  122. package/src/SubPackages/react-dom/component/web.ts +10 -30
  123. package/src/SubPackages/react-dom/jsx/web.ts +110 -76
  124. package/src/SubPackages/react-test-renderer/component/index.ts +0 -66
  125. package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
  126. package/src/SubPackages/react-test-renderer/component/node.ts +2 -1
  127. package/src/SubPackages/react-test-renderer/component/web.ts +2 -1
  128. package/src/Types.ts +138 -29
  129. package/src/Web.ts +32 -2
  130. package/src/esbuildConfigs/index.ts +1 -0
  131. package/src/esbuildConfigs/inputFilesPlugin.ts +67 -0
  132. package/src/esbuildConfigs/node.ts +4 -2
  133. package/src/esbuildConfigs/report.ts +13 -13
  134. package/src/esbuildConfigs/web.ts +4 -0
  135. package/src/lib/abstractBase.ts +366 -36
  136. package/src/lib/basebuilder.ts +26 -52
  137. package/src/lib/classBuilder.ts +14 -2
  138. package/src/lib/core.ts +18 -7
  139. package/src/lib/index.ts +115 -7
  140. package/src/lib/types.ts +143 -37
  141. package/src/utils.ts +15 -0
  142. package/testeranto.ts +13 -0
  143. package/tsconfig.common.json +12 -4
  144. package/tsconfig.json +9 -3
  145. package/tsconfig.module.json +2 -3
  146. package/tsconfig.types.json +1 -2
  147. package/dist/common/Features.js +0 -84
  148. package/dist/common/PM/index.js +0 -71
  149. package/dist/common/Reporter.js +0 -119
  150. package/dist/common/Scheduler.js +0 -1
  151. package/dist/common/SubPackages/react-dom/jsx/web.js +0 -93
  152. package/dist/common/esbuildConfigs/report.js +0 -13
  153. package/dist/common/lib/abstractBase.js +0 -348
  154. package/dist/common/preload.js +0 -15
  155. package/dist/common/report.html.js +0 -31
  156. package/dist/module/Features.js +0 -73
  157. package/dist/module/PM/index.js +0 -67
  158. package/dist/module/PM/main.js +0 -340
  159. package/dist/module/Reporter.js +0 -114
  160. package/dist/module/Scheduler.js +0 -1
  161. package/dist/module/SubPackages/react-dom/jsx/web.js +0 -65
  162. package/dist/module/Types.js +0 -3
  163. package/dist/module/esbuildConfigs/report.js +0 -11
  164. package/dist/module/lib/abstractBase.js +0 -340
  165. package/dist/module/preload.js +0 -15
  166. package/dist/module/report.html.js +0 -29
  167. package/dist/prebuild/Report.css +0 -11358
  168. package/dist/prebuild/Report.js +0 -37585
  169. package/dist/types/Features.d.ts +0 -68
  170. package/dist/types/Node.d.ts +0 -6
  171. package/dist/types/SubPackages/puppeteer.d.ts +0 -6
  172. package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
  173. package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
  174. package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -5
  175. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -6
  176. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
  177. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  178. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
  179. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
  180. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
  181. package/dist/types/Types.d.ts +0 -50
  182. package/dist/types/Web.d.ts +0 -6
  183. package/dist/types/esbuildConfigs/report.d.ts +0 -4
  184. package/dist/types/preload.d.ts +0 -0
  185. package/dist/types/report.html.d.ts +0 -2
  186. package/electronBuild.ts +0 -32
  187. package/src/Features.ts +0 -118
  188. package/src/Report.tsx +0 -521
  189. package/src/Reporter.ts +0 -134
  190. package/src/Scheduler.ts +0 -0
  191. package/src/preload.ts +0 -17
  192. package/src/report.html.ts +0 -29
  193. package/tests/Rectangle.test.ts +0 -189
  194. /package/dist/common/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  195. /package/dist/common/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  196. /package/dist/common/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  197. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  198. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  199. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  200. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  201. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  202. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  203. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  204. /package/dist/common/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
  205. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  206. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  207. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
  208. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  209. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  210. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  211. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  212. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  213. /package/dist/common/{Web.js → src/Web.js} +0 -0
  214. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  215. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  216. /package/dist/common/{lib → src/lib}/index.js +0 -0
  217. /package/dist/common/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  218. /package/dist/common/{web.html.js → src/web.html.js} +0 -0
  219. /package/dist/module/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  220. /package/dist/module/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  221. /package/dist/module/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  222. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  223. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  224. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  225. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  226. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  227. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  228. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  229. /package/dist/module/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
  230. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  231. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  232. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
  233. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  234. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  235. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  236. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  237. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  238. /package/dist/{types/Puppeteer.d.ts → module/src/Types.js} +0 -0
  239. /package/dist/module/{Web.js → src/Web.js} +0 -0
  240. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  241. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  242. /package/dist/module/{lib → src/lib}/index.js +0 -0
  243. /package/dist/{types/Reporter.d.ts → module/src/lib/types.js} +0 -0
  244. /package/dist/module/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  245. /package/dist/module/{web.html.js → src/web.html.js} +0 -0
  246. /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/index.d.ts +0 -0
  247. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/index.d.ts +0 -0
  248. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.d.ts +0 -0
  249. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.d.ts +0 -0
  250. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/features.d.ts +0 -0
  251. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/index.d.ts +0 -0
  252. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/node.d.ts +0 -0
  253. /package/dist/types/{Scheduler.d.ts → src/esbuildConfigs/report.d.ts} +0 -0
  254. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/tests.d.ts +0 -0
  255. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/web.d.ts +0 -0
  256. /package/dist/types/{puppeteerConfiger.d.ts → src/puppeteerConfiger.d.ts} +0 -0
  257. /package/dist/types/{web.html.d.ts → src/web.html.d.ts} +0 -0
@@ -1,4 +1,6 @@
1
1
  import React, { useEffect, useRef } from "react";
2
+ import { CElement, createElement } from "react";
3
+ import ReactDom from "react-dom/client";
2
4
  import { createPortal } from "react-dom";
3
5
 
4
6
  import Testeranto from "../../../Web.js";
@@ -12,91 +14,123 @@ import type { IInput, ISelection, IStore } from "./index";
12
14
 
13
15
  export type ISubject = HTMLElement;
14
16
 
17
+ const TesterantoComponent = ({
18
+ done,
19
+ innerComp,
20
+ }: {
21
+ done: (ref: React.MutableRefObject<any>) => any;
22
+ innerComp: IInput;
23
+ }) => {
24
+ const myContainer = useRef<any>(null);
25
+ useEffect(() => {
26
+ console.log("useEffect called!", myContainer.current);
27
+ done(myContainer.current);
28
+ }, []);
29
+
30
+ return React.createElement("div", { ref: myContainer }, innerComp());
31
+ };
32
+
15
33
  export default <ITestShape extends IBaseTest>(
16
34
  testImplementations: ITestImplementation<ITestShape>,
17
35
  testSpecifications: ITestSpecification<ITestShape>,
18
36
  testInput: IInput
19
37
  ) => {
20
- document.addEventListener("DOMContentLoaded", function () {
21
- const rootElement = document.getElementById("root");
22
- if (rootElement) {
23
- const TesterantoComponent = function ({
24
- done,
25
- innerComp,
26
- }: {
27
- done: (ref: React.MutableRefObject<any>) => any;
28
- innerComp: IInput;
29
- }) {
30
- const myContainer = useRef<any>(null);
31
- useEffect(() => {
32
- console.log("useEffect called", myContainer.current);
33
- done(myContainer.current);
34
- }, []);
38
+ const t = Testeranto<ITestShape>(
39
+ testInput,
40
+ testSpecifications,
41
+ testImplementations,
42
+ {
43
+ beforeAll: async (reactElement, itr): Promise<any> => {
44
+ return await new Promise((resolve, rej) => {
45
+ const htmlElement = document.getElementById("root");
35
46
 
36
- return React.createElement("div", { ref: myContainer }, innerComp());
37
- };
47
+ if (htmlElement) {
48
+ const domRoot = ReactDom.createRoot(htmlElement);
38
49
 
39
- Testeranto<ITestShape>(
40
- testInput,
41
- testSpecifications,
42
- testImplementations,
43
- {
44
- beforeAll: async (input, artificer): Promise<HTMLElement> => {
45
- return await new Promise((resolve, rej) => {
46
- resolve(rootElement);
47
- });
48
- },
49
-
50
- beforeEach: async (
51
- subject,
52
- ndx,
53
- testRsource,
54
- artificer
55
- ): Promise<IStore> => {
56
- return new Promise((resolve, rej) => {
57
- createPortal(
58
- TesterantoComponent({
59
- innerComp: testInput,
60
- done: (reactElement: any) => {
61
- process.nextTick(() => {
62
- resolve(reactElement);
50
+ domRoot.render(
51
+ createElement(
52
+ TesterantoComponent,
53
+ {
54
+ // ...initialProps,
55
+ innerComp: reactElement,
56
+ done: (reactElement) => {
57
+ resolve({
58
+ htmlElement,
59
+ reactElement,
60
+ domRoot,
63
61
  });
64
62
  },
65
- }),
66
- rootElement
67
- );
68
- });
69
- },
70
- andWhen: function (s: IStore, whenCB): Promise<ISelection> {
71
- return new Promise((resolve, rej) => {
72
- process.nextTick(() => {
73
- resolve(whenCB()(s));
74
- });
75
- });
76
- },
77
- butThen: async function (s: IStore): Promise<ISelection> {
78
- return new Promise((resolve, rej) => {
79
- process.nextTick(() => {
80
- resolve(s);
81
- });
82
- });
83
- },
84
- afterEach: async function (store: IStore, ndx, artificer) {
85
- return new Promise((resolve, rej) => {
86
- process.nextTick(() => {
87
- resolve({});
88
- });
89
- });
90
- },
91
- afterAll: (store: IStore, artificer) => {
92
- return new Promise((resolve, rej) => {
93
- process.nextTick(() => {
94
- resolve({});
95
- });
96
- });
97
- },
98
- }
99
- );
63
+ },
64
+ []
65
+ )
66
+ );
67
+
68
+ // resolve({ htmlElement });
69
+ }
70
+ });
71
+ },
72
+
73
+ beforeEach: async (
74
+ subject,
75
+ initializer,
76
+ artificer,
77
+ testResource,
78
+ pm
79
+ ): Promise<IStore> => {
80
+ return new Promise((resolve, rej) => {
81
+ resolve(subject);
82
+ // const tc = TesterantoComponent({
83
+ // innerComp: () =>
84
+ // testInput({
85
+ // port: 3003,
86
+ // address: "some-address",
87
+ // secretKey: "someSecretKey",
88
+ // abi: "foo",
89
+ // }),
90
+ // done: (reactElement: any) => {
91
+ // console.log("mark9");
92
+ // resolve(reactElement);
93
+ // // process.nextTick(() => {
94
+ // // resolve(reactElement);
95
+ // // });
96
+ // },
97
+ // });
98
+ // console.log("mark9", tc);
99
+ // createPortal(tc, subject.domRoot);
100
+ });
101
+ },
102
+ andWhen: function (s: IStore, whenCB, tr, utils): Promise<ISelection> {
103
+ return new Promise((resolve, rej) => {
104
+ console.log("mark9", s, whenCB);
105
+ resolve(whenCB(s, utils));
106
+ // process.nextTick(() => {
107
+ // resolve(whenCB()(s));
108
+ // });
109
+ });
110
+ },
111
+ butThen: async function (s: IStore, thenCB): Promise<ISelection> {
112
+ return new Promise((resolve, rej) => {
113
+ resolve(thenCB(s));
114
+ });
115
+ },
116
+ afterEach: async function (store: IStore, ndx, artificer) {
117
+ return new Promise((resolve, rej) => {
118
+ resolve({});
119
+ });
120
+ },
121
+ afterAll: (store: IStore, artificer) => {
122
+ return new Promise((resolve, rej) => {
123
+ resolve({});
124
+ });
125
+ },
126
+ }
127
+ );
128
+
129
+ document.addEventListener("DOMContentLoaded", function () {
130
+ const rootElement = document.getElementById("root");
131
+ if (rootElement) {
100
132
  }
101
133
  });
134
+
135
+ return t;
102
136
  };
@@ -21,69 +21,3 @@ export type IImpl<ITestShape extends IBaseTest> =
21
21
  ITestImplementation<ITestShape>;
22
22
  export type ISpec<ITestShape extends IBaseTest> =
23
23
  ITestSpecification<ITestShape>;
24
-
25
- // export const testInterface = {
26
- // beforeEach: function (CComponent, props): Promise<renderer.ReactTestRenderer> {
27
- // return new Promise((res, rej) => {
28
- // let component: renderer.ReactTestRenderer;
29
- // act(() => {
30
- // component = renderer.create(
31
- // CComponent(props)
32
- // );
33
- // res(component);
34
- // });
35
- // });
36
- // },
37
- // andWhen: async function (
38
- // renderer: renderer.ReactTestRenderer,
39
- // whenCB: () => (any) => any
40
- // ): Promise<renderer.ReactTestRenderer> {
41
- // await act(() => whenCB()(renderer));
42
- // return renderer
43
- // }
44
- // }
45
-
46
- export const testInterface = {
47
- beforeEach: function (
48
- CComponent,
49
- propsAndChildren
50
- ): Promise<renderer.ReactTestRenderer> {
51
- function Link(props) {
52
- const p = props.props;
53
- const c = props.children;
54
- return React.createElement(CComponent, p, c);
55
- }
56
- return new Promise((res, rej) => {
57
- act(async () => {
58
- const p = propsAndChildren;
59
- const y = new CComponent(p.props);
60
- const testRenderer = await renderer.create(Link(propsAndChildren));
61
- res(testRenderer);
62
- });
63
- });
64
- },
65
- andWhen: async function (
66
- renderer: renderer.ReactTestRenderer,
67
- whenCB: any
68
- ): Promise<renderer.ReactTestRenderer> {
69
- // console.log("andWhen", whenCB)
70
- await act(() => whenCB(renderer));
71
- return renderer;
72
- },
73
-
74
- // andWhen: function (s: Store, whenCB): Promise<Selection> {
75
- // return whenCB()(s);
76
- // },
77
- butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
78
- console.log("butThen", thenCB.toString());
79
- return thenCB(s);
80
- },
81
- afterEach: async function (store: IStore, ndx, artificer) {
82
- // console.log("afterEach", store);
83
- return {};
84
- },
85
- afterAll: (store: IStore, artificer) => {
86
- // console.log("afterAll", store);
87
- return;
88
- },
89
- };
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import renderer, { act } from "react-test-renderer";
3
+ import { ISelection, IStore } from ".";
4
+
5
+ export const testInterface = {
6
+ beforeEach: function (
7
+ CComponent,
8
+ propsAndChildren
9
+ ): Promise<renderer.ReactTestRenderer> {
10
+ function Link(props) {
11
+ const p = props.props;
12
+ const c = props.children;
13
+ return React.createElement(CComponent, p, c);
14
+ }
15
+ return new Promise((res, rej) => {
16
+ act(async () => {
17
+ const p = propsAndChildren;
18
+ const y = new CComponent(p.props);
19
+ const testRenderer = await renderer.create(Link(propsAndChildren));
20
+ res(testRenderer);
21
+ });
22
+ });
23
+ },
24
+ andWhen: async function (
25
+ renderer: renderer.ReactTestRenderer,
26
+ whenCB: any
27
+ ): Promise<renderer.ReactTestRenderer> {
28
+ // console.log("andWhen", whenCB)
29
+ await act(() => whenCB(renderer));
30
+ return renderer;
31
+ },
32
+
33
+ // andWhen: function (s: Store, whenCB): Promise<Selection> {
34
+ // return whenCB()(s);
35
+ // },
36
+ butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
37
+ console.log("butThen", thenCB.toString());
38
+ return thenCB(s);
39
+ },
40
+ afterEach: async function (store: IStore, ndx, artificer) {
41
+ // console.log("afterEach", store);
42
+ return {};
43
+ },
44
+ afterAll: (store: IStore, artificer) => {
45
+ // console.log("afterAll", store);
46
+ return;
47
+ },
48
+ };
@@ -1,7 +1,8 @@
1
1
  import Testeranto from "../../../Node.js";
2
2
  import type { IBaseTest } from "../../../Types";
3
3
 
4
- import { IImpl, ISpec, IInput, testInterface } from "./index.js";
4
+ import { IImpl, ISpec, IInput } from "./index.js";
5
+ import { testInterface } from "./interface.js";
5
6
 
6
7
  export default <ITestShape extends IBaseTest, IProps, IState>(
7
8
  testImplementations: IImpl<ITestShape>,
@@ -1,7 +1,8 @@
1
1
  import { IBaseTest } from "../../../Types";
2
2
  import Testeranto from "../../../Web.js";
3
3
 
4
- import { IImpl, ISpec, IInput, testInterface } from "./index.js";
4
+ import { IImpl, ISpec, IInput } from "./index.js";
5
+ import { testInterface } from "./interface";
5
6
 
6
7
  export default <ITestShape extends IBaseTest, IProps, IState>(
7
8
  testImplementations: IImpl<ITestShape>,
package/src/Types.ts CHANGED
@@ -13,17 +13,74 @@ import {
13
13
  ITestInterface,
14
14
  IWebTestInterface,
15
15
  } from "./lib/types.js";
16
+ import { PM } from "./PM/index.js";
16
17
 
17
- export type IPartialInterface<I extends IBaseTest> = Partial<ITestInterface<I>>;
18
+ export type IPartialInterface<
19
+ I extends IBaseTest<
20
+ unknown,
21
+ unknown,
22
+ unknown,
23
+ unknown,
24
+ unknown,
25
+ unknown,
26
+ unknown,
27
+ Record<string, any>,
28
+ Record<string, any>,
29
+ Record<string, any>,
30
+ Record<string, any>,
31
+ Record<string, any>
32
+ >
33
+ > = Partial<ITestInterface<I>>;
18
34
 
19
- export type IPartialNodeInterface<I extends IBaseTest> = Partial<
20
- INodeTestInterface<I>
21
- >;
22
- export type IPartialWebInterface<I extends IBaseTest> = Partial<
23
- IWebTestInterface<I>
24
- >;
35
+ export type IPartialNodeInterface<
36
+ I extends IBaseTest<
37
+ unknown,
38
+ unknown,
39
+ unknown,
40
+ unknown,
41
+ unknown,
42
+ unknown,
43
+ unknown,
44
+ Record<string, any>,
45
+ Record<string, any>,
46
+ Record<string, any>,
47
+ Record<string, any>,
48
+ Record<string, any>
49
+ >
50
+ > = Partial<INodeTestInterface<I>>;
51
+ export type IPartialWebInterface<
52
+ I extends IBaseTest<
53
+ unknown,
54
+ unknown,
55
+ unknown,
56
+ unknown,
57
+ unknown,
58
+ unknown,
59
+ unknown,
60
+ Record<string, any>,
61
+ Record<string, any>,
62
+ Record<string, any>,
63
+ Record<string, any>,
64
+ Record<string, any>
65
+ >
66
+ > = Partial<IWebTestInterface<I>>;
25
67
 
26
- export type IEntry<ITestShape extends IBaseTest> = (
68
+ export type IEntry<
69
+ ITestShape extends IBaseTest<
70
+ unknown,
71
+ unknown,
72
+ unknown,
73
+ unknown,
74
+ unknown,
75
+ unknown,
76
+ unknown,
77
+ Record<string, any>,
78
+ Record<string, any>,
79
+ Record<string, any>,
80
+ Record<string, any>,
81
+ Record<string, any>
82
+ >
83
+ > = (
27
84
  input: ITestShape["iinput"],
28
85
  testSpecification: ITestSpecification<ITestShape>,
29
86
  testImplementation: ITestImplementation<ITestShape, object>,
@@ -31,7 +88,22 @@ export type IEntry<ITestShape extends IBaseTest> = (
31
88
  testResourceRequirement: ITTestResourceRequest
32
89
  ) => Promise<Testeranto<ITestShape>>;
33
90
 
34
- export type ITestSpecification<ITestShape extends IBaseTest> = (
91
+ export type ITestSpecification<
92
+ ITestShape extends IBaseTest<
93
+ unknown,
94
+ unknown,
95
+ unknown,
96
+ unknown,
97
+ unknown,
98
+ unknown,
99
+ unknown,
100
+ Record<string, any>,
101
+ Record<string, any>,
102
+ Record<string, any>,
103
+ Record<string, any>,
104
+ Record<string, any>
105
+ >
106
+ > = (
35
107
  Suite: {
36
108
  [K in keyof ITestShape["suites"]]: (
37
109
  name: string,
@@ -61,7 +133,20 @@ export type ITestSpecification<ITestShape extends IBaseTest> = (
61
133
  ) => any[];
62
134
 
63
135
  export type ITestImplementation<
64
- ITestShape extends IBaseTest,
136
+ ITestShape extends IBaseTest<
137
+ unknown,
138
+ unknown,
139
+ unknown,
140
+ unknown,
141
+ unknown,
142
+ unknown,
143
+ unknown,
144
+ Record<string, any>,
145
+ Record<string, any>,
146
+ Record<string, any>,
147
+ Record<string, any>,
148
+ Record<string, any>
149
+ >,
65
150
  IMod = object
66
151
  > = Modify<
67
152
  {
@@ -76,7 +161,7 @@ export type ITestImplementation<
76
161
  whens: {
77
162
  [K in keyof ITestShape["whens"]]: (
78
163
  ...Iw: ITestShape["whens"][K]
79
- ) => (zel: ITestShape["iselection"]) => ITestShape["when"];
164
+ ) => (zel: ITestShape["iselection"], utils: PM) => ITestShape["when"];
80
165
  };
81
166
  thens: {
82
167
  [K in keyof ITestShape["thens"]]: (
@@ -94,24 +179,48 @@ export type ITestImplementation<
94
179
 
95
180
  type Modify<T, R> = Omit<T, keyof R> & R;
96
181
 
97
- export type IBaseTest<Shape = any, II = Shape> = {
98
- iinput: II;
99
- isubject: Shape;
100
- istore: Shape;
101
- iselection: Shape;
102
- // iinitial;
182
+ // export type IBaseTest<Shape = any, II = Shape> = {
183
+ // iinput: II;
184
+ // isubject: Shape;
185
+ // istore: Shape;
186
+ // iselection: Shape;
187
+ // // iinitial;
103
188
 
104
- given;
105
- when;
106
- then;
107
-
108
- suites: Record<string, any>;
109
- givens: Record<string, any>;
110
- whens: Record<string, any>;
111
- thens: Record<string, any>;
112
- checks: Record<string, any>;
113
- };
114
-
115
- // export type ITTestShape = {
189
+ // given;
190
+ // when;
191
+ // then;
116
192
 
193
+ // suites: Record<string, any>;
194
+ // givens: Record<string, any>;
195
+ // whens: Record<string, any>;
196
+ // thens: Record<string, any>;
197
+ // checks: Record<string, any>;
117
198
  // };
199
+
200
+ export type IBaseTest<
201
+ IInput,
202
+ ISubject,
203
+ IStore,
204
+ ISelection,
205
+ IGiven,
206
+ IWhen,
207
+ IThen,
208
+ ISuites extends Record<string, any>,
209
+ IGivens extends Record<string, any>,
210
+ IWhens extends Record<string, any>,
211
+ IThens extends Record<string, any>,
212
+ IChecks extends Record<string, any>
213
+ > = {
214
+ iinput: IInput;
215
+ isubject: ISubject;
216
+ istore: IStore;
217
+ iselection: ISelection;
218
+ given: IGiven;
219
+ when: IWhen;
220
+ then: IThen;
221
+ suites: ISuites;
222
+ givens: IGivens;
223
+ whens: IWhens;
224
+ thens: IThens;
225
+ checks: IChecks;
226
+ };
package/src/Web.ts CHANGED
@@ -12,7 +12,22 @@ import {
12
12
  } from "./lib/index.js";
13
13
  import { ITestInterface, IWebTestInterface } from "./lib/types";
14
14
 
15
- class WebTesteranto<TestShape extends IBaseTest> extends Testeranto<TestShape> {
15
+ class WebTesteranto<
16
+ TestShape extends IBaseTest<
17
+ unknown,
18
+ unknown,
19
+ unknown,
20
+ unknown,
21
+ unknown,
22
+ unknown,
23
+ unknown,
24
+ Record<string, any>,
25
+ Record<string, any>,
26
+ Record<string, any>,
27
+ Record<string, any>,
28
+ Record<string, any>
29
+ >
30
+ > extends Testeranto<TestShape> {
16
31
  constructor(
17
32
  input: TestShape["iinput"],
18
33
  testSpecification: ITestSpecification<TestShape>,
@@ -55,7 +70,22 @@ class WebTesteranto<TestShape extends IBaseTest> extends Testeranto<TestShape> {
55
70
  }
56
71
  }
57
72
 
58
- export default async <ITestShape extends IBaseTest>(
73
+ export default async <
74
+ ITestShape extends IBaseTest<
75
+ unknown,
76
+ unknown,
77
+ unknown,
78
+ unknown,
79
+ unknown,
80
+ unknown,
81
+ unknown,
82
+ Record<string, any>,
83
+ Record<string, any>,
84
+ Record<string, any>,
85
+ Record<string, any>,
86
+ Record<string, any>
87
+ >
88
+ >(
59
89
  input: ITestShape["iinput"],
60
90
  testSpecification: ITestSpecification<ITestShape>,
61
91
  testImplementation: ITestImplementation<ITestShape>,
@@ -4,6 +4,7 @@ import { IBaseConfig } from "../lib/types";
4
4
 
5
5
  export default (config: IBaseConfig): BuildOptions => {
6
6
  return {
7
+ // packages: "external",
7
8
  target: "esnext",
8
9
  format: "esm",
9
10
  splitting: true,
@@ -0,0 +1,67 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ export default (
5
+ platform: "web" | "node",
6
+ entryPoints: Set<string> | string[]
7
+ ) => {
8
+ console.log("mark3", platform);
9
+
10
+ return {
11
+ name: "metafileWriter",
12
+ setup(build) {
13
+ build.onEnd((result) => {
14
+ if (result.errors.length === 0) {
15
+ entryPoints.forEach((entryPoint) => {
16
+ console.log("mark1", entryPoint);
17
+ const filePath = path.join(
18
+ "./docs/",
19
+ platform,
20
+ entryPoint.split(".").slice(0, -1).join("."),
21
+ `inputFiles.json`
22
+ );
23
+
24
+ const dirName = path.dirname(filePath);
25
+
26
+ if (!fs.existsSync(dirName)) {
27
+ fs.mkdirSync(dirName, { recursive: true });
28
+ }
29
+
30
+ const jsonContent = JSON.stringify(
31
+ Object.keys(
32
+ Object.keys(result.metafile.outputs)
33
+ .filter((s: string) => {
34
+ if (!result.metafile.outputs[s].entryPoint) {
35
+ return false;
36
+ }
37
+ return (
38
+ path.resolve(result.metafile.outputs[s].entryPoint) ===
39
+ path.resolve(entryPoint)
40
+ );
41
+ })
42
+ .reduce((mm: string[], el) => {
43
+ mm.push(result.metafile.outputs[el].inputs);
44
+ return mm;
45
+ }, [])[0]
46
+ )
47
+ .filter((f: string) => {
48
+ const regex = /^src\/.*/g;
49
+ const matches = f.match(regex);
50
+ const passes = matches?.length === 1;
51
+ return passes;
52
+ })
53
+ .filter((f: string) => {
54
+ const regex = /.*\.test\..*/g;
55
+ const matches = f.match(regex);
56
+ const passes = matches?.length === 1;
57
+ return !passes;
58
+ })
59
+ );
60
+
61
+ fs.writeFileSync(filePath, jsonContent);
62
+ });
63
+ }
64
+ });
65
+ },
66
+ };
67
+ };