testeranto 0.140.2 → 0.146.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 (204) hide show
  1. package/.aider.chat.history.md +11006 -0
  2. package/.aider.input.history +441 -0
  3. package/.aider.tags.cache.v3/06/1a/1ec9fd1f595d4b36094caef45894.val +0 -0
  4. package/.aider.tags.cache.v3/0f/f6/f42b5108253d75de3cb6286df7f6.val +0 -0
  5. package/.aider.tags.cache.v3/{ad/3c/10f2ab1397f6d544e613d2a6acaf.val → 3d/81/8b6f0e9b98ec2952cdb8968ac386.val} +0 -0
  6. package/.aider.tags.cache.v3/cache.db +0 -0
  7. package/.aider.tags.cache.v3/{a7/97/6d37fce350ad2d588f36729db0cd.val → d6/7d/1820c2d4b9330eab7017da4515e7.val} +0 -0
  8. package/README.md +15 -16
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/docs/aiderTest.sh +1 -0
  11. package/docs/index.md +45 -33
  12. package/docs/testing.ai.txt +98 -0
  13. package/docs/testing.prompt.txt +8 -0
  14. package/package.json +3 -3
  15. package/src/Node.ts +17 -13
  16. package/src/PM/PM_WithEslintAndTsc.ts +83 -67
  17. package/src/PM/main.ts +182 -92
  18. package/src/PM/node.ts +1 -15
  19. package/src/PM/nodeSidecar.ts +0 -1
  20. package/src/Pure.test.ts +299 -0
  21. package/src/Pure.ts +20 -2
  22. package/src/Types.ts +5 -5
  23. package/src/Web.ts +1 -1
  24. package/src/build.ts +0 -1
  25. package/src/esbuildConfigs/consoleDetectorPlugin.ts +28 -14
  26. package/src/esbuildConfigs/nativeImportDetectorPlugin.ts +26 -0
  27. package/src/esbuildConfigs/pure.ts +3 -1
  28. package/src/esbuildConfigs/rebuildPlugin.ts +1 -4
  29. package/src/lib/BaseSuite.test/node.test.ts +12 -0
  30. package/src/lib/BaseSuite.test/pure.test.ts +12 -0
  31. package/src/lib/{BaseSuite.test.ts → BaseSuite.test/test.ts} +36 -27
  32. package/src/lib/BaseSuite.test/web.test.ts +12 -0
  33. package/src/lib/BaseSuite.ts +17 -15
  34. package/src/lib/abstractBase.test/MockGiven.ts +31 -0
  35. package/src/lib/abstractBase.test/MockThen.ts +20 -0
  36. package/src/lib/abstractBase.test/MockWhen.ts +17 -0
  37. package/src/lib/abstractBase.test/implementation.ts +51 -0
  38. package/src/lib/abstractBase.test/index.ts +19 -0
  39. package/src/lib/abstractBase.test/interface.ts +12 -0
  40. package/src/lib/abstractBase.test/specification.ts +49 -0
  41. package/src/lib/abstractBase.test/types.ts +19 -0
  42. package/src/lib/abstractBase.ts +0 -2
  43. package/src/lib/baseBuilder.test/TestBaseBuilder.ts +83 -0
  44. package/src/lib/baseBuilder.test/baseBuilder.test.implementation.ts +134 -0
  45. package/src/lib/baseBuilder.test/baseBuilder.test.interface.ts +18 -0
  46. package/src/lib/baseBuilder.test/baseBuilder.test.node.ts +14 -0
  47. package/src/lib/baseBuilder.test/baseBuilder.test.pure.ts +14 -0
  48. package/src/lib/baseBuilder.test/baseBuilder.test.specification.ts +35 -0
  49. package/src/lib/baseBuilder.test/baseBuilder.test.types.ts +36 -0
  50. package/src/lib/baseBuilder.test/baseBuilder.test.web.ts +14 -0
  51. package/src/lib/basebuilder.ts +2 -1
  52. package/src/lib/classBuilder.test/TestClassBuilder.ts +88 -0
  53. package/src/lib/classBuilder.test/classBuilder.test.implementation.ts +204 -0
  54. package/src/lib/classBuilder.test/classBuilder.test.interface.ts +18 -0
  55. package/src/lib/classBuilder.test/classBuilder.test.specification.ts +113 -0
  56. package/src/lib/classBuilder.test/classBuilder.test.ts +14 -0
  57. package/src/lib/classBuilder.test/classBuilder.test.types.ts +84 -0
  58. package/src/lib/core.test/MockCore.ts +49 -0
  59. package/src/lib/core.test/core.test.implementation.ts +129 -0
  60. package/src/lib/core.test/core.test.interface.ts +18 -0
  61. package/src/lib/core.test/core.test.specification.ts +99 -0
  62. package/src/lib/core.test/core.test.ts +15 -0
  63. package/src/lib/core.test/core.test.types.ts +68 -0
  64. package/src/lib/core.ts +1 -11
  65. package/src/lib/pmProxy.test/implementation.ts +104 -0
  66. package/src/lib/pmProxy.test/index.ts +19 -0
  67. package/src/lib/pmProxy.test/interface.ts +46 -0
  68. package/src/lib/pmProxy.test/mockPM.ts +38 -0
  69. package/src/lib/pmProxy.test/mockPMBase.ts +136 -0
  70. package/src/lib/pmProxy.test/specification.ts +123 -0
  71. package/src/lib/pmProxy.test/types.ts +45 -0
  72. package/src/lib/pmProxy.ts +40 -193
  73. package/src/run.ts +7 -7
  74. package/testeranto/bundles/node/allTests/chunk-NQBTLMSG.mjs +254 -0
  75. package/testeranto/bundles/node/allTests/chunk-RF3LIUSG.mjs +765 -0
  76. package/testeranto/bundles/node/allTests/chunk-YZWFKYY3.mjs +171 -0
  77. package/testeranto/bundles/node/allTests/metafile.json +628 -3567
  78. package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +325 -0
  79. package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +226 -0
  80. package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +408 -0
  81. package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +279 -0
  82. package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +4587 -0
  83. package/testeranto/bundles/{node/allTests/chunk-4PJCC2XT.mjs → pure/allTests/chunk-W22WOQNK.mjs} +208 -326
  84. package/testeranto/bundles/pure/allTests/metafile.json +732 -3
  85. package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +369 -0
  86. package/testeranto/bundles/{node/allTests/src/lib/BaseSuite.test.mjs → pure/allTests/src/lib/BaseSuite.test/pure.test.mjs} +26 -8
  87. package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +224 -0
  88. package/testeranto/bundles/web/allTests/chunk-FIZ3WLUB.mjs +943 -0
  89. package/testeranto/bundles/web/allTests/metafile.json +1133 -2
  90. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.html +19 -0
  91. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +322 -0
  92. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.html +19 -0
  93. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +10964 -0
  94. package/testeranto/index.html +1 -1
  95. package/testeranto/reports/allTests/config.json +50 -11
  96. package/testeranto/reports/allTests/index.html +1 -1
  97. package/testeranto/reports/allTests/src/Pure.test/pure/lint_errors.json +1539 -0
  98. package/testeranto/reports/allTests/src/Pure.test/pure/logs.txt +11 -0
  99. package/testeranto/reports/allTests/src/Pure.test/pure/message +1 -0
  100. package/testeranto/reports/allTests/src/Pure.test/pure/prompt.txt +8 -0
  101. package/testeranto/reports/allTests/src/{PM/__tests__/pureSidecar.testeranto/node → Pure.test/pure}/type_errors.txt +18 -14
  102. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/lint_errors.json +620 -0
  103. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +12 -0
  104. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/message +1 -0
  105. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/prompt.txt +8 -0
  106. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +94 -0
  107. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/index.html +21 -0
  108. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/lint_errors.json +620 -0
  109. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt +11 -0
  110. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/message +1 -0
  111. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +8 -0
  112. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +104 -0
  113. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/dev.html +21 -0
  114. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/index.html +21 -0
  115. package/testeranto/reports/allTests/src/lib/BaseSuite.test/{node → web.test/web}/lint_errors.json +69 -57
  116. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +10 -0
  117. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/message +1 -0
  118. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +8 -0
  119. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +95 -0
  120. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/dev.html +21 -0
  121. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/index.html +21 -0
  122. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.json +966 -0
  123. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/message +1 -0
  124. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +11 -0
  125. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +57 -0
  126. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/bdd_errors.txt +1 -0
  127. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/dev.html +21 -0
  128. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/index.html +21 -0
  129. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.json +966 -0
  130. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/log.txt +0 -0
  131. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message +1 -0
  132. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +11 -0
  133. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/tests.json +57 -0
  134. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +57 -0
  135. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +1 -0
  136. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/dev.html +21 -0
  137. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/index.html +21 -0
  138. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.json +966 -0
  139. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/log.txt +0 -0
  140. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -0
  141. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/message +1 -0
  142. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +11 -0
  143. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +57 -0
  144. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +48 -0
  145. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/dev.html +21 -0
  146. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/index.html +21 -0
  147. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/lint_errors.json +791 -0
  148. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +12 -0
  149. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/message +1 -0
  150. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/prompt.txt +11 -0
  151. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +55 -0
  152. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/dev.html +21 -0
  153. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/index.html +21 -0
  154. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/lint_errors.json +416 -0
  155. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +17 -0
  156. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/message +1 -0
  157. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/prompt.txt +11 -0
  158. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +65 -0
  159. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/dev.html +21 -0
  160. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/index.html +21 -0
  161. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/lint_errors.json +1724 -0
  162. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/log.txt +0 -0
  163. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +30 -0
  164. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/message +1 -0
  165. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/prompt.txt +11 -0
  166. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +64 -0
  167. package/testeranto/reports/allTests/summary.json +59 -24
  168. package/testeranto.config.ts +37 -12
  169. package/tsc.log +273 -27
  170. package/testeranto/bundles/node/allTests/chunk-PG6KUKNP.mjs +0 -44
  171. package/testeranto/bundles/node/allTests/src/PM/__tests__/nodeSidecar.testeranto.mjs +0 -187
  172. package/testeranto/bundles/node/allTests/src/PM/__tests__/pureSidecar.testeranto.mjs +0 -156
  173. package/testeranto/bundles/node/allTests/src/PM/__tests__/webSidecar.testeranto.mjs +0 -156
  174. package/testeranto/bundles/node/allTests/src/mothership/test.mjs +0 -24411
  175. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/index.html +0 -21
  176. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +0 -80
  177. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/message +0 -1
  178. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +0 -8
  179. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +0 -28
  180. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/index.html +0 -21
  181. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/lint_errors.json +0 -80
  182. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/message +0 -1
  183. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +0 -8
  184. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/index.html +0 -21
  185. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/lint_errors.json +0 -80
  186. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/message +0 -1
  187. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +0 -8
  188. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +0 -32
  189. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/console_log.txt +0 -35
  190. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/index.html +0 -21
  191. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/message +0 -1
  192. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/prompt.txt +0 -7
  193. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/type_errors.txt +0 -68
  194. package/testeranto/reports/allTests/src/mothership/test/node/index.html +0 -21
  195. package/testeranto/reports/allTests/src/mothership/test/node/lint_errors.json +0 -1
  196. package/testeranto/reports/allTests/src/mothership/test/node/message +0 -1
  197. package/testeranto/reports/allTests/src/mothership/test/node/prompt.txt +0 -8
  198. package/testeranto/reports/allTests/src/mothership/test/node/type_errors.txt +0 -24
  199. /package/testeranto/reports/allTests/src/{PM/__tests__/nodeSidecar.testeranto/node → Pure.test/pure}/dev.html +0 -0
  200. /package/testeranto/reports/allTests/src/{PM/__tests__/pureSidecar.testeranto/node/dev.html → Pure.test/pure/index.html} +0 -0
  201. /package/testeranto/reports/allTests/src/{PM/__tests__/webSidecar.testeranto → lib/BaseSuite.test/node.test}/node/dev.html +0 -0
  202. /package/testeranto/reports/allTests/src/lib/BaseSuite.test/{node/dev.html → node.test/node/index.html} +0 -0
  203. /package/testeranto/reports/allTests/src/{mothership/test/node → lib/BaseSuite.test/pure.test/pure}/dev.html +0 -0
  204. /package/testeranto/reports/allTests/src/lib/{BaseSuite.test/node/log.txt → baseBuilder.test/baseBuilder.test.node/node/logs.txt} +0 -0
@@ -0,0 +1,45 @@
1
+ import { ITestProxies } from ".";
2
+ import { Ibdd_in, Ibdd_out } from "../../CoreTypes";
3
+
4
+ import { IProxiedFunctions, IProxy } from "../pmProxy";
5
+ import { IPM } from "../types";
6
+
7
+ export type I = Ibdd_in<
8
+ { butThenProxy: IProxy },
9
+ { proxies: ITestProxies; filepath: string; mockPm: IPM },
10
+ { butThenProxy: IProxy },
11
+ // { butThenProxy: IProxy },
12
+
13
+ { proxies: ITestProxies; filepath: string; mockPm: IPM },
14
+ [string, string],
15
+ (
16
+ ...args: any[]
17
+ ) => (proxies: { butThenProxy: IProxy }) => { butThenProxy: IProxy },
18
+ [IPM, "string"]
19
+ >;
20
+
21
+ export type O = Ibdd_out<
22
+ { Default: [string] },
23
+ { SomeBaseString: [string] },
24
+ {}, // No Whens for pure functions
25
+ {
26
+ theButTheProxyReturns: [IProxiedFunctions, string];
27
+ },
28
+ { Default: [] }
29
+ >;
30
+
31
+ export type M = {
32
+ givens: {
33
+ [K in keyof O["givens"]]: (...Iw: O["givens"][K]) => string;
34
+ };
35
+ // whens: {
36
+ // [K in keyof O["whens"]]: (
37
+ // ...Iw: O["whens"][K]
38
+ // ) => (rectangle: Rectangle, utils: PM) => Rectangle;
39
+ // };
40
+ // thens: {
41
+ // [K in keyof O["thens"]]: (
42
+ // ...Iw: O["thens"][K]
43
+ // ) => (rectangle: Rectangle, utils: PM) => Rectangle;
44
+ // };
45
+ };
@@ -1,8 +1,27 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
+
3
4
  import { IPM } from "./types";
4
5
 
5
- const prxy = function (pm: IPM, mappings: [string, (...x) => any][]) {
6
+ export type IProxyBase = (
7
+ pm: IPM,
8
+ mappings: [string, (...x: any) => any][]
9
+ ) => IPM;
10
+
11
+ export type IProxy = (pm: IPM, filepath: string) => IPM;
12
+ export type IProxyAfterEach = (pm: IPM, suite: string, given: string) => IPM;
13
+ export type IProxyBeforeEach = (pm: IPM, suite: string) => IPM;
14
+
15
+ export type IProxiedFunctions =
16
+ | "screencast"
17
+ | "createWriteStream"
18
+ | "writeFileSync"
19
+ | "customScreenShot";
20
+
21
+ const baseProxy: IProxyBase = function (
22
+ pm: IPM,
23
+ mappings: [IProxiedFunctions, (...x) => any][]
24
+ ) {
6
25
  return new Proxy(pm, {
7
26
  get: (target, prop, receiver) => {
8
27
  for (const mapping of mappings) {
@@ -10,7 +29,7 @@ const prxy = function (pm: IPM, mappings: [string, (...x) => any][]) {
10
29
  const arger = mapping[1];
11
30
 
12
31
  if (prop === method) {
13
- return (...x) => target[prop](arger(...x));
32
+ return (...x) => (target[prop] as any)(arger(...x));
14
33
  }
15
34
  }
16
35
 
@@ -19,8 +38,8 @@ const prxy = function (pm: IPM, mappings: [string, (...x) => any][]) {
19
38
  });
20
39
  };
21
40
 
22
- export const butThenProxy = (pm: IPM, filepath: string) =>
23
- prxy(pm, [
41
+ export const butThenProxy: IProxy = (pm: IPM, filepath: string) =>
42
+ baseProxy(pm, [
24
43
  [
25
44
  "screencast",
26
45
  (opts, p) => [
@@ -51,8 +70,8 @@ export const butThenProxy = (pm: IPM, filepath: string) =>
51
70
  ],
52
71
  ]);
53
72
 
54
- export const andWhenProxy = (pm: IPM, filepath: string) =>
55
- prxy(pm, [
73
+ export const andWhenProxy: IProxy = (pm: IPM, filepath: string) =>
74
+ baseProxy(pm, [
56
75
  [
57
76
  "screencast",
58
77
  (opts, p) => [
@@ -80,8 +99,12 @@ export const andWhenProxy = (pm: IPM, filepath: string) =>
80
99
  ],
81
100
  ]);
82
101
 
83
- export const afterEachProxy = (pm: IPM, suite: string, given: string): IPM =>
84
- prxy(pm, [
102
+ export const afterEachProxy: IProxyAfterEach = (
103
+ pm: IPM,
104
+ suite: string,
105
+ given: string
106
+ ): IPM =>
107
+ baseProxy(pm, [
85
108
  [
86
109
  "screencast",
87
110
  (opts, p) => [
@@ -114,8 +137,11 @@ export const afterEachProxy = (pm: IPM, suite: string, given: string): IPM =>
114
137
  ],
115
138
  ]);
116
139
 
117
- export const beforeEachProxy = (pm: IPM, suite: string): IPM =>
118
- prxy(pm, [
140
+ export const beforeEachProxy: IProxyBeforeEach = (
141
+ pm: IPM,
142
+ suite: string
143
+ ): IPM =>
144
+ baseProxy(pm, [
119
145
  [
120
146
  "screencast",
121
147
  (opts, p) => [
@@ -146,8 +172,8 @@ export const beforeEachProxy = (pm: IPM, suite: string): IPM =>
146
172
  ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]],
147
173
  ]);
148
174
 
149
- export const beforeAllProxy = (pm: IPM, suite: string): IPM =>
150
- prxy(pm, [
175
+ export const beforeAllProxy: IProxy = (pm: IPM, suite: string): IPM =>
176
+ baseProxy(pm, [
151
177
  [
152
178
  "writeFileSync",
153
179
  (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents],
@@ -167,8 +193,8 @@ export const beforeAllProxy = (pm: IPM, suite: string): IPM =>
167
193
  ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]],
168
194
  ]);
169
195
 
170
- export const afterAllProxy = (pm: IPM, suite: string): IPM =>
171
- prxy(pm, [
196
+ export const afterAllProxy: IProxy = (pm: IPM, suite: string): IPM =>
197
+ baseProxy(pm, [
172
198
  ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
173
199
 
174
200
  [
@@ -187,182 +213,3 @@ export const afterAllProxy = (pm: IPM, suite: string): IPM =>
187
213
  ],
188
214
  ],
189
215
  ]);
190
-
191
- /////////////////////////////////////////////////
192
-
193
- // export const butThenProxy = (pm: IPM, filepath: string) => {
194
- // return new Proxy(pm, {
195
- // get: (target, prop, receiver) => {
196
- // if (prop === "customScreenShot") {
197
- // return (opts, p) =>
198
- // target.customScreenShot(
199
- // {
200
- // ...opts,
201
- // path: `${filepath}/${opts.path}`,
202
- // },
203
- // p
204
- // );
205
- // }
206
-
207
- // if (prop === "writeFileSync") {
208
- // return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
209
- // }
210
- // },
211
- // });
212
- // };
213
-
214
- // export const andWhenProxy = (pm: IPM, filepath: string) => {
215
- // return new Proxy(pm, {
216
- // get(target, prop, receiver) {
217
- // if (prop === "customScreenShot") {
218
- // return (opts, p) =>
219
- // target.customScreenShot(
220
- // {
221
- // ...opts,
222
- // path: `${filepath}/${opts.path}`,
223
- // },
224
- // p
225
- // );
226
- // }
227
- // if (prop === "writeFileSync") {
228
- // return (fp, contents) =>
229
- // target[prop](`${filepath}/andWhen/${fp}`, contents);
230
- // }
231
-
232
- // /* @ts-ignore:next-line */
233
- // return Reflect.get(...arguments);
234
- // },
235
- // });
236
- // };
237
-
238
- // export const afterEachProxy = (pm: IPM, suite: string, given: string): IPM => {
239
- // return new Proxy(pm, {
240
- // get(target, prop, receiver) {
241
- // if (prop === "customScreenShot") {
242
- // return (opts, p) =>
243
- // target.customScreenShot(
244
- // {
245
- // ...opts,
246
- // path: `suite-${suite}/given-${given}/afterEach/${opts.path}`,
247
- // },
248
- // p
249
- // );
250
- // }
251
-
252
- // if (prop === "writeFileSync") {
253
- // return (fp, contents) =>
254
- // target[prop](
255
- // `suite-${suite}/given-${given}/afterEach/${fp}`,
256
- // contents
257
- // );
258
- // }
259
-
260
- // /* @ts-ignore:next-line */
261
- // return Reflect.get(...arguments);
262
- // },
263
- // });
264
- // };
265
-
266
- // export const beforeAllProxy = (pm: IPM, suite: string): IPM => {
267
- // return new Proxy(pm, {
268
- // get(target, prop, receiver) {
269
- // if (prop === "customScreenShot") {
270
- // return (opts, p) =>
271
- // target.customScreenShot(
272
- // {
273
- // ...opts,
274
- // // path: `${filepath}/${opts.path}`,
275
- // path: `suite-${suite}/beforeAll/${opts.path}`,
276
- // },
277
- // p
278
- // );
279
- // }
280
-
281
- // if (prop === "writeFileSync") {
282
- // return (fp, contents) =>
283
- // target[prop](`suite-${suite}/beforeAll/${fp}`, contents);
284
- // }
285
-
286
- // /* @ts-ignore:next-line */
287
- // return Reflect.get(...arguments);
288
- // },
289
- // });
290
- // };
291
-
292
- // export const beforeEachProxy = (pm: IPM, suite: string, given: string): IPM => {
293
- // return new Proxy(pm, {
294
- // get(target, prop, receiver) {
295
- // // if (prop === "write") {
296
- // // return (handle, contents) =>
297
- // // target[prop](
298
- // // `suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`,
299
- // // contents
300
- // // );
301
- // // }
302
-
303
- // if (prop === "createWriteStream") {
304
- // return (fp) =>
305
- // target[prop](`suite-${suite}/given-${given}/when/beforeEach/${fp}`);
306
- // }
307
-
308
- // if (prop === "writeFileSync") {
309
- // return (fp, contents) =>
310
- // target[prop](
311
- // `suite-${suite}/given-${given}/when/beforeEach/${fp}`,
312
- // contents
313
- // );
314
- // }
315
-
316
- // if (prop === "customScreenShot") {
317
- // return (opts, p) =>
318
- // target.customScreenShot(
319
- // {
320
- // ...opts,
321
- // path: `suite-${suite}/given-${given}/when/beforeEach/${opts.path}`,
322
- // },
323
- // p
324
- // );
325
- // }
326
-
327
- // if (prop === "screencast") {
328
- // return (opts, p) =>
329
- // target.screencast(
330
- // {
331
- // ...opts,
332
- // path: `suite-${suite}/given-${given}/when/beforeEach/${opts.path}`,
333
- // },
334
- // p
335
- // );
336
- // }
337
-
338
- // /* @ts-ignore:next-line */
339
- // return Reflect.get(...arguments);
340
- // },
341
- // });
342
- // };
343
-
344
- // export const afterAllProxy = (pm: IPM, suite: string): IPM => {
345
- // return new Proxy(pm, {
346
- // get(target, prop, receiver) {
347
- // if (prop === "customScreenShot") {
348
- // return (opts, p) =>
349
- // target.customScreenShot(
350
- // {
351
- // ...opts,
352
- // // path: `${filepath}/${opts.path}`,
353
- // path: `suite-${suite}/afterAll/${opts.path}`,
354
- // },
355
- // p
356
- // );
357
- // }
358
-
359
- // if (prop === "writeFileSync") {
360
- // return (fp, contents) =>
361
- // target[prop](`suite-${suite}/afterAll/${fp}`, contents);
362
- // }
363
-
364
- // /* @ts-ignore:next-line */
365
- // return Reflect.get(...arguments);
366
- // },
367
- // });
368
- // };
package/src/run.ts CHANGED
@@ -7,7 +7,9 @@ import { ITestconfig, IBuiltConfig, IProject } from "./Types";
7
7
  readline.emitKeypressEvents(process.stdin);
8
8
  if (process.stdin.isTTY) process.stdin.setRawMode(true);
9
9
 
10
- console.log(ansiC.inverse("Press 'x' to shutdown forcefully."));
10
+ console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
11
+ console.log(ansiC.inverse("Press 'x' to quit forcefully."));
12
+
11
13
  process.stdin.on("keypress", (str, key) => {
12
14
  if (key.name === "x") {
13
15
  console.log(ansiC.inverse("Shutting down forcefully..."));
@@ -15,7 +17,7 @@ process.stdin.on("keypress", (str, key) => {
15
17
  }
16
18
  });
17
19
 
18
- const testName = process.argv[2];
20
+ const projectName = process.argv[2];
19
21
 
20
22
  const mode = process.argv[3] as "once" | "dev";
21
23
  if (mode !== "once" && mode !== "dev") {
@@ -23,19 +25,17 @@ if (mode !== "once" && mode !== "dev") {
23
25
  process.exit(-1);
24
26
  }
25
27
 
26
- console.log("testeranto is running", testName, mode);
27
-
28
28
  import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
29
29
  const bigConfig: IProject = module.default;
30
30
 
31
- const rawConfig: ITestconfig = bigConfig.projects[testName];
31
+ const rawConfig: ITestconfig = bigConfig.projects[projectName];
32
32
 
33
33
  const config: IBuiltConfig = {
34
34
  ...rawConfig,
35
- buildDir: process.cwd() + "/" + `testeranto/${testName}.json`,
35
+ buildDir: process.cwd() + "/" + `testeranto/${projectName}.json`,
36
36
  };
37
37
 
38
- const pm = new PM_Main(config, testName, mode);
38
+ const pm = new PM_Main(config, projectName, mode);
39
39
  pm.start();
40
40
 
41
41
  process.stdin.on("keypress", (str, key) => {
@@ -0,0 +1,254 @@
1
+ import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
+ import {
3
+ PM,
4
+ TesterantoCore,
5
+ defaultTestResourceRequirement
6
+ } from "./chunk-RF3LIUSG.mjs";
7
+
8
+ // src/PM/node.ts
9
+ import net from "net";
10
+ import fs from "fs";
11
+ import path from "path";
12
+ var fPaths = [];
13
+ var PM_Node = class extends PM {
14
+ constructor(t, ipcFile) {
15
+ super();
16
+ this.testResourceConfiguration = t;
17
+ this.client = net.createConnection(ipcFile, () => {
18
+ return;
19
+ });
20
+ }
21
+ start() {
22
+ throw new Error("DEPRECATED");
23
+ }
24
+ stop() {
25
+ throw new Error("stop not implemented.");
26
+ }
27
+ send(command, ...argz) {
28
+ const key = Math.random().toString();
29
+ if (!this.client) {
30
+ console.error(
31
+ `Tried to send "${command} (${argz})" but the test has not been started and the IPC client is not established. Exiting as failure!`
32
+ );
33
+ process.exit(-1);
34
+ }
35
+ return new Promise((res) => {
36
+ const myListener = (event) => {
37
+ const x = JSON.parse(event);
38
+ if (x.key === key) {
39
+ process.removeListener("message", myListener);
40
+ res(x.payload);
41
+ }
42
+ };
43
+ process.addListener("message", myListener);
44
+ this.client.write(JSON.stringify([command, ...argz, key]));
45
+ });
46
+ }
47
+ async launchSideCar(n) {
48
+ return this.send(
49
+ "launchSideCar",
50
+ n,
51
+ this.testResourceConfiguration.name
52
+ );
53
+ }
54
+ stopSideCar(n) {
55
+ return this.send(
56
+ "stopSideCar",
57
+ n,
58
+ this.testResourceConfiguration.name
59
+ );
60
+ }
61
+ async pages() {
62
+ return this.send("pages", ...arguments);
63
+ }
64
+ waitForSelector(p, s) {
65
+ return this.send("waitForSelector", ...arguments);
66
+ }
67
+ closePage(p) {
68
+ return this.send("closePage", ...arguments);
69
+ }
70
+ goto(page, url) {
71
+ return this.send("goto", ...arguments);
72
+ }
73
+ async newPage() {
74
+ return this.send("newPage");
75
+ }
76
+ $(selector, page) {
77
+ return this.send("$", ...arguments);
78
+ }
79
+ isDisabled(selector) {
80
+ return this.send("isDisabled", ...arguments);
81
+ }
82
+ getAttribute(selector, attribute, p) {
83
+ return this.send("getAttribute", ...arguments);
84
+ }
85
+ getInnerHtml(selector, p) {
86
+ return this.send("getInnerHtml", ...arguments);
87
+ }
88
+ // setValue(selector: string) {
89
+ // return this.send("getValue", ...arguments);
90
+ // }
91
+ focusOn(selector) {
92
+ return this.send("focusOn", ...arguments);
93
+ }
94
+ typeInto(selector) {
95
+ return this.send("typeInto", ...arguments);
96
+ }
97
+ page() {
98
+ return this.send("page");
99
+ }
100
+ click(selector) {
101
+ return this.send("click", ...arguments);
102
+ }
103
+ screencast(opts, page) {
104
+ return this.send(
105
+ "screencast",
106
+ {
107
+ ...opts,
108
+ path: this.testResourceConfiguration.fs + "/" + opts.path
109
+ },
110
+ page,
111
+ this.testResourceConfiguration.name
112
+ );
113
+ }
114
+ screencastStop(p) {
115
+ return this.send("screencastStop", ...arguments);
116
+ }
117
+ customScreenShot(x, y) {
118
+ const opts = x[0];
119
+ const page = x[1];
120
+ return this.send(
121
+ "customScreenShot",
122
+ {
123
+ ...opts,
124
+ path: this.testResourceConfiguration.fs + "/" + opts.path
125
+ },
126
+ this.testResourceConfiguration.name,
127
+ page
128
+ );
129
+ }
130
+ async existsSync(destFolder) {
131
+ return await this.send(
132
+ "existsSync",
133
+ this.testResourceConfiguration.fs + "/" + destFolder
134
+ );
135
+ }
136
+ mkdirSync() {
137
+ return this.send("mkdirSync", this.testResourceConfiguration.fs + "/");
138
+ }
139
+ async write(uid, contents) {
140
+ return await this.send("write", ...arguments);
141
+ }
142
+ async writeFileSync(filepath, contents) {
143
+ return await this.send(
144
+ "writeFileSync",
145
+ this.testResourceConfiguration.fs + "/" + filepath,
146
+ contents,
147
+ this.testResourceConfiguration.name
148
+ );
149
+ }
150
+ async createWriteStream(filepath) {
151
+ return await this.send(
152
+ "createWriteStream",
153
+ this.testResourceConfiguration.fs + "/" + filepath,
154
+ this.testResourceConfiguration.name
155
+ );
156
+ }
157
+ async end(uid) {
158
+ return await this.send("end", ...arguments);
159
+ }
160
+ async customclose() {
161
+ return await this.send(
162
+ "customclose",
163
+ this.testResourceConfiguration.fs,
164
+ this.testResourceConfiguration.name
165
+ );
166
+ }
167
+ testArtiFactoryfileWriter(tLog, callback) {
168
+ return (fPath, value) => {
169
+ callback(
170
+ new Promise((res, rej) => {
171
+ tLog("testArtiFactory =>", fPath);
172
+ const cleanPath = path.resolve(fPath);
173
+ fPaths.push(cleanPath.replace(process.cwd(), ``));
174
+ const targetDir = cleanPath.split("/").slice(0, -1).join("/");
175
+ fs.mkdir(targetDir, { recursive: true }, async (error) => {
176
+ if (error) {
177
+ console.error(`\u2757\uFE0FtestArtiFactory failed`, targetDir, error);
178
+ }
179
+ if (Buffer.isBuffer(value)) {
180
+ fs.writeFileSync(fPath, value, "binary");
181
+ res();
182
+ } else if (`string` === typeof value) {
183
+ fs.writeFileSync(fPath, value.toString(), {
184
+ encoding: "utf-8"
185
+ });
186
+ res();
187
+ } else {
188
+ const pipeStream = value;
189
+ const myFile = fs.createWriteStream(fPath);
190
+ pipeStream.pipe(myFile);
191
+ pipeStream.on("close", () => {
192
+ myFile.close();
193
+ res();
194
+ });
195
+ }
196
+ });
197
+ })
198
+ );
199
+ };
200
+ }
201
+ // launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
202
+ startPuppeteer(options) {
203
+ }
204
+ };
205
+
206
+ // src/Node.ts
207
+ var ipcfile;
208
+ console.log("mark4");
209
+ var NodeTesteranto = class extends TesterantoCore {
210
+ constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
211
+ super(
212
+ input,
213
+ testSpecification,
214
+ testImplementation,
215
+ testResourceRequirement,
216
+ testInterface,
217
+ () => {
218
+ }
219
+ );
220
+ }
221
+ async receiveTestResourceConfig(partialTestResource) {
222
+ console.log("receiveTestResourceConfig", partialTestResource);
223
+ const t = JSON.parse(partialTestResource);
224
+ const pm = new PM_Node(t, ipcfile);
225
+ return await this.testJobs[0].receiveTestResourceConfig(pm);
226
+ }
227
+ };
228
+ var testeranto = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
229
+ try {
230
+ const t = new NodeTesteranto(
231
+ input,
232
+ testSpecification,
233
+ testImplementation,
234
+ testResourceRequirement,
235
+ testInterface
236
+ );
237
+ console.log("args", process.argv);
238
+ process.on("unhandledRejection", (reason, promise) => {
239
+ console.error("Unhandled Rejection at:", promise, "reason:", reason);
240
+ });
241
+ ipcfile = process.argv[3];
242
+ const f = await t.receiveTestResourceConfig(process.argv[2]);
243
+ console.error("goodbye node with failures", f.fails);
244
+ process.exit(f.fails);
245
+ } catch (e) {
246
+ console.error("goodbye node with caught error", e);
247
+ process.exit(-1);
248
+ }
249
+ };
250
+ var Node_default = testeranto;
251
+
252
+ export {
253
+ Node_default
254
+ };