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,299 @@
1
+ import { Ibdd_in, Ibdd_out } from "./CoreTypes";
2
+ import PureTesteranto from "./Pure";
3
+ import { MockPMBase } from "./lib/pmProxy.test/mockPMBase";
4
+ import { IPM } from "./lib/types";
5
+
6
+ // Test types specific to PureTesteranto testing
7
+ type PureI = Ibdd_in<
8
+ null, // No initial input needed
9
+ IPM, // Test subject is IPM
10
+ { pm: IPM }, // Store contains PM instance
11
+ { pm: IPM }, // Selection is same as store
12
+ () => IPM, // Given returns IPM
13
+ (store: { pm: IPM }) => { pm: IPM }, // When modifies store
14
+ (store: { pm: IPM }) => { pm: IPM } // Then verifies store
15
+ >;
16
+
17
+ type PureO = Ibdd_out<
18
+ { Default: [string] },
19
+ { Default: [] },
20
+ {
21
+ applyProxy: [string]; // When to apply a proxy
22
+ verifyCall: [string, any]; // Then to verify calls
23
+ },
24
+ {
25
+ verifyProxy: [string]; // Then to verify proxy behavior
26
+ verifyNoProxy: []; // Then to verify no proxy
27
+ },
28
+ { Default: [] }
29
+ >;
30
+
31
+ // Implementation for PureTesteranto tests
32
+ const implementation = {
33
+ suites: {
34
+ Default: "PureTesteranto Test Suite",
35
+ },
36
+
37
+ givens: {
38
+ Default: () => ({
39
+ pm: new MockPMBase() as unknown as IPM,
40
+ config: {},
41
+ proxies: {
42
+ butThenProxy: (pm: IPM, path: string) => ({
43
+ ...pm,
44
+ writeFileSync: (p: string, c: string) =>
45
+ pm.writeFileSync(`${path}/butThen/${p}`, c)
46
+ }),
47
+ andWhenProxy: (pm: IPM, path: string) => ({
48
+ ...pm,
49
+ writeFileSync: (p: string, c: string) =>
50
+ pm.writeFileSync(`${path}/andWhen/${p}`, c)
51
+ }),
52
+ beforeEachProxy: (pm: IPM, suite: string) => ({
53
+ ...pm,
54
+ writeFileSync: (p: string, c: string) =>
55
+ pm.writeFileSync(`suite-${suite}/beforeEach/${p}`, c)
56
+ })
57
+ }
58
+ }),
59
+ },
60
+
61
+ whens: {
62
+ applyProxy: (proxyType: string) => (store) => {
63
+ switch (proxyType) {
64
+ case "invalidConfig":
65
+ throw new Error("Invalid configuration");
66
+ case "missingProxy":
67
+ return { ...store, pm: {} }; // Break proxy chain
68
+ case "largePayload":
69
+ return {
70
+ ...store,
71
+ largePayload: true,
72
+ pm: {
73
+ ...store.pm,
74
+ writeFileSync: (p: string, c: string) => {
75
+ if (c.length > 1e6) {
76
+ return true;
77
+ }
78
+ throw new Error("Payload too small");
79
+ }
80
+ }
81
+ };
82
+ default:
83
+ return store;
84
+ }
85
+ },
86
+ },
87
+
88
+ thens: {
89
+ verifyProxy: (expectedPath: string) => (store) => {
90
+ const testPath = "expected";
91
+ const result = store.pm.writeFileSync(testPath, "content");
92
+ const actualPath = store.pm.getLastCall("writeFileSync")?.path;
93
+ if (actualPath !== expectedPath) {
94
+ throw new Error(`Expected path ${expectedPath}, got ${actualPath}`);
95
+ }
96
+ return store;
97
+ },
98
+ verifyNoProxy: () => (store) => {
99
+ if (store.pm.getCallCount("writeFileSync") > 0) {
100
+ throw new Error("Proxy was unexpectedly applied");
101
+ }
102
+ return store;
103
+ },
104
+ verifyError: (expectedError: string) => (store) => {
105
+ try {
106
+ store.pm.writeFileSync("test", "content");
107
+ throw new Error("Expected error but none was thrown");
108
+ } catch (error) {
109
+ if (!error.message.includes(expectedError)) {
110
+ throw new Error(`Expected error "${expectedError}", got "${error.message}"`);
111
+ }
112
+ }
113
+ return store;
114
+ },
115
+ verifyResourceConfig: () => (store) => {
116
+ if (!store.pm.testResourceConfiguration) {
117
+ throw new Error("Missing test resource configuration");
118
+ }
119
+ return store;
120
+ },
121
+ verifyLargePayload: () => (store) => {
122
+ const largeContent = "x".repeat(2e6); // 2MB payload
123
+ const result = store.pm.writeFileSync("large.txt", largeContent);
124
+ if (!result) {
125
+ throw new Error("Failed to handle large payload");
126
+ }
127
+ return store;
128
+ },
129
+ verifyTypeSafety: () => (store) => {
130
+ // TypeScript will catch these at compile time
131
+ return store;
132
+ },
133
+ },
134
+
135
+ checks: {
136
+ Default: () => ({} as IPM),
137
+ },
138
+ };
139
+
140
+ // Specification for PureTesteranto tests
141
+ const specification = (Suite, Given, When, Then, Check) => [
142
+ Suite.Default("Core Functionality", {
143
+ initializationTest: Given.Default(
144
+ ["Should initialize with default configuration"],
145
+ [],
146
+ [Then.verifyNoProxy()]
147
+ ),
148
+ resourceConfigTest: Given.Default(
149
+ ["Should handle test resource configuration"],
150
+ [When.applyProxy("resourceConfig")],
151
+ [Then.verifyResourceConfig()]
152
+ ),
153
+ }),
154
+
155
+ Suite.Default("Proxy Integration", {
156
+ butThenProxyTest: Given.Default(
157
+ ["Should integrate with butThenProxy"],
158
+ [When.applyProxy("butThenProxy")],
159
+ [Then.verifyProxy("test/path/butThen/expected")]
160
+ ),
161
+ andWhenProxyTest: Given.Default(
162
+ ["Should integrate with andWhenProxy"],
163
+ [When.applyProxy("andWhenProxy")],
164
+ [Then.verifyProxy("test/path/andWhen/expected")]
165
+ ),
166
+ beforeEachProxyTest: Given.Default(
167
+ ["Should integrate with beforeEachProxy"],
168
+ [When.applyProxy("beforeEachProxy")],
169
+ [Then.verifyProxy("suite-1/beforeEach/expected")]
170
+ ),
171
+ }),
172
+
173
+ Suite.Default("Error Handling", {
174
+ invalidConfigTest: Given.Default(
175
+ ["Should handle invalid configuration"],
176
+ [When.applyProxy("invalidConfig")],
177
+ [Then.verifyError("Invalid configuration")]
178
+ ),
179
+ missingProxyTest: Given.Default(
180
+ ["Should handle missing proxy"],
181
+ [When.applyProxy("missingProxy")],
182
+ [Then.verifyError("Proxy not found")]
183
+ ),
184
+ }),
185
+
186
+ Suite.Default("Performance", {
187
+ multipleProxiesTest: Given.Default(
188
+ ["Should handle multiple proxies efficiently"],
189
+ [
190
+ When.applyProxy("butThenProxy"),
191
+ When.applyProxy("andWhenProxy"),
192
+ When.applyProxy("beforeEachProxy")
193
+ ],
194
+ [
195
+ Then.verifyProxy("test/path/butThen/expected"),
196
+ Then.verifyProxy("test/path/andWhen/expected"),
197
+ Then.verifyProxy("suite-1/beforeEach/expected")
198
+ ]
199
+ ),
200
+ largePayloadTest: Given.Default(
201
+ ["Should handle large payloads"],
202
+ [When.applyProxy("largePayload")],
203
+ [Then.verifyLargePayload()]
204
+ ),
205
+ }),
206
+
207
+ Suite.Default("Cross-Component Verification", {
208
+ proxyChainTest: Given.Default(
209
+ ["Proxies should chain correctly"],
210
+ [
211
+ When.applyProxy("butThenProxy"),
212
+ When.applyProxy("andWhenProxy")
213
+ ],
214
+ [
215
+ Then.verifyProxy("test/path/andWhen/butThen/expected")
216
+ ]
217
+ ),
218
+ errorPropagationTest: Given.Default(
219
+ ["Errors should propagate across components"],
220
+ [When.applyProxy("invalidConfig")],
221
+ [Then.verifyError("Invalid configuration")]
222
+ ),
223
+ resourceSharingTest: Given.Default(
224
+ ["Resources should be shared correctly"],
225
+ [When.applyProxy("resourceConfig")],
226
+ [Then.verifyResourceConfig()]
227
+ )
228
+ }),
229
+
230
+ Suite.Default("Type Safety", {
231
+ strictTypeTest: Given.Default(
232
+ ["Should enforce type safety"],
233
+ [When.applyProxy("typeSafe")],
234
+ [Then.verifyTypeSafety()]
235
+ ),
236
+ invalidTypeTest: Given.Default(
237
+ ["Should reject invalid types"],
238
+ [When.applyProxy("invalidType")],
239
+ [Then.verifyError("Type mismatch")]
240
+ ),
241
+ }),
242
+
243
+ Suite.Default("Integration Tests", {
244
+ // Verify builders work together
245
+ builderIntegration: Given.Default(
246
+ ["BaseBuilder and ClassBuilder should integrate properly"],
247
+ [],
248
+ [
249
+ Then.initializedProperly(),
250
+ Then.specsGenerated(),
251
+ Then.jobsCreated(),
252
+ Then.artifactsTracked()
253
+ ]
254
+ ),
255
+
256
+ // Verify PM proxy integration
257
+ pmProxyIntegration: Given.Default(
258
+ ["PM proxies should work with test runners"],
259
+ [When.applyProxy("butThenProxy")],
260
+ [Then.verifyProxy("test/path/butThen/expected")]
261
+ ),
262
+
263
+ // Verify full test lifecycle
264
+ fullLifecycle: Given.Default(
265
+ ["Should complete full test lifecycle"],
266
+ [
267
+ When.addArtifact(Promise.resolve("test")),
268
+ When.setTestJobs([]),
269
+ When.modifySpecs((specs) => [...specs])
270
+ ],
271
+ [
272
+ Then.testRunSuccessful(),
273
+ Then.artifactsTracked(),
274
+ Then.specsModified(0)
275
+ ]
276
+ )
277
+ })
278
+ ];
279
+
280
+ // Test interface for PureTesteranto
281
+ const testInterface = {
282
+ beforeEach: async (subject, initializer) => {
283
+ return { pm: initializer() };
284
+ },
285
+ andWhen: async (store, whenCB) => whenCB(store),
286
+ butThen: async (store, thenCB) => thenCB(store),
287
+ afterEach: async (store) => store,
288
+ afterAll: async () => {},
289
+ beforeAll: async (input, testResource) => ({} as IPM),
290
+ assertThis: (x) => x,
291
+ };
292
+
293
+ // Export the test suite
294
+ export default PureTesteranto<PureI, PureO, {}>(
295
+ null, // No initial input
296
+ specification,
297
+ implementation,
298
+ testInterface
299
+ );
package/src/Pure.ts CHANGED
@@ -41,7 +41,13 @@ export class PureTesteranto<
41
41
  async receiveTestResourceConfig(partialTestResource: string) {
42
42
  const t: ITTestResourceConfiguration = JSON.parse(partialTestResource);
43
43
  const pm = new PM_Pure(t);
44
- return await this.testJobs[0].receiveTestResourceConfig(pm);
44
+
45
+ try {
46
+ return await this.testJobs[0].receiveTestResourceConfig(pm);
47
+ } catch (e) {
48
+ return -2;
49
+ }
50
+
45
51
  // const { failed, artifacts, logPromise, features, fails } =
46
52
  // await this.testJobs[0].receiveTestResourceConfig(pm);
47
53
  // // pm.customclose();
@@ -55,7 +61,7 @@ export default async <I extends Ibdd_in_any, O extends Ibdd_out, M>(
55
61
  testImplementation: ITestImplementation<I, O, M>,
56
62
  testInterface: Partial<ITestInterface<I>>,
57
63
  testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement
58
- ): Promise<Testeranto<I, O, M>> => {
64
+ ): Promise<number | Testeranto<I, O, M>> => {
59
65
  return new PureTesteranto<I, O, M>(
60
66
  input,
61
67
  testSpecification,
@@ -63,4 +69,16 @@ export default async <I extends Ibdd_in_any, O extends Ibdd_out, M>(
63
69
  testResourceRequirement,
64
70
  testInterface
65
71
  );
72
+
73
+ // try {
74
+ // return new PureTesteranto<I, O, M>(
75
+ // input,
76
+ // testSpecification,
77
+ // testImplementation,
78
+ // testResourceRequirement,
79
+ // testInterface
80
+ // );
81
+ // } catch (e) {
82
+ // return -1;
83
+ // }
66
84
  };
package/src/Types.ts CHANGED
@@ -17,11 +17,11 @@ import { BaseSuite } from "./lib/BaseSuite.js";
17
17
  export type ISummary = Record<
18
18
  string,
19
19
  {
20
- runTimeError: string;
21
- typeErrors: number;
22
- staticErrors: number;
23
- prompt: string;
24
- failingFeatures: object;
20
+ runTimeErrors: number | "?" | undefined;
21
+ typeErrors: number | "?" | undefined;
22
+ staticErrors: number | "?" | undefined;
23
+ prompt: string | "?" | undefined;
24
+ failingFeatures: object | undefined;
25
25
  }
26
26
  >;
27
27
 
package/src/Web.ts CHANGED
@@ -87,7 +87,7 @@ export default async <I extends Ibdd_in_any, O extends Ibdd_out, M>(
87
87
  input: I["iinput"],
88
88
  testSpecification: ITestSpecification<I, O>,
89
89
  testImplementation: ITestImplementation<I, O, M>,
90
- testInterface: Partial<IWebTestInterface<I>>,
90
+ testInterface: Partial<ITestInterface<I>>,
91
91
  testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement
92
92
  ): Promise<Testeranto<I, O, M>> => {
93
93
  return new WebTesteranto<I, O, M>(
package/src/build.ts CHANGED
@@ -238,7 +238,6 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
238
238
  ];
239
239
 
240
240
  x.forEach(async ([runtime, keys]) => {
241
- console.log(runtime, keys);
242
241
  keys.forEach(async (k) => {
243
242
  const folder = `testeranto/reports/${testName}/${k
244
243
  .split(".")
@@ -1,29 +1,43 @@
1
- import type { Plugin } from 'esbuild';
1
+ import type { Plugin } from "esbuild";
2
+
3
+ import fs from "fs";
2
4
 
3
5
  export const consoleDetectorPlugin: Plugin = {
4
- name: 'console-detector',
6
+ name: "console-detector",
5
7
  setup(build) {
6
8
  build.onLoad({ filter: /\.(js|ts)$/ }, async (args) => {
7
- const contents = await require('fs').promises.readFile(args.path, 'utf8');
8
-
9
- const consolePattern = /console\.(log|error|warn|info|debug|trace|dir|dirxml|table|group|groupEnd|clear|count|countReset|assert|profile|profileEnd|time|timeLog|timeEnd|timeStamp|context|memory)/g;
9
+ const contents = await fs.promises.readFile(args.path, "utf8");
10
+
11
+ const consolePattern =
12
+ /console\.(log|error|warn|info|debug|trace|dir|dirxml|table|group|groupEnd|clear|count|countReset|assert|profile|profileEnd|time|timeLog|timeEnd|timeStamp|context|memory)/g;
10
13
  const matches = contents.match(consolePattern);
11
14
 
12
15
  if (matches) {
13
16
  const uniqueMethods = [...new Set(matches)];
14
17
  return {
15
- warnings: uniqueMethods.map(method => ({
16
- text: `Detected ${method} call - Pure runtime does not allow IO operations. Use Node runtime instead.`,
17
- location: {
18
- file: args.path,
19
- line: contents.split('\n').findIndex(line => line.includes(method)) + 1,
20
- column: 0
21
- }
22
- }))
18
+ warnings: uniqueMethods.map((method) => ({
19
+ text: `call of "${method}" was detected, which is not supported in the pure runtime.`,
20
+ // location: {
21
+ // file: args.path,
22
+ // line:
23
+ // contents
24
+ // .split("\n")
25
+ // .findIndex((line) => line.includes(method)) + 1,
26
+ // column: 0,
27
+ // },
28
+ })),
23
29
  };
24
30
  }
25
31
 
26
32
  return null;
27
33
  });
28
- }
34
+ build.onEnd((buildResult) => {
35
+ if (
36
+ buildResult.warnings.find((br) => br.pluginName === "console-detector")
37
+ )
38
+ console.warn(
39
+ `Warning: An unsupported method call was detected in a source file used to build for the pure runtime. It is possible that this method call is in a comment block. If you really want to use this function, change this test to the "node" runtime.`
40
+ );
41
+ });
42
+ },
29
43
  };
@@ -0,0 +1,26 @@
1
+ import type { Plugin } from "esbuild";
2
+
3
+ import { isBuiltin } from "node:module";
4
+
5
+ export const nativeImportDetectorPlugin: Plugin = {
6
+ name: "native-node-import-filter",
7
+ setup(build) {
8
+ build.onResolve({ filter: /fs/ }, (args) => {
9
+ if (isBuiltin(args.path)) {
10
+ return {
11
+ warnings: [
12
+ {
13
+ text: `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`,
14
+ },
15
+ ],
16
+ };
17
+
18
+ // throw new Error(
19
+ // `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`
20
+ // );
21
+ }
22
+
23
+ return { path: args.path };
24
+ });
25
+ },
26
+ };
@@ -9,6 +9,7 @@ import featuresPlugin from "./featuresPlugin.js";
9
9
  import { isBuiltin } from "node:module";
10
10
  import { consoleDetectorPlugin } from "./consoleDetectorPlugin.js";
11
11
  import rebuildPlugin from "./rebuildPlugin.js";
12
+ import { nativeImportDetectorPlugin } from "./nativeImportDetectorPlugin.js";
12
13
 
13
14
  export default (
14
15
  config: ITestconfig,
@@ -53,13 +54,14 @@ export default (
53
54
 
54
55
  consoleDetectorPlugin,
55
56
 
57
+ // nativeImportDetectorPlugin,
56
58
  {
57
59
  name: "native-node-import-filter",
58
60
  setup(build) {
59
61
  build.onResolve({ filter: /fs/ }, (args) => {
60
62
  if (isBuiltin(args.path)) {
61
63
  throw new Error(
62
- `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`
64
+ `You attempted to import a node module "${args.path}" into a "pure" test, which is not allowed. If you really want to use this package, convert this test from "pure" to "node"`
63
65
  );
64
66
  }
65
67
 
@@ -6,11 +6,8 @@ export default (r: IRunTime) => {
6
6
  return {
7
7
  name: "rebuild-notify",
8
8
  setup: (build) => {
9
- build.onStart(() => {
10
- console.log(`> web build starting...`);
11
- });
12
9
  build.onEnd((result) => {
13
- console.log(`> web build ended with ${result.errors.length} errors`);
10
+ console.log(`${r} > build ended with ${result.errors.length} errors`);
14
11
  if (result.errors.length > 0) {
15
12
  fs.writeFileSync(
16
13
  `./testeranto/reports${r}_build_errors`,
@@ -0,0 +1,12 @@
1
+ import Testeranto from "../../Node";
2
+
3
+ import { BaseSuite } from "../BaseSuite";
4
+
5
+ import { I, implementation, O, specification, testInterface } from "./test";
6
+
7
+ export default Testeranto<I, O, {}>(
8
+ BaseSuite,
9
+ specification,
10
+ implementation,
11
+ testInterface
12
+ );
@@ -0,0 +1,12 @@
1
+ import Testeranto from "../../Pure";
2
+
3
+ import { BaseSuite } from "../BaseSuite";
4
+
5
+ import { I, implementation, O, specification, testInterface } from "./test";
6
+
7
+ export default Testeranto<I, O, {}>(
8
+ BaseSuite,
9
+ specification,
10
+ implementation,
11
+ testInterface
12
+ );
@@ -1,30 +1,30 @@
1
- import { BaseSuite } from "./BaseSuite";
2
- import { BaseGiven, BaseWhen, BaseThen, BaseCheck } from "./abstractBase";
3
- import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from ".";
4
- import { IPM } from "./types";
1
+ import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from "..";
5
2
  import {
6
3
  Ibdd_in,
7
4
  Ibdd_out,
8
5
  ITestSpecification,
9
6
  ITestImplementation,
10
7
  ITestInterface,
11
- } from "../CoreTypes";
12
- import Testeranto from "../Node";
8
+ } from "../../CoreTypes";
9
+ import { WhenSpecification } from "../../Types";
10
+ import { BaseGiven, BaseWhen, BaseThen, BaseCheck } from "../abstractBase";
11
+ import { BaseSuite } from "../BaseSuite";
12
+ import { IPM, ITestCheckCallback } from "../types";
13
13
 
14
14
  // 1. Define our test types with full type safety
15
- type TestStore = {
15
+ export type TestStore = {
16
16
  testStore: boolean;
17
17
  testSelection?: boolean;
18
18
  error?: Error;
19
19
  };
20
20
 
21
- type TestSelection = {
21
+ export type TestSelection = {
22
22
  testSelection: boolean;
23
23
  error?: boolean;
24
24
  };
25
25
 
26
- type I = Ibdd_in<
27
- null, // iinput
26
+ export type I = Ibdd_in<
27
+ typeof BaseSuite,
28
28
  BaseSuite<any, any>, // isubject
29
29
  TestStore, // istore
30
30
  TestSelection, // iselection
@@ -33,7 +33,7 @@ type I = Ibdd_in<
33
33
  (store: TestStore) => Promise<TestSelection> // then
34
34
  >;
35
35
 
36
- type O = Ibdd_out<
36
+ export type O = Ibdd_out<
37
37
  {
38
38
  Default: [string]; // Suite names
39
39
  },
@@ -55,7 +55,7 @@ type O = Ibdd_out<
55
55
  >;
56
56
 
57
57
  // 2. Mock implementations with proper typing
58
- class MockGiven extends BaseGiven<I> {
58
+ export class MockGiven extends BaseGiven<I> {
59
59
  constructor(
60
60
  name: string,
61
61
  features: string[],
@@ -84,7 +84,7 @@ class MockGiven extends BaseGiven<I> {
84
84
  }
85
85
 
86
86
  uberCatcher(e: Error): void {
87
- console.error("Given error:", e);
87
+ console.error("Given error 2:", e);
88
88
  }
89
89
  }
90
90
 
@@ -158,11 +158,11 @@ class TestableSuite extends BaseSuite<I, O> {
158
158
  }
159
159
 
160
160
  // 3. Enhanced Test Specification with more test cases
161
- const specification: ITestSpecification<I, O> = (
162
- Suite: SuiteSpecification<I, O>,
163
- Given: GivenSpecification<I, O>,
161
+ export const specification: ITestSpecification<I, O> = (
162
+ Suite: ITestSpecification<I, O>,
163
+ Given: WhenSpecification<I, O>,
164
164
  When: WhenSpecification<I, O>,
165
- Then: ThenSpecification<I, O>,
165
+ Then: WhenSpecification<I, O>,
166
166
  Check: ITestCheckCallback<I, O>
167
167
  ) => [
168
168
  Suite.Default(
@@ -219,10 +219,27 @@ const specification: ITestSpecification<I, O> = (
219
219
  // )
220
220
  ]
221
221
  ),
222
+
223
+ Suite.Default("Comprehensive Integration", {
224
+ fullStackTest: Given.Default(
225
+ ["All components should work together"],
226
+ [
227
+ When.addArtifact(Promise.resolve("test")),
228
+ When.modifySpecs((specs) => [...specs, "extra"]),
229
+ When.modifyJobs((jobs) => [...jobs, {}]),
230
+ ],
231
+ [
232
+ Then.specsModified(1),
233
+ Then.jobsModified(1),
234
+ Then.artifactsTracked(),
235
+ Then.testRunSuccessful(),
236
+ ]
237
+ ),
238
+ }),
222
239
  ];
223
240
 
224
241
  // 4. Enhanced Test Implementation with more operations
225
- const implementation: ITestImplementation<I, O> = {
242
+ export const implementation: ITestImplementation<I, O> = {
226
243
  suites: {
227
244
  Default: "BaseSuite Comprehensive Test Suite" as const,
228
245
  },
@@ -415,7 +432,7 @@ const implementation: ITestImplementation<I, O> = {
415
432
  };
416
433
 
417
434
  // 5. Fully typed Test Interface
418
- const testInterface: ITestInterface<I> = {
435
+ export const testInterface: ITestInterface<I> = {
419
436
  beforeEach: async (
420
437
  subject: I["isubject"],
421
438
  initializer: (context?: any) => I["given"]
@@ -447,11 +464,3 @@ const testInterface: ITestInterface<I> = {
447
464
  pm: IPM
448
465
  ): Promise<I["isubject"]> => input as unknown as I["isubject"],
449
466
  };
450
-
451
- // 6. Run the tests
452
- export default Testeranto<I, O, {}>(
453
- BaseSuite.prototype,
454
- specification,
455
- implementation,
456
- testInterface
457
- );
@@ -0,0 +1,12 @@
1
+ import Testeranto from "../../Web";
2
+
3
+ import { BaseSuite } from "../BaseSuite";
4
+
5
+ import { I, implementation, O, specification, testInterface } from "./test";
6
+
7
+ export default Testeranto<I, O, {}>(
8
+ BaseSuite,
9
+ specification,
10
+ implementation,
11
+ testInterface
12
+ );