testeranto 0.79.69 → 0.81.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 (252) hide show
  1. package/.aider.chat.history.md +980 -0
  2. package/.aider.input.history +87 -0
  3. package/.aider.tags.cache.v3/1c/30/af1de2ad7a137afeddb1b01e0c27.val +0 -0
  4. package/.aider.tags.cache.v3/1d/63/88318b65ce58b6bb0487e8ce2656.val +0 -0
  5. package/.aider.tags.cache.v3/2e/67/16ae65530b40038e48e00d666c63.val +0 -0
  6. package/.aider.tags.cache.v3/6f/94/80488a232866fcce7ee657da488b.val +0 -0
  7. package/.aider.tags.cache.v3/cache.db +0 -0
  8. package/.eslintrc.js +5 -2
  9. package/README.md +10 -107
  10. package/build-tests.ts +16 -0
  11. package/dist/common/build-tests.js +38 -0
  12. package/dist/common/init-docs.js +8 -0
  13. package/dist/common/run-tests.js +34 -0
  14. package/dist/common/src/Aider.js +143 -0
  15. package/dist/common/src/Init.js +10 -0
  16. package/dist/common/{PM → src/PM}/main.js +58 -49
  17. package/dist/common/{PM → src/PM}/node.js +1 -1
  18. package/dist/common/{Project.js → src/Project.js} +46 -38
  19. package/dist/common/{Puppeteer.js → src/Puppeteer.js} +51 -40
  20. package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/web.js +37 -38
  21. package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +17 -2
  22. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +79 -0
  23. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -3
  24. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/web.js +4 -4
  25. package/dist/common/{lib → src/lib}/abstractBase.js +80 -24
  26. package/dist/common/{lib → src/lib}/basebuilder.js +14 -3
  27. package/dist/common/{lib → src/lib}/core.js +47 -3
  28. package/dist/common/testeranto.js +15 -0
  29. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  30. package/dist/module/build-tests.js +10 -0
  31. package/dist/module/init-docs.js +3 -0
  32. package/dist/module/run-tests.js +6 -0
  33. package/dist/module/src/Aider.js +136 -0
  34. package/dist/module/src/Init.js +5 -0
  35. package/dist/module/{PM → src/PM}/main.js +58 -49
  36. package/dist/module/{PM → src/PM}/node.js +1 -1
  37. package/dist/module/{Project.js → src/Project.js} +46 -38
  38. package/dist/module/{Puppeteer.js → src/Puppeteer.js} +51 -40
  39. package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/web.js +37 -38
  40. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +34 -0
  41. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +74 -0
  42. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/node.js +4 -2
  43. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/web.js +4 -4
  44. package/dist/module/{lib → src/lib}/abstractBase.js +80 -24
  45. package/dist/module/{lib → src/lib}/basebuilder.js +14 -3
  46. package/dist/module/{lib → src/lib}/core.js +47 -3
  47. package/dist/module/testeranto.js +13 -0
  48. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  49. package/dist/types/build-tests.d.ts +3 -0
  50. package/dist/types/init-docs.d.ts +2 -0
  51. package/dist/types/run-tests.d.ts +2 -0
  52. package/dist/types/src/Aider.d.ts +1 -0
  53. package/dist/types/{PM → src/PM}/index.d.ts +1 -1
  54. package/dist/types/{PM → src/PM}/main.d.ts +7 -1
  55. package/dist/types/{Project.d.ts → src/Project.d.ts} +6 -1
  56. package/dist/types/{Types.d.ts → src/Types.d.ts} +3 -2
  57. package/dist/types/{lib → src/lib}/abstractBase.d.ts +1 -0
  58. package/dist/types/testeranto.d.ts +16 -0
  59. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  60. package/init-docs.ts +5 -0
  61. package/package.json +54 -29
  62. package/run-tests.ts +9 -0
  63. package/secret +1 -0
  64. package/secret.env +2 -0
  65. package/src/Aider.ts +168 -0
  66. package/src/Init.ts +0 -31
  67. package/src/PM/index.ts +1 -1
  68. package/src/PM/main.ts +71 -61
  69. package/src/PM/node.ts +1 -1
  70. package/src/Project.ts +55 -48
  71. package/src/Puppeteer.ts +66 -52
  72. package/src/SubPackages/react-dom/jsx/web.ts +46 -49
  73. package/src/SubPackages/react-test-renderer/jsx/index.ts +25 -2
  74. package/src/Types.ts +3 -1
  75. package/src/esbuildConfigs/inputFilesPlugin.ts +78 -31
  76. package/src/esbuildConfigs/node.ts +2 -2
  77. package/src/esbuildConfigs/web.ts +4 -4
  78. package/src/lib/abstractBase.ts +88 -30
  79. package/src/lib/basebuilder.ts +17 -3
  80. package/src/lib/core.ts +55 -13
  81. package/testeranto.ts +13 -0
  82. package/tsconfig.common.json +12 -4
  83. package/tsconfig.json +9 -2
  84. package/tsconfig.module.json +2 -2
  85. package/tsconfig.types.json +1 -1
  86. package/Report.Dockerfile +0 -44
  87. package/dist/common/Features.js +0 -51
  88. package/dist/common/Init.js +0 -30
  89. package/dist/common/Reporter.js +0 -112
  90. package/dist/common/Scheduler.js +0 -1
  91. package/dist/common/TaskManBackEnd.js +0 -167
  92. package/dist/common/esbuildConfigs/inputFilesPlugin.js +0 -49
  93. package/dist/common/mongooseSchemas.js +0 -56
  94. package/dist/common/preload.js +0 -15
  95. package/dist/common/report.html.js +0 -31
  96. package/dist/module/ExampleTab.js +0 -112
  97. package/dist/module/Features.js +0 -41
  98. package/dist/module/Init.js +0 -25
  99. package/dist/module/Reporter.js +0 -107
  100. package/dist/module/Scheduler.js +0 -1
  101. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -19
  102. package/dist/module/TaskManBackEnd.js +0 -162
  103. package/dist/module/TaskManFrontEnd.js +0 -605
  104. package/dist/module/esbuildConfigs/inputFilesPlugin.js +0 -44
  105. package/dist/module/mongooseSchemas.js +0 -50
  106. package/dist/module/preload.js +0 -15
  107. package/dist/module/report.html.js +0 -29
  108. package/dist/prebuild/TaskManBackEnd.mjs +0 -170
  109. package/dist/prebuild/TaskManFrontEnd.css +0 -12301
  110. package/dist/prebuild/TaskManFrontEnd.js +0 -81262
  111. package/dist/types/Features.d.ts +0 -35
  112. package/dist/types/Reporter.d.ts +0 -1
  113. package/dist/types/Scheduler.d.ts +0 -0
  114. package/dist/types/TaskManBackEnd.d.ts +0 -3
  115. package/dist/types/mongooseSchemas.d.ts +0 -124
  116. package/dist/types/preload.d.ts +0 -0
  117. package/dist/types/report.html.d.ts +0 -2
  118. package/src/ExampleTab.tsx +0 -219
  119. package/src/Features.ts +0 -64
  120. package/src/Reporter.ts +0 -126
  121. package/src/Scheduler.ts +0 -0
  122. package/src/TaskManBackEnd.ts +0 -226
  123. package/src/TaskManFrontEnd.tsx +0 -1254
  124. package/src/mongooseSchemas.ts +0 -105
  125. package/src/preload.ts +0 -17
  126. package/src/report.html.ts +0 -29
  127. package/tests/Rectangle.test.ts +0 -189
  128. package/trash/TaskMan.Dockerfile +0 -23
  129. package/trash/TaskMan1.Dockerfile +0 -43
  130. package/trash/devBot.dockerfile +0 -12
  131. package/trash/docker-compose-dev.yml +0 -9
  132. package/trash/docker-compose-prod.yml +0 -18
  133. package/trash/electronBuild.ts +0 -32
  134. /package/dist/common/{Node.js → src/Node.js} +0 -0
  135. /package/dist/common/{PM → src/PM}/index.js +0 -0
  136. /package/dist/common/{PM → src/PM}/web.js +0 -0
  137. /package/dist/common/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  138. /package/dist/common/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  139. /package/dist/common/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  140. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  141. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  142. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  143. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  144. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/web.js +0 -0
  145. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  146. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  147. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  148. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/index.js +0 -0
  149. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/interface.js +0 -0
  150. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +0 -0
  151. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +0 -0
  152. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  153. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  154. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  155. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  156. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  157. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  158. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  159. /package/dist/common/{Types.js → src/Types.js} +0 -0
  160. /package/dist/common/{Web.js → src/Web.js} +0 -0
  161. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  162. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/index.js +0 -0
  163. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/report.js +0 -0
  164. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  165. /package/dist/common/{lib → src/lib}/classBuilder.js +0 -0
  166. /package/dist/common/{lib → src/lib}/index.js +0 -0
  167. /package/dist/common/{lib → src/lib}/types.js +0 -0
  168. /package/dist/common/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  169. /package/dist/common/{utils.js → src/utils.js} +0 -0
  170. /package/dist/common/{web.html.js → src/web.html.js} +0 -0
  171. /package/dist/module/{Node.js → src/Node.js} +0 -0
  172. /package/dist/module/{PM → src/PM}/index.js +0 -0
  173. /package/dist/module/{PM → src/PM}/web.js +0 -0
  174. /package/dist/module/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  175. /package/dist/module/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  176. /package/dist/module/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  177. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  178. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  179. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  180. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  181. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/web.js +0 -0
  182. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  183. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  184. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  185. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/index.js +0 -0
  186. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/interface.js +0 -0
  187. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +0 -0
  188. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +0 -0
  189. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  190. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  191. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  192. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  193. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  194. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  195. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  196. /package/dist/module/{Types.js → src/Types.js} +0 -0
  197. /package/dist/module/{Web.js → src/Web.js} +0 -0
  198. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  199. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/index.js +0 -0
  200. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/report.js +0 -0
  201. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  202. /package/dist/module/{lib → src/lib}/classBuilder.js +0 -0
  203. /package/dist/module/{lib → src/lib}/index.js +0 -0
  204. /package/dist/module/{lib → src/lib}/types.js +0 -0
  205. /package/dist/module/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  206. /package/dist/module/{utils.js → src/utils.js} +0 -0
  207. /package/dist/module/{web.html.js → src/web.html.js} +0 -0
  208. /package/dist/types/{Init.d.ts → src/Init.d.ts} +0 -0
  209. /package/dist/types/{Node.d.ts → src/Node.d.ts} +0 -0
  210. /package/dist/types/{PM → src/PM}/node.d.ts +0 -0
  211. /package/dist/types/{PM → src/PM}/web.d.ts +0 -0
  212. /package/dist/types/{Puppeteer.d.ts → src/Puppeteer.d.ts} +0 -0
  213. /package/dist/types/{SubPackages → src/SubPackages}/puppeteer.d.ts +0 -0
  214. /package/dist/types/{SubPackages → src/SubPackages}/react/component/node.d.ts +0 -0
  215. /package/dist/types/{SubPackages → src/SubPackages}/react/component/web.d.ts +0 -0
  216. /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/index.d.ts +0 -0
  217. /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/node.d.ts +0 -0
  218. /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/web.d.ts +0 -0
  219. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/component/node.d.ts +0 -0
  220. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/component/web.d.ts +0 -0
  221. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/index.d.ts +0 -0
  222. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/node.d.ts +0 -0
  223. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/web.d.ts +0 -0
  224. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.d.ts +0 -0
  225. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/index.d.ts +0 -0
  226. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/interface.d.ts +0 -0
  227. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/node.d.ts +0 -0
  228. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/web.d.ts +0 -0
  229. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.d.ts +0 -0
  230. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.d.ts +0 -0
  231. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.d.ts +0 -0
  232. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.d.ts +0 -0
  233. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.d.ts +0 -0
  234. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.d.ts +0 -0
  235. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.d.ts +0 -0
  236. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.d.ts +0 -0
  237. /package/dist/types/{Web.d.ts → src/Web.d.ts} +0 -0
  238. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/features.d.ts +0 -0
  239. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/index.d.ts +0 -0
  240. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/inputFilesPlugin.d.ts +0 -0
  241. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/node.d.ts +0 -0
  242. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/report.d.ts +0 -0
  243. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/tests.d.ts +0 -0
  244. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/web.d.ts +0 -0
  245. /package/dist/types/{lib → src/lib}/basebuilder.d.ts +0 -0
  246. /package/dist/types/{lib → src/lib}/classBuilder.d.ts +0 -0
  247. /package/dist/types/{lib → src/lib}/core.d.ts +0 -0
  248. /package/dist/types/{lib → src/lib}/index.d.ts +0 -0
  249. /package/dist/types/{lib → src/lib}/types.d.ts +0 -0
  250. /package/dist/types/{puppeteerConfiger.d.ts → src/puppeteerConfiger.d.ts} +0 -0
  251. /package/dist/types/{utils.d.ts → src/utils.d.ts} +0 -0
  252. /package/dist/types/{web.html.d.ts → src/web.html.d.ts} +0 -0
@@ -14,29 +14,27 @@ import type { IInput, ISelection, IStore } from "./index";
14
14
 
15
15
  export type ISubject = HTMLElement;
16
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
+
17
33
  export default <ITestShape extends IBaseTest>(
18
34
  testImplementations: ITestImplementation<ITestShape>,
19
35
  testSpecifications: ITestSpecification<ITestShape>,
20
36
  testInput: IInput
21
37
  ) => {
22
- console.log("testInput", testInput);
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
- }, []);
35
-
36
- // debugger;
37
- return React.createElement("div", { ref: myContainer }, innerComp());
38
- };
39
-
40
38
  const t = Testeranto<ITestShape>(
41
39
  testInput,
42
40
  testSpecifications,
@@ -45,6 +43,7 @@ export default <ITestShape extends IBaseTest>(
45
43
  beforeAll: async (reactElement, itr): Promise<any> => {
46
44
  return await new Promise((resolve, rej) => {
47
45
  const htmlElement = document.getElementById("root");
46
+
48
47
  if (htmlElement) {
49
48
  const domRoot = ReactDom.createRoot(htmlElement);
50
49
 
@@ -79,51 +78,49 @@ export default <ITestShape extends IBaseTest>(
79
78
  pm
80
79
  ): Promise<IStore> => {
81
80
  return new Promise((resolve, rej) => {
82
- createPortal(
83
- TesterantoComponent({
84
- innerComp: () =>
85
- testInput({
86
- port: 3003,
87
- address: "some-address",
88
- secretKey: "someSecretKey",
89
- abi: "foo",
90
- }),
91
- done: (reactElement: any) => {
92
- process.nextTick(() => {
93
- resolve(reactElement);
94
- });
95
- },
96
- }),
97
- subject.domRoot
98
- );
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);
99
100
  });
100
101
  },
101
- andWhen: function (s: IStore, whenCB): Promise<ISelection> {
102
+ andWhen: function (s: IStore, whenCB, tr, utils): Promise<ISelection> {
102
103
  return new Promise((resolve, rej) => {
103
- process.nextTick(() => {
104
- resolve(whenCB()(s));
105
- });
104
+ console.log("mark9", s, whenCB);
105
+ resolve(whenCB(s, utils));
106
+ // process.nextTick(() => {
107
+ // resolve(whenCB()(s));
108
+ // });
106
109
  });
107
110
  },
108
- butThen: async function (s: IStore): Promise<ISelection> {
111
+ butThen: async function (s: IStore, thenCB): Promise<ISelection> {
109
112
  return new Promise((resolve, rej) => {
110
- process.nextTick(() => {
111
- resolve(s);
112
- });
113
+ resolve(thenCB(s));
113
114
  });
114
115
  },
115
116
  afterEach: async function (store: IStore, ndx, artificer) {
116
117
  return new Promise((resolve, rej) => {
117
- process.nextTick(() => {
118
- resolve({});
119
- });
118
+ resolve({});
120
119
  });
121
120
  },
122
121
  afterAll: (store: IStore, artificer) => {
123
122
  return new Promise((resolve, rej) => {
124
- process.nextTick(() => {
125
- resolve({});
126
- });
123
+ resolve({});
127
124
  });
128
125
  },
129
126
  }
@@ -23,9 +23,17 @@ export type ITestImpl<ITestShape extends IBaseTest> = ITestImplementation<
23
23
  export type ITestSpec<ITestShape extends IBaseTest> =
24
24
  ITestSpecification<ITestShape>;
25
25
 
26
+ const Context = React.createContext({});
27
+
28
+ const AppContext = React.createContext({});
29
+ const contextValue = {
30
+ ingredients: ["flour", "sugar", "eggs"],
31
+ temperature: "200",
32
+ };
33
+
26
34
  export const testInterface = {
27
35
  butThen: async function (s: IStore, thenCB, tr): Promise<ISelection> {
28
- console.log("butThen", thenCB.toString());
36
+ // console.log("butThen", thenCB.toString());
29
37
  return thenCB(s);
30
38
  },
31
39
  beforeEach: function (
@@ -34,7 +42,22 @@ export const testInterface = {
34
42
  ): Promise<renderer.ReactTestRenderer> {
35
43
  let component;
36
44
  act(() => {
37
- component = renderer.create(React.createElement(CComponent, props, []));
45
+ // component = renderer.create(
46
+ // React.createElement(
47
+ // AppContext.Provider,
48
+ // { value: contextValue },
49
+ // React.createElement(AppContext.Consumer, null, (context) =>
50
+ // React.createElement(CComponent, Object.assign({}, context, {}))
51
+ // )
52
+ // )
53
+ // );
54
+ component = renderer.create(
55
+ React.createElement(
56
+ CComponent,
57
+ props,
58
+ React.createElement(CComponent, props, [])
59
+ )
60
+ );
38
61
  });
39
62
  return component;
40
63
  },
package/src/Types.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  ITestInterface,
14
14
  IWebTestInterface,
15
15
  } from "./lib/types.js";
16
+ import { PM } from "./PM/index.js";
16
17
 
17
18
  export type IPartialInterface<
18
19
  I extends IBaseTest<
@@ -112,6 +113,7 @@ export type ITestSpecification<
112
113
  },
113
114
  Given: {
114
115
  [K in keyof ITestShape["givens"]]: (
116
+ features: string[],
115
117
  whens: BaseWhen<ITestShape>[],
116
118
  thens: BaseThen<ITestShape>[],
117
119
  ...xtrasB: ITestShape["givens"][K]
@@ -159,7 +161,7 @@ export type ITestImplementation<
159
161
  whens: {
160
162
  [K in keyof ITestShape["whens"]]: (
161
163
  ...Iw: ITestShape["whens"][K]
162
- ) => (zel: ITestShape["iselection"]) => ITestShape["when"];
164
+ ) => (zel: ITestShape["iselection"], utils: PM) => ITestShape["when"];
163
165
  };
164
166
  thens: {
165
167
  [K in keyof ITestShape["thens"]]: (
@@ -17,6 +17,18 @@ export default (
17
17
  entryPoint.split(".").slice(0, -1).join("."),
18
18
  `inputFiles.json`
19
19
  );
20
+ const promptPath = path.join(
21
+ "./docs/",
22
+ platform,
23
+ entryPoint.split(".").slice(0, -1).join("."),
24
+ `prompt.txt`
25
+ );
26
+ const testPaths = path.join(
27
+ "./docs/",
28
+ platform,
29
+ entryPoint.split(".").slice(0, -1).join("."),
30
+ `tests.json`
31
+ );
20
32
 
21
33
  const dirName = path.dirname(filePath);
22
34
 
@@ -24,39 +36,74 @@ export default (
24
36
  fs.mkdirSync(dirName, { recursive: true });
25
37
  }
26
38
 
39
+ const j = Object.keys(
40
+ Object.keys(result.metafile.outputs)
41
+ .filter((s: string) => {
42
+ if (!result.metafile.outputs[s].entryPoint) {
43
+ return false;
44
+ }
45
+ return (
46
+ path.resolve(result.metafile.outputs[s].entryPoint) ===
47
+ path.resolve(entryPoint)
48
+ );
49
+ })
50
+ .reduce((mm: string[], el) => {
51
+ mm.push(result.metafile.outputs[el].inputs);
52
+ return mm;
53
+ }, [])[0]
54
+ ).filter((f: string) => {
55
+ const regex = /^src\/.*/g;
56
+ const matches = f.match(regex);
57
+ const passes = matches?.length === 1;
58
+ return passes;
59
+ });
60
+ // .filter((f: string) => {
61
+ // const regex = /.*\.test\..*/g;
62
+ // const matches = f.match(regex);
63
+ // const passes = matches?.length === 1;
64
+ // return !passes;
65
+ // })
66
+
67
+ const jsonContent = JSON.stringify(j);
68
+
69
+ fs.writeFileSync(filePath, jsonContent);
70
+
27
71
  fs.writeFileSync(
28
- filePath,
29
- JSON.stringify(
30
- Object.keys(
31
- Object.keys(result.metafile.outputs)
32
- .filter((s: string) => {
33
- if (!result.metafile.outputs[s].entryPoint) {
34
- return false;
35
- }
36
- return (
37
- path.resolve(result.metafile.outputs[s].entryPoint) ===
38
- path.resolve(entryPoint)
39
- );
40
- })
41
- .reduce((mm: string[], el) => {
42
- mm.push(result.metafile.outputs[el].inputs);
43
- return mm;
44
- }, [])[0]
45
- )
46
- .filter((f: string) => {
47
- const regex = /^src\/.*/g;
48
- const matches = f.match(regex);
49
- const passes = matches?.length === 1;
50
- return passes;
51
- })
52
- .filter((f: string) => {
53
- const regex = /.*\.test\..*/g;
54
- const matches = f.match(regex);
55
- const passes = matches?.length === 1;
56
- return !passes;
57
- })
58
- )
72
+ promptPath,
73
+ `
74
+ ${j
75
+ .map((x) => {
76
+ return `/add ${x}`;
77
+ })
78
+ .join("\n")}
79
+ /read ${testPaths}
80
+
81
+ /code fix the failing tests described in ${filePath}.
82
+ `
59
83
  );
84
+
85
+ // fs.writeFileSync(
86
+ // promptPath,
87
+ // `
88
+ // from aider.coders import Coder
89
+ // from aider.models import Model
90
+ // import os
91
+
92
+ // model = Model("deepseek")
93
+
94
+ // coder = Coder.create(main_model=model)
95
+
96
+ // coder.run("/read-only", "${testPaths}")
97
+
98
+ // ${j
99
+ // .map((x) => {
100
+ // return `coder.run("/add", "${x}")`;
101
+ // })
102
+ // .join("\n")}
103
+
104
+ // coder.run("fix the failing tests described in ${filePath}.")
105
+ // `
106
+ // );
60
107
  });
61
108
  }
62
109
  });
@@ -3,7 +3,7 @@ import { BuildOptions } from "esbuild";
3
3
  import { IBaseConfig } from "../lib/types";
4
4
 
5
5
  import baseEsBuildConfig from "./index.js";
6
- import inputFilesPlugin from "./inputFilesPlugin";
6
+ import inputFilesPlugin from "./inputFilesPlugin.js";
7
7
 
8
8
  export default (
9
9
  config: IBaseConfig,
@@ -16,7 +16,7 @@ export default (
16
16
 
17
17
  outdir: config.outdir + "/node",
18
18
 
19
- inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
19
+ // inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
20
20
  metafile: true,
21
21
  supported: {
22
22
  "dynamic-import": true,
@@ -29,10 +29,10 @@ export default (
29
29
  metafile: true,
30
30
 
31
31
  external: [
32
- "testeranto.json",
33
- "features.test.ts",
32
+ // "testeranto.json",
33
+ // "features.test.ts",
34
34
  // "url",
35
- "react",
35
+ // "react",
36
36
 
37
37
  "path",
38
38
  "fs",
@@ -60,7 +60,7 @@ export default (
60
60
 
61
61
  plugins: [
62
62
  ...(config.webPlugins || []),
63
- inputFilesPlugin("node", entryPoints),
63
+ inputFilesPlugin("web", entryPoints),
64
64
  {
65
65
  name: "rebuild-notify",
66
66
  setup(build) {
@@ -58,10 +58,22 @@ export abstract class BaseSuite<
58
58
  }
59
59
 
60
60
  public toObj() {
61
+ const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
62
+ const features = Object.keys(this.givens)
63
+ .map((k) => this.givens[k].features)
64
+ .flat()
65
+ .filter((value, index, array) => {
66
+ return array.indexOf(value) === index;
67
+ })
68
+ .reduce((mm, lm) => {
69
+ mm[lm] = lm;
70
+ return mm;
71
+ }, {});
61
72
  return {
62
73
  name: this.name,
63
- givens: Object.keys(this.givens).map((k) => this.givens[k].toObj()),
74
+ givens,
64
75
  fails: this.fails,
76
+ features,
65
77
  };
66
78
  }
67
79
 
@@ -406,6 +418,7 @@ export abstract class BaseGiven<
406
418
  this.givenCB,
407
419
  beforeEachProxy
408
420
  );
421
+ // console.log("mark6", this.store);
409
422
 
410
423
  for (const [whenNdx, whenStep] of this.whens.entries()) {
411
424
  await whenStep.test(
@@ -428,9 +441,11 @@ export abstract class BaseGiven<
428
441
  tester(t);
429
442
  }
430
443
  } catch (e) {
444
+ console.error(e);
431
445
  this.error = e;
432
- tLog(e);
433
- tLog("\u0007"); // bell
446
+ tLog(e.stack);
447
+ // tLog("\u0007"); // bell
448
+
434
449
  // throw e;
435
450
  } finally {
436
451
  try {
@@ -532,6 +547,7 @@ export abstract class BaseGiven<
532
547
  },
533
548
  });
534
549
 
550
+ // console.log("mark5", this.store, key);
535
551
  await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
536
552
  } catch (e) {
537
553
  console.error("afterEach failed! no error will be recorded!", e);
@@ -579,6 +595,15 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
579
595
 
580
596
  const name = this.name;
581
597
  const andWhenProxy = new Proxy(pm, {
598
+ // set(obj, prop, value) {
599
+ // return Reflect.set(...arguments);
600
+ // // if (prop === "eyeCount" && value % 2 !== 0) {
601
+ // // console.log("Monsters must have an even number of eyes");
602
+ // // } else {
603
+ // // return Reflect.set(...arguments);
604
+ // // }
605
+ // },
606
+
582
607
  get(target, prop, receiver) {
583
608
  if (prop === "writeFileSync") {
584
609
  return (fp, contents) =>
@@ -597,13 +622,9 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
597
622
  return pages.map((page) => {
598
623
  return new Proxy(page, {
599
624
  get(pTarget, pProp, pReciever) {
625
+ // console.log("mark get", pTarget, pProp, pReciever);
600
626
  if (pProp === "screenshot") {
601
627
  return async (x) => {
602
- // console.log(
603
- // "custom-screenshot-MARK-afterEachProxy",
604
- // window["custom-screenshot"].toString()
605
- // );
606
-
607
628
  return pm.customScreenShot(
608
629
  {
609
630
  ...x,
@@ -614,14 +635,6 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
614
635
  },
615
636
  page
616
637
  );
617
-
618
- // return await pTarget[pProp]({
619
- // ...x,
620
- // path:
621
- // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
622
- // "/" +
623
- // x.path,
624
- // });
625
638
  };
626
639
  } else if (pProp === "mainFrame") {
627
640
  return () => pTarget[pProp]();
@@ -635,6 +648,32 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
635
648
  // return Reflect.get(target, prop, receiver);
636
649
  return pTarget[pProp].bind(pTarget);
637
650
  // return target[pProp];
651
+ } else if (pProp === "click") {
652
+ // console.log("mark12", arguments);
653
+ // return Reflect.get(target, prop, receiver);
654
+ // return pTarget[pProp].bind(pTarget);
655
+ // return target[pProp];
656
+ return (selector, options) => {
657
+ // console.log("mark13", selector, options);
658
+ // debugger;
659
+ pTarget[pProp](selector, options);
660
+ };
661
+ } else if (pProp === "$") {
662
+ return Reflect.get(...arguments);
663
+ // return Reflect.get(target, prop, receiver);
664
+ // return pTarget[pProp].bind(pTarget);
665
+ // return target[pProp];
666
+ // return pTarget[pProp].bind(pTarget);
667
+
668
+ // return async (s) => {
669
+ // console.log("mark17", s);
670
+ // console.log("pTarget", pTarget);
671
+ // console.log("pProp", pProp);
672
+ // console.log("pReciever", pReciever);
673
+ // // return "XXX";
674
+ // // debugger;
675
+ // return await pTarget[pProp](s);
676
+ // };
638
677
  } else {
639
678
  return Reflect.get(...arguments);
640
679
  }
@@ -657,17 +696,26 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
657
696
  },
658
697
  });
659
698
 
660
- try {
661
- return await this.andWhen(
662
- store,
663
- this.whenCB,
664
- testResourceConfiguration,
665
- andWhenProxy
666
- );
667
- } catch (e) {
699
+ return this.andWhen(
700
+ store,
701
+ this.whenCB,
702
+ testResourceConfiguration,
703
+ andWhenProxy
704
+ ).catch((e) => {
668
705
  this.error = true;
669
- throw e;
670
- }
706
+ // throw e;
707
+ });
708
+ // try {
709
+ // return await this.andWhen(
710
+ // store,
711
+ // this.whenCB,
712
+ // testResourceConfiguration,
713
+ // andWhenProxy
714
+ // );
715
+ // } catch (e) {
716
+ // this.error = true;
717
+ // throw e;
718
+ // }
671
719
  }
672
720
  }
673
721
 
@@ -791,14 +839,24 @@ export abstract class BaseThen<
791
839
  },
792
840
  });
793
841
 
794
- const x = await this.butThen(
842
+ // const x = await this.butThen(
843
+ // store,
844
+ // this.thenCB,
845
+ // testResourceConfiguration,
846
+ // butThenProxy
847
+ // );
848
+ // return x;
849
+
850
+ return this.butThen(
795
851
  store,
796
852
  this.thenCB,
797
853
  testResourceConfiguration,
798
854
  butThenProxy
799
- // pm
800
- );
801
- return x;
855
+ ).catch((e) => {
856
+ console.log("mar123");
857
+ this.error = true;
858
+ throw e;
859
+ });
802
860
  } catch (e) {
803
861
  console.log("test failed", e);
804
862
  this.error = e.message;
@@ -89,7 +89,7 @@ export abstract class BaseBuilder<
89
89
  puppetMaster: PM,
90
90
  tLog: ITLog
91
91
  ): Promise<BaseSuite<ITestShape>> => {
92
- await puppetMaster.startPuppeteer(
92
+ const puppeteerBrowser = await puppetMaster.startPuppeteer(
93
93
  {
94
94
  browserWSEndpoint:
95
95
  puppetMaster.testResourceConfiguration.browserWSEndpoint,
@@ -97,7 +97,7 @@ export abstract class BaseBuilder<
97
97
  puppetMaster.testResourceConfiguration.fs
98
98
  );
99
99
 
100
- return await suite.run(
100
+ const x = await suite.run(
101
101
  input,
102
102
  puppetMaster.testResourceConfiguration,
103
103
  (fPath: string, value: string | Buffer | PassThrough) =>
@@ -110,6 +110,10 @@ export abstract class BaseBuilder<
110
110
  tLog,
111
111
  puppetMaster
112
112
  );
113
+
114
+ // await puppetMaster.browser.disconnect();
115
+ // puppeteerBrowser.close();
116
+ return x;
113
117
  };
114
118
 
115
119
  const runner = suiteRunner(suite);
@@ -124,7 +128,7 @@ export abstract class BaseBuilder<
124
128
  runner,
125
129
 
126
130
  receiveTestResourceConfig: async function (puppetMaster: PM) {
127
- await puppetMaster.mkdirSync();
131
+ // await puppetMaster.mkdirSync();
128
132
 
129
133
  const logFilePath = "log.txt";
130
134
  const access = await puppetMaster.createWriteStream(logFilePath);
@@ -147,11 +151,21 @@ export abstract class BaseBuilder<
147
151
  }).length;
148
152
  puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
149
153
 
154
+ // if (numberOfFailures > 0) {
155
+ // puppetMaster.writeFileSync(
156
+ // `prompt`,
157
+ // `
158
+ // aider --message "make a script that prints hello" hello.js
159
+ // `
160
+ // );
161
+ // }
162
+
150
163
  puppetMaster.writeFileSync(
151
164
  `tests.json`,
152
165
  JSON.stringify(this.toObj(), null, 2)
153
166
  );
154
167
  console.log(`exiting gracefully with ${numberOfFailures} failures.`);
168
+
155
169
  return {
156
170
  failed: numberOfFailures,
157
171
  artifacts: this.artifacts || [],