testeranto 0.134.0 → 0.140.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 (221) hide show
  1. package/.aider.chat.history.md +14577 -0
  2. package/.aider.input.history +566 -0
  3. package/.aider.tags.cache.v3/{8d/fa/12860238755bcfab9af8a93c52ab.val → bd/91/b71f967fd074cf4b757081b429b7.val} +0 -0
  4. package/.aider.tags.cache.v3/cache.db +0 -0
  5. package/.aider.tags.cache.v3/{18/8b/7dfca822129dad10b5cacadf7728.val → fb/96/b0f91c7e75e08fc5a6907633cf99.val} +0 -0
  6. package/README.md +29 -423
  7. package/bundle.js +1 -1
  8. package/dist/common/src/CoreTypes.js +2 -0
  9. package/dist/common/src/Init.js +4 -1
  10. package/dist/common/src/Node.js +1 -1
  11. package/dist/common/src/PM/PM_WithEslintAndTsc.js +10 -8
  12. package/dist/common/src/PM/__tests__/nodeSidecar.testeranto.js +2 -2
  13. package/dist/common/src/PM/main.js +12 -7
  14. package/dist/common/src/PM/node.js +10 -3
  15. package/dist/common/src/Web.js +2 -2
  16. package/dist/common/src/build.js +7 -72
  17. package/dist/common/src/defaultConfig.js +0 -1
  18. package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
  19. package/dist/common/src/esbuildConfigs/node.js +2 -16
  20. package/dist/common/src/esbuildConfigs/pure.js +2 -16
  21. package/dist/common/src/esbuildConfigs/rebuildPlugin.js +22 -0
  22. package/dist/common/src/esbuildConfigs/web.js +2 -16
  23. package/dist/common/src/lib/abstractBase.js +8 -1
  24. package/dist/common/src/lib/basebuilder.js +4 -0
  25. package/dist/common/src/lib/classBuilder.js +2 -3
  26. package/dist/common/src/lib/core.js +2 -0
  27. package/dist/common/src/run.js +1 -1
  28. package/dist/common/src/utils/buildTemplates.js +88 -0
  29. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  30. package/dist/module/src/Init.js +4 -1
  31. package/dist/module/src/Node.js +1 -1
  32. package/dist/module/src/PM/PM_WithEslintAndTsc.js +10 -8
  33. package/dist/module/src/PM/__tests__/nodeSidecar.testeranto.js +2 -2
  34. package/dist/module/src/PM/main.js +12 -7
  35. package/dist/module/src/PM/node.js +10 -3
  36. package/dist/module/src/Project.js +41 -47
  37. package/dist/module/src/TestReport.js +34 -31
  38. package/dist/module/src/Web.js +2 -2
  39. package/dist/module/src/build.js +7 -72
  40. package/dist/module/src/defaultConfig.js +0 -1
  41. package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
  42. package/dist/module/src/esbuildConfigs/node.js +2 -16
  43. package/dist/module/src/esbuildConfigs/pure.js +2 -16
  44. package/dist/module/src/esbuildConfigs/rebuildPlugin.js +17 -0
  45. package/dist/module/src/esbuildConfigs/web.js +2 -16
  46. package/dist/module/src/lib/abstractBase.js +8 -1
  47. package/dist/module/src/lib/basebuilder.js +4 -0
  48. package/dist/module/src/lib/classBuilder.js +2 -3
  49. package/dist/module/src/lib/core.js +2 -0
  50. package/dist/module/src/run.js +1 -1
  51. package/dist/module/src/utils/buildTemplates.js +82 -0
  52. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  53. package/dist/prebuild/Project.js +77 -29
  54. package/dist/prebuild/TestReport.js +51 -32
  55. package/dist/prebuild/build.mjs +132 -131
  56. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +14 -1
  57. package/dist/prebuild/init-docs.mjs +0 -4
  58. package/dist/prebuild/run.mjs +50 -31
  59. package/dist/tsconfig.tsbuildinfo +1 -0
  60. package/dist/types/src/CoreTypes.d.ts +53 -0
  61. package/dist/types/src/Node.d.ts +3 -3
  62. package/dist/types/src/PM/__tests__/nodeSidecar.testeranto.d.ts +2 -4
  63. package/dist/types/src/PM/__tests__/pureSidecar.testeranto.d.ts +2 -4
  64. package/dist/types/src/PM/__tests__/webSidecar.testeranto.d.ts +2 -4
  65. package/dist/types/src/PM/index.d.ts +1 -1
  66. package/dist/types/src/PM/nodeSidecar.d.ts +2 -2
  67. package/dist/types/src/Pure.d.ts +3 -3
  68. package/dist/types/src/Types.d.ts +21 -61
  69. package/dist/types/src/Web.d.ts +3 -3
  70. package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +6 -0
  71. package/dist/types/src/lib/abstractBase.d.ts +10 -16
  72. package/dist/types/src/lib/basebuilder.d.ts +3 -3
  73. package/dist/types/src/lib/classBuilder.d.ts +2 -2
  74. package/dist/types/src/lib/core.d.ts +2 -2
  75. package/dist/types/src/lib/index.d.ts +7 -6
  76. package/dist/types/src/lib/types.d.ts +8 -8
  77. package/dist/types/src/mothership/test.d.ts +2 -2
  78. package/dist/types/src/utils/buildTemplates.d.ts +3 -0
  79. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  80. package/docs/index.md +567 -0
  81. package/docs/style.md +116 -0
  82. package/docs.html +537 -0
  83. package/example.css +351 -0
  84. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf +0 -0
  85. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Bold.ttf +0 -0
  86. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-ExtraBold.ttf +0 -0
  87. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf +0 -0
  88. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf +0 -0
  89. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Regular.ttf +0 -0
  90. package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Thin.ttf +0 -0
  91. package/fonts/M_PLUS_Rounded_1c/OFL.txt +91 -0
  92. package/index.html +245 -24
  93. package/logo.svg +72 -0
  94. package/package.json +11 -2
  95. package/scripts/compile-docs.js +89 -0
  96. package/src/CoreTypes.ts +152 -0
  97. package/src/Init.ts +4 -4
  98. package/src/Node.ts +13 -13
  99. package/src/PM/PM_WithEslintAndTsc.ts +46 -15
  100. package/src/PM/__tests__/nodeSidecar.testeranto.ts +13 -20
  101. package/src/PM/__tests__/pureSidecar.testeranto.ts +8 -15
  102. package/src/PM/__tests__/webSidecar.testeranto.ts +8 -15
  103. package/src/PM/index.ts +1 -1
  104. package/src/PM/main.ts +17 -16
  105. package/src/PM/node.ts +10 -10
  106. package/src/PM/nodeSidecar.ts +2 -2
  107. package/src/PM/pure.ts +0 -4
  108. package/src/Project.tsx +289 -292
  109. package/src/Pure.ts +13 -14
  110. package/src/PureSidecar.ts +1 -0
  111. package/src/TestReport.tsx +179 -165
  112. package/src/Types.ts +52 -151
  113. package/src/Web.ts +15 -14
  114. package/src/build.ts +22 -72
  115. package/src/defaultConfig.ts +2 -1
  116. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +17 -1
  117. package/src/esbuildConfigs/node.ts +2 -18
  118. package/src/esbuildConfigs/pure.ts +2 -18
  119. package/src/esbuildConfigs/rebuildPlugin.ts +23 -0
  120. package/src/esbuildConfigs/web.ts +2 -18
  121. package/src/lib/BaseSuite.test.ts +457 -0
  122. package/src/lib/BaseSuite.ts +155 -0
  123. package/src/lib/abstractBase.ts +13 -163
  124. package/src/lib/basebuilder.ts +11 -11
  125. package/src/lib/classBuilder.ts +13 -7
  126. package/src/lib/core.ts +13 -17
  127. package/src/lib/index.ts +21 -24
  128. package/src/lib/types.ts +23 -9
  129. package/src/mothership/test.ts +13 -10
  130. package/src/run.ts +1 -1
  131. package/src/style.css +1 -1
  132. package/src/utils/buildTemplates.ts +88 -0
  133. package/style.css +496 -0
  134. package/testeranto/bundles/node/{mothership/chunk-V2EQEXU2.mjs → allTests/chunk-4PJCC2XT.mjs} +66 -59
  135. package/testeranto/bundles/node/allTests/metafile.json +4151 -0
  136. package/testeranto/bundles/node/allTests/src/PM/__tests__/nodeSidecar.testeranto.mjs +187 -0
  137. package/testeranto/bundles/node/{mothership → allTests}/src/PM/__tests__/pureSidecar.testeranto.mjs +1 -1
  138. package/testeranto/bundles/node/{mothership → allTests}/src/PM/__tests__/webSidecar.testeranto.mjs +1 -1
  139. package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test.mjs +305 -0
  140. package/testeranto/bundles/node/{mothership → allTests}/src/mothership/test.mjs +1 -1
  141. package/testeranto/dev.html +29 -0
  142. package/testeranto/index.html +28 -27
  143. package/testeranto/reports/allTests/config.json +57 -0
  144. package/testeranto/reports/{mothership/index.html → allTests/dev.html} +2 -0
  145. package/testeranto/reports/allTests/index.html +26 -0
  146. package/testeranto/reports/{mothership/src/PM/__tests__/sidecar.testeranto/node/index.html → allTests/src/PM/__tests__/nodeSidecar.testeranto/node/dev.html} +4 -3
  147. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/index.html +21 -0
  148. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +80 -0
  149. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/message +1 -0
  150. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +8 -0
  151. package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +28 -0
  152. package/testeranto/reports/{mothership/src/PM/__tests__/webSidecar.testeranto/node/index.html → allTests/src/PM/__tests__/pureSidecar.testeranto/node/dev.html} +4 -3
  153. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/index.html +21 -0
  154. package/testeranto/reports/{mothership → allTests}/src/PM/__tests__/pureSidecar.testeranto/node/lint_errors.json +12 -12
  155. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/message +1 -0
  156. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +8 -0
  157. package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/type_errors.txt +32 -0
  158. package/testeranto/reports/{mothership/src/PM/__tests__/nodeSidecar.testeranto/node/index.html → allTests/src/PM/__tests__/webSidecar.testeranto/node/dev.html} +4 -3
  159. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/index.html +21 -0
  160. package/testeranto/reports/{mothership → allTests}/src/PM/__tests__/webSidecar.testeranto/node/lint_errors.json +12 -12
  161. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/message +1 -0
  162. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +8 -0
  163. package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +32 -0
  164. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/console_log.txt +35 -0
  165. package/testeranto/reports/{mothership/src/PM/__tests__/pureSidecar.testeranto/node/index.html → allTests/src/lib/BaseSuite.test/node/dev.html} +4 -3
  166. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/index.html +21 -0
  167. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/lint_errors.json +608 -0
  168. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/message +1 -0
  169. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/prompt.txt +7 -0
  170. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/type_errors.txt +68 -0
  171. package/testeranto/reports/allTests/src/mothership/test/node/dev.html +21 -0
  172. package/testeranto/reports/allTests/src/mothership/test/node/index.html +21 -0
  173. package/testeranto/reports/allTests/src/mothership/test/node/message +1 -0
  174. package/testeranto/reports/allTests/src/mothership/test/node/prompt.txt +8 -0
  175. package/testeranto/reports/allTests/src/mothership/test/node/type_errors.txt +24 -0
  176. package/testeranto/reports/allTests/summary.json +37 -0
  177. package/testeranto.config.ts +16 -26
  178. package/tsc.log +66 -69
  179. package/.aider.tags.cache.v3/cache.db-shm +0 -0
  180. package/.aider.tags.cache.v3/cache.db-wal +0 -0
  181. package/dist/common/src/SP__Polygon.test.js +0 -10
  182. package/dist/module/src/ReportClient.js +0 -132
  183. package/dist/module/src/SP__Polygon.test.js +0 -8
  184. package/dist/prebuild/ReportClient.js +0 -3
  185. package/src/ReportClient.tsx +0 -164
  186. package/src/SP__Polygon.test.ts +0 -13
  187. package/testeranto/ReportClient.css +0 -11367
  188. package/testeranto/ReportClient.js +0 -24641
  189. package/testeranto/bundles/node/mothership/metafile.json +0 -389
  190. package/testeranto/bundles/node/mothership/src/PM/__tests__/nodeSidecar.testeranto.mjs +0 -1219
  191. package/testeranto/bundles/node/mothership/src/PM/__tests__/sidecar.testeranto.mjs +0 -1199
  192. package/testeranto/reports/mothership/config.json +0 -25
  193. package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/console_log.txt +0 -0
  194. package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +0 -1564
  195. package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +0 -22
  196. package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +0 -35
  197. package/testeranto/reports/mothership/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +0 -12
  198. package/testeranto/reports/mothership/src/PM/__tests__/pureSidecar.testeranto/node/type_errors.txt +0 -26
  199. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/bdd_errors.txt +0 -1
  200. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/console_log.txt +0 -0
  201. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/lint_errors.json +0 -1564
  202. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/log.txt +0 -0
  203. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/prompt.txt +0 -22
  204. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/tests.json +0 -56
  205. package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/type_errors.txt +0 -29
  206. package/testeranto/reports/mothership/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +0 -12
  207. package/testeranto/reports/mothership/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +0 -26
  208. package/testeranto/reports/mothership/src/mothership/test/node/bdd_errors.txt +0 -1
  209. package/testeranto/reports/mothership/src/mothership/test/node/console_log.txt +0 -4
  210. package/testeranto/reports/mothership/src/mothership/test/node/index.html +0 -20
  211. package/testeranto/reports/mothership/src/mothership/test/node/log.txt +0 -0
  212. package/testeranto/reports/mothership/src/mothership/test/node/prompt.txt +0 -12
  213. package/testeranto/reports/mothership/src/mothership/test/node/tests.json +0 -24
  214. package/testeranto/reports/mothership/src/mothership/test/node/type_errors.txt +0 -18
  215. package/testeranto/reports/mothership/summary.json +0 -9
  216. /package/dist/{types/src/SP__Polygon.test.d.ts → module/src/CoreTypes.js} +0 -0
  217. /package/testeranto/bundles/node/{mothership → allTests}/chunk-PG6KUKNP.mjs +0 -0
  218. /package/testeranto/bundles/pure/{mothership → allTests}/metafile.json +0 -0
  219. /package/testeranto/bundles/web/{mothership → allTests}/metafile.json +0 -0
  220. /package/testeranto/reports/{mothership/src/PM/__tests__/nodeSidecar.testeranto → allTests/src/lib/BaseSuite.test}/node/log.txt +0 -0
  221. /package/testeranto/reports/{mothership → allTests}/src/mothership/test/node/lint_errors.json +0 -0
package/README.md CHANGED
@@ -2,33 +2,29 @@
2
2
 
3
3
  ## The AI-powered BDD test framework for TypeScript projects
4
4
 
5
- 🚧 WARNING: Testeranto is still under development and is not ready for production yet. 🚧
5
+ #### 🚧 WARNING: Testeranto is still under development and is not ready for production yet. 🚧
6
6
 
7
- demo video: [youtube](https://www.youtube.com/embed/WvU5xMqGi6Q)
8
-
9
- source: [github.com/adamwong246/testeranto](https://github.com/adamwong246/testeranto)
10
-
11
- npm: [npmjs.com/package/testeranto](https://www.npmjs.com/package/testeranto)
12
-
13
- dev: [github.dev/adamwong246/testeranto](https://github.dev/adamwong246/testeranto)
14
-
15
- example repo: [testeranto-starter](https://github.com/adamwong246/testeranto-starter)
7
+ - demo video: [youtube](https://www.youtube.com/embed/WvU5xMqGi6Q)
8
+ - source: [github.com/adamwong246/testeranto](https://github.com/adamwong246/testeranto)
9
+ - npm: [npmjs.com/package/testeranto](https://www.npmjs.com/package/testeranto)
10
+ - dev: [github.dev/adamwong246/testeranto](https://github.dev/adamwong246/testeranto)
11
+ - example repo: [testeranto-starter](https://github.com/adamwong246/testeranto-starter)
16
12
 
17
13
  ## What is testeranto?
18
14
 
19
15
  - Testeranto produces test results which can be fed to Aider.ai to automatically fix failing tests.
20
16
  - Testeranto tests are specified in a strongly-typed gherkin-like syntax. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures.
21
- - Testeranto can be run in the frontend or the backend, or both.
17
+ - Testeranto can run tests in the frontend or the backend, or both.
22
18
  - Testeranto can be used to test anything that can be bundled with esbuild.
23
19
  - Testeranto connects "features" to "tests". This allows the AI to read feature documentation from external systems, like Jira.
24
20
  - Testeranto generates test results into static a website which can be deployed to github pages easily.
21
+ - Testeranto uses esbuild to bundle it's tests. The result is used to refine the list of files added to the context of the AI. **The consequence of this is that you can fit all relevant files, and ONLY the relevant files, into the LLMs context.**
25
22
 
26
23
  ## Key Technologies
27
24
 
28
- Testeranto builds on modern JavaScript/TypeScript tooling:
29
-
30
- | Technology | Purpose |
25
+ | | |
31
26
  | ---------- | -------------------------------------- |
27
+ | ESM | Modern javascript tooling |
32
28
  | TypeScript | Strongly-typed test definitions |
33
29
  | Puppeteer | Cross-runtime testing (Node & Browser) |
34
30
  | esbuild | Fast test bundling |
@@ -63,78 +59,35 @@ const RectangleSpec = (Suite, Given, When, Then) => [
63
59
  ];
64
60
  ```
65
61
 
66
- 3. Run your tests in two separate terminals:
62
+ 3. Run the tests
63
+
64
+ To start testeranto in dev mode, build your tests in one terminal and execute them in another
67
65
 
68
66
  ```bash
69
67
  # Terminal 1 - Build in watch mode
70
- yarn t-build rectangle.test.ts dev
68
+ yarn t-build rectangle.test.ts yourProject dev
71
69
 
72
70
  # Terminal 2 - Run in watch mode
73
- yarn t-run rectangle.test.ts dev
71
+ yarn t-run rectangle.test.ts yourProject dev
74
72
  ```
75
73
 
76
- ## Architecture Overview
77
-
78
- ```mermaid
79
- flowchart TD
80
- subgraph ThreePillars["Testeranto Core"]
81
- Builder[Test Builder]
82
- Runner[Test Runner]
83
- Aider[AI Integration]
84
- end
85
-
86
- subgraph BuilderComponents[" "]
87
- Specification[Specification]
88
- Implementation[Implementation]
89
- Interface[Interface]
90
- end
91
-
92
- subgraph Runtimes[" "]
93
- Node[Node]
94
- Web[Browser]
95
- Pure[JS]
96
- end
97
-
98
- Builder --> Runner
99
- Runner --> Aider
100
- Aider --> Builder
101
-
102
- Builder --> BuilderComponents
103
- Runner --> Runtimes
104
-
105
- style ThreePillars fill:none,stroke:#586e75
106
- style Builder fill:#268bd2,stroke:#586e75,color:#fdf6e3
107
- style Runner fill:#268bd2,stroke:#586e75,color:#fdf6e3
108
- style Aider fill:#b58900,stroke:#586e75,color:#002b36
109
- style BuilderComponents fill:#002b36,stroke:#586e75,color:#eee8d5
110
- style Runtimes fill:#073642,stroke:#586e75,color:#eee8d5
111
- style Specification fill:#2aa198,stroke:#586e75,color:#002b36
112
- style Implementation fill:#2aa198,stroke:#586e75,color:#002b36
113
- style Interface fill:#2aa198,stroke:#586e75,color:#002b36
114
- style Node fill:#859900,stroke:#586e75,color:#002b36
115
- style Web fill:#859900,stroke:#586e75,color:#002b36
116
- style Pure fill:#859900,stroke:#586e75,color:#002b36
74
+ or build and run your tests only once
75
+
76
+ ```bash
77
+ yarn t-build rectangle.test.ts yourProject once && yarn t-run rectangle.test.ts yourProject once
117
78
  ```
118
79
 
119
80
  ## Runtime Platforms
120
81
 
121
- Testeranto runs tests in multiple runtime environments, each suited for different testing scenarios:
122
-
123
- | Runtime | Description | When To Use | Key Characteristics |
124
- | -------- | ------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------- |
125
- | **Node** | Full IO access with Node.js built-in modules | Testing backend code, Node APIs, or anything needing filesystem access | Runs in Node v8 via fork, has access to fs, crypto, etc |
126
- | **Web** | DOM API access with browser capabilities | Testing frontend code, UI interactions, or visual regression | Runs in Chrome page, can take screenshots/recordings |
127
- | **Pure** | Isolated JS runtime without external dependencies | Fast unit tests that don't need external resources | Dynamically imported into main thread, no IO access |
128
-
129
- **Key Considerations:**
130
-
131
- - Use **Node** for testing backend services, file operations, or anything requiring Node.js APIs
132
- - Use **Web** when testing browser-specific code that references `document` or `window`
133
- - Use **Pure** for fast, isolated unit tests where you don't need console output or external resources
82
+ | | Runs on | You should use this runtime for... | Important differences |
83
+ | -------- | ----------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
84
+ | **Node** | node V8 with fork | testing backend code, Node APIs (like `fs` and `crypto`), or anything needing filesystem access | has access to the filesystem and io |
85
+ | **Web** | chrome browser | testing frontend code, anything that uses `document` or `window`, UI interactions, or visual regression | can take screenshots/recordings |
86
+ | **Pure** | node v8, dynamically imported | testing code which can run on both node-v8 and the the browser | Very similar to "Node" but has no IO access and thus, no console.log. This runtime is theoretically faster. |
134
87
 
135
88
  ## CLI Commands
136
89
 
137
- | Command | Description |
90
+ | | |
138
91
  | ------------------------------------- | --------------------------------------------- |
139
92
  | `yarn t-init` | Create a new testeranto project |
140
93
  | `yarn t-build <YOUR_TESTS> dev\|once` | Build test bundles (watch or single-run mode) |
@@ -142,7 +95,7 @@ Testeranto runs tests in multiple runtime environments, each suited for differen
142
95
  | `yarn t-report` | Launch test report server |
143
96
  | `yarn t-aider` | Fix failing tests with AI |
144
97
 
145
- Example workflow:
98
+ ## Example workflow:
146
99
 
147
100
  ```bash
148
101
  # Initialize project
@@ -164,7 +117,7 @@ yarn t-run test/rectangle.test.ts once
164
117
  yarn t-aider
165
118
  ```
166
119
 
167
- ## AI
120
+ ## Aider
168
121
 
169
122
  Testeranto generates a "prompt" alongside test results. This prompt is passed to aider as input.
170
123
 
@@ -181,14 +134,14 @@ Testeranto generates a "prompt" alongside test results. This prompt is passed to
181
134
  /load testeranto/reports/allTests/node/test/node/featurePrompt.txt
182
135
 
183
136
  // tell the AI what to do
184
- /code Fix the failing tests described in testeranto/reports/allTests/node/test/node/tests.json. Correct any type signature errors described in the files testeranto/reports/allTests/test/node/node/type_errors.txt. Implement any method which throws "Function not implemented. Resolve the lint errors described in testeranto/reports/allTests/test/node/node/lint_errors.json"
137
+ Fix the failing tests described in testeranto/reports/allTests/node/test/node/tests.json. Correct any type signature errors described in the files testeranto/reports/allTests/test/node/node/type_errors.txt. Implement any method which throws "Function not implemented. Resolve the lint errors described in testeranto/reports/allTests/test/node/node/lint_errors.json"
185
138
  ```
186
139
 
187
140
  ## "Features"
188
141
 
189
142
  Testeranto connects "features" to tests. The features may be simple strings, but they can also take the form of local markdown files, or remote URLs to external feature tracking systems. For instance, this could be a jira ticket or a github issue. These features are used to inform the AI context.
190
143
 
191
- ```ts
144
+ ```typescript
192
145
  import someMarkdownFile from "someMarkdownFile.md";
193
146
 
194
147
  ...
@@ -207,353 +160,6 @@ test0: Given.Default(
207
160
 
208
161
  ```
209
162
 
210
- ## Core Concepts
211
-
212
- Testeranto's type system provides a rigorous framework for Behavior-Driven Development (BDD) testing. Let's break down the key components using a Rectangle class example.
213
-
214
- ### 1. Test Subject
215
-
216
- First, define the class you want to test:
217
-
218
- ```typescript
219
- class Rectangle {
220
- constructor(public width: number, public height: number) {}
221
-
222
- setWidth(w: number) {
223
- this.width = w;
224
- }
225
- setHeight(h: number) {
226
- this.height = h;
227
- }
228
- getArea() {
229
- return this.width * this.height;
230
- }
231
- }
232
- ```
233
-
234
- ### 2. Test Interface Types
235
-
236
- Testeranto uses a powerful type system to ensure your tests match your implementation:
237
-
238
- ```typescript
239
- type IRectangle = Ibdd_in<
240
- null, // No special initialization needed
241
- null, // No special cleanup needed
242
- Rectangle, // The test subject type
243
- Rectangle, // State type between test steps
244
- Rectangle, // Final state type
245
- (n: number) => (r: Rectangle) => void, // When functions signature
246
- (r: Rectangle) => number // Then functions signature
247
- >;
248
- ```
249
-
250
- This type definition ensures:
251
-
252
- - Type safety throughout the test lifecycle
253
- - Clear separation of test phases (setup, execution, verification)
254
- - Proper function signatures for test steps
255
-
256
- ### 3. Test Specification
257
-
258
- Define your BDD-style tests with full type checking:
259
-
260
- ```typescript
261
- const RectangleSpec: ITestSpecification<IRectangle> = (
262
- Suite,
263
- Given,
264
- When,
265
- Then
266
- ) => [
267
- Suite.Default("Rectangle Operations", {
268
- // Test case 1: Basic dimension setting
269
- basicDimensions: Given.Default(
270
- ["Validate basic rectangle operations"],
271
- [When.setWidth(5), When.setHeight(10)], // Actions
272
- [Then.getWidth(5), Then.getHeight(10)] // Assertions
273
- ),
274
-
275
- // Test case 2: Area calculation
276
- areaCalculation: Given.Default(
277
- ["Validate area calculation"],
278
- [When.setWidth(3), When.setHeight(4)],
279
- [(r) => r.getArea() === 12] // Custom assertion
280
- ),
281
- }),
282
- ];
283
- ```
284
-
285
- ### Development Workflow
286
-
287
- ```mermaid
288
-
289
-
290
-
291
-
292
- flowchart LR
293
-
294
- subgraph hh["humans"]
295
- direction LR
296
- Human[🧑💻 ]
297
- end
298
-
299
- subgraph bb["AI"]
300
- direction LR
301
- Bot[🤖🧠 aider]
302
- end
303
-
304
-
305
- tests ---> L
306
- subgraph tests
307
- direction LR
308
- A[Test Specification]
309
- B[Test Interface]
310
- C[Test Implementation]
311
- K[application code]
312
- end
313
-
314
- subgraph buildSystem
315
- direction TB
316
- L["t-build"]
317
- M[t-run]
318
- L ---> M
319
-
320
- M ---> N
321
- M --->O
322
- M --->P
323
- N["BDD tests"]
324
- O["Static analysis"]
325
- P["Type checking"]
326
-
327
- Q["reports"]
328
- N ---> Q
329
- O ---> Q
330
- P ---> Q
331
-
332
-
333
-
334
- end
335
-
336
- Q ---> bb
337
-
338
- buildSystem ---> bb
339
- bb ---> tests
340
- hh ---> tests
341
-
342
-
343
-
344
-
345
-
346
-
347
- %% Styling
348
- style Human fill:#268bd2,stroke:#586e75,color:#fdf6e3
349
- style Bot fill:#d33682,stroke:#586e75,color:#fdf6e3
350
-
351
- %% Layout tweaks
352
- classDef column margin-right:20px
353
-
354
- ```
355
-
356
- **Key Components:**
357
-
358
- 1. **Specification** - BDD test definitions (Given/When/Then)
359
- 2. **Implementation** - Concrete test logic and assertions
360
- 3. **Interface** - Test lifecycle hooks (before/after each)
361
-
362
- **Rapid Development Loop:**
363
-
364
- 1. `t-build` continuously type-checks and bundles tests
365
- 2. `t-run` executes tests as they change
366
- 3. Aider analyzes failures and suggests fixes
367
- 4. Developer iterates based on feedback
368
-
369
- The workflow creates a tight feedback loop where:
370
-
371
- - Type errors are caught immediately during build
372
- - Test failures trigger AI-assisted fixes
373
- - Changes propagate instantly through the system
374
-
375
- 2. **Autocomplete** - IDE support for test steps
376
- 3. **Refactoring safety** - Changes to implementation trigger type errors in tests
377
- 4. **Documentation** - Types serve as living documentation
378
-
379
- ### The Testing Lifecycle
380
-
381
- 1. **Given** - Set up initial state
382
- 2. **When** - Perform actions on the subject
383
- 3. **Then** - Verify outcomes
384
- 4. **Check** - Imperative-style validations (optional)
385
-
386
- Each phase is type-checked against your interface definition, ensuring tests remain valid as your code evolves.
387
-
388
- ```js
389
- export default async <I extends IT, O extends OT, M>(
390
-
391
- // the thing that is being tested.
392
- input: I["iinput"],
393
-
394
- testSpecification: ITestSpecification<I, O>,
395
- testImplementation: ITestImplementation<I, O, M>,
396
- testInterface: Partial<IWebTestInterface<I>>,
397
- testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement
398
- ) => {
399
-
400
- // or WebTesteranto<I, O, M> or PureTesteranto<I, O, M>
401
- return new NodeTesteranto<I, O, M>(
402
- input,
403
- testSpecification,
404
- testImplementation,
405
- testResourceRequirement,
406
- testInterface
407
- );
408
- };
409
-
410
- ```
411
-
412
- Practically speaking, for each thing you test, you will need to implement 3 types and 4 objects.
413
-
414
- #### type I
415
-
416
- this type describes the shape of the BDD test
417
-
418
- ```ts
419
- export type I = Ibdd_in<
420
- null,
421
- null,
422
- Rectangle,
423
- Rectangle,
424
- Rectangle,
425
- (...x) => (rectangle: Rectangle, utils: IPM) => Rectangle,
426
- (rectangle: Rectangle, utils: IPM) => Rectangle
427
- >;
428
- ```
429
-
430
- #### type O
431
-
432
- this type describes the shape of the "interface"
433
-
434
- ```ts
435
- export type O = Ibdd_out<
436
- // Suite
437
- {
438
- Default: [string];
439
- },
440
- // "Given" are initial states
441
- {
442
- Default;
443
- WidthOfOneAndHeightOfOne;
444
- WidthAndHeightOf: [number, number];
445
- },
446
- // "Whens" are steps which change the state of the test subject
447
- {
448
- HeightIsPubliclySetTo: [number];
449
- WidthIsPubliclySetTo: [number];
450
- setWidth: [number];
451
- setHeight: [number];
452
- },
453
- // "Thens" are steps which make assertions of the test subject
454
- {
455
- AreaPlusCircumference: [number];
456
- circumference: [number];
457
- getWidth: [number];
458
- getHeight: [number];
459
- area: [number];
460
- prototype: [];
461
- },
462
- // "Checks" are similar to "Givens"
463
- {
464
- Default;
465
- WidthOfOneAndHeightOfOne;
466
- WidthAndHeightOf: [number, number];
467
- }
468
- >;
469
- ```
470
-
471
- #### type M (optional)
472
-
473
- this type describes the modifications to the shape of the "specification". It can be used to make your BDD tests DRYer but is not necessary
474
-
475
- ```ts
476
- export type M = {
477
- givens: {
478
- [K in keyof O["givens"]]: (...Iw: O["givens"][K]) => Rectangle;
479
- };
480
- whens: {
481
- [K in keyof O["whens"]]: (
482
- ...Iw: O["whens"][K]
483
- ) => (rectangle: Rectangle, utils: PM) => Rectangle;
484
- };
485
- thens: {
486
- [K in keyof O["thens"]]: (
487
- ...Iw: O["thens"][K]
488
- ) => (rectangle: Rectangle, utils: PM) => Rectangle;
489
- };
490
- };
491
- ```
492
-
493
- #### the "specification" aka ITestSpecification<I, O>
494
-
495
- The test specification is the BDD tests logic. The specification implements BDD directives "Given", "When", and Then"
496
-
497
- ```ts
498
- export const RectangleTesterantoBaseTestSpecification: ITestSpecification<
499
- I,
500
- O
501
- > = (Suite, Given, When, Then, Check) => {
502
- return [
503
- Suite.Default(
504
- "Testing the Rectangle class",
505
- {
506
- // A "given" is a strict BDD test. It starts with an initial state, then executes the "whens" which update the test subject, and then executes the "thens" as a assertions.
507
- test0: Given.Default(
508
- // a list of features
509
- ["https://api.github.com/repos/adamwong246/testeranto/issues/8"],
510
- // a list of "whens"
511
- [When.setWidth(4), When.setHeight(19)],
512
- // a list of "thens"
513
- [Then.getWidth(4), Then.getHeight(19)]
514
- ),
515
- },
516
-
517
- [
518
- // a "check" is a less strict style of test. Instead of lists of whens and thens, you get a function callback.
519
- Check.Default("imperative style?!", [], async (rectangle) => {
520
- Then.getWidth(2).thenCB(rectangle);
521
- Then.getHeight(2).thenCB(rectangle);
522
- When.setHeight(22).whenCB(rectangle);
523
- Then.getHeight(232).thenCB(rectangle);
524
- }),
525
- ]
526
- ),
527
- ];
528
- };
529
- ```
530
-
531
- #### the "interface" aka testInterface: Partial<IWebTestInterface<I>>
532
-
533
- The test interface is code which is NOT BDD steps. The interface implements "before all", "after all", "before each", and "after each", all of which are optional. f
534
-
535
- ```ts
536
- export const RectangleTesterantoBaseInterface: IPartialInterface<I> = {
537
- beforeEach: async (subject, i) => {
538
- return i();
539
- },
540
- andWhen: async function (s, whenCB, tr, utils) {
541
- return whenCB(s)(s, utils);
542
- },
543
- butThen: async (s, t, tr, pm) => {
544
- return t(s, pm);
545
- },
546
- };
547
- ```
548
-
549
- #### the "test resource requirement" aka ITTestResourceRequest (optional)
550
-
551
- The test resource requirement describes things that the test needs to run, namely network ports. It is optional, but you should add this argument if your test needs to rely upon network ports
552
-
553
- ```ts
554
- // TODO add example of test resource requirement
555
- ```
556
-
557
163
  ## Sidecars (COMING SOON)
558
164
 
559
165
  Along side your test, you can include a number of "sidecars" which are other bundled javascript assets upon which your test depends. For example, suppose you have an app with a frontend and backend component. You could run a react test in the web and include the node http server as a sidecar.
package/bundle.js CHANGED
@@ -25,7 +25,7 @@ await esbuild.build({
25
25
  })
26
26
 
27
27
  await esbuild.build({
28
- entryPoints: ['src/ReportClient.tsx', 'src/TestReport.tsx', 'src/Project.tsx'],
28
+ entryPoints: ['src/TestReport.tsx', 'src/Project.tsx'],
29
29
  bundle: true,
30
30
  format: "iife",
31
31
  platform: "browser",
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -25,7 +25,10 @@ exports.default = async () => {
25
25
  }
26
26
  });
27
27
  fs_1.default.copyFileSync(`node_modules/testeranto/dist/prebuild/Project.js`, `testeranto/Project.js`);
28
- fs_1.default.copyFileSync(`node_modules/testeranto/dist/prebuild/ReportClient.js`, `testeranto/ReportClient.js`);
28
+ // fs.copyFileSync(
29
+ // `node_modules/testeranto/dist/prebuild/ReportClient.js`,
30
+ // `testeranto/ReportClient.js`
31
+ // );
29
32
  fs_1.default.copyFileSync(`node_modules/testeranto/dist/prebuild/Project.css`, `testeranto/Project.css`);
30
33
  // fs.copyFileSync(
31
34
  // `node_modules/testeranto/dist/prebuild/ReportClient.css`,
@@ -51,6 +51,6 @@ const testeranto = async (input, testSpecification, testImplementation, testInte
51
51
  // });
52
52
  // });
53
53
  }
54
- return t;
54
+ // return t;
55
55
  };
56
56
  exports.default = testeranto;
@@ -72,8 +72,12 @@ class PM_WithEslintAndTsc extends base_js_1.PM_Base {
72
72
  this.makePrompt = async (entryPoint, addableFiles, platform) => {
73
73
  this.summary[entryPoint].prompt = "?";
74
74
  const promptPath = (0, utils_1.promptPather)(entryPoint, platform, this.name);
75
- const testPaths = path_1.default.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
75
+ const testPaths = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `tests.json`);
76
76
  const featuresPath = path_1.default.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
77
+ const logPath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `console_log.txt`);
78
+ const lintPath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `lint_errors.json`);
79
+ const typePath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `type_errors.txt`);
80
+ const messagePath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `message`);
77
81
  fs_1.default.writeFileSync(promptPath, `
78
82
  ${addableFiles
79
83
  .map((x) => {
@@ -81,14 +85,12 @@ ${addableFiles
81
85
  })
82
86
  .join("\n")}
83
87
 
84
- /read ${(0, utils_1.lintPather)(entryPoint, platform, this.name)}
85
- /read ${(0, utils_1.tscPather)(entryPoint, platform, this.name)}
86
88
  /read ${testPaths}
87
-
88
- /load ${featuresPath}
89
-
90
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${(0, utils_1.tscPather)(entryPoint, platform, this.name)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${(0, utils_1.lintPather)(entryPoint, platform, this.name)}"
91
- `);
89
+ /read ${logPath}
90
+ /read ${typePath}
91
+ /read ${lintPath}
92
+ `);
93
+ fs_1.default.writeFileSync(messagePath, `Fix the failing tests described in ${testPaths} and ${logPath}. DO NOT refactor beyond what is necessary. Always prefer minimal changes, focusing mostly on keeping the BDD tests passing`);
92
94
  this.summary[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${this.name}/reports/${platform}/${entryPoint
93
95
  .split(".")
94
96
  .slice(0, -1)
@@ -41,7 +41,7 @@ const implementation = {
41
41
  return mockProcess;
42
42
  },
43
43
  addListener: () => mockProcess,
44
- removeListener: () => mockProcess
44
+ removeListener: () => mockProcess,
45
45
  };
46
46
  process = mockProcess;
47
47
  let writeCalled = false;
@@ -63,7 +63,7 @@ const implementation = {
63
63
  removeListener: () => {
64
64
  removeListenerCalled = true;
65
65
  return mockProcess;
66
- }
66
+ },
67
67
  };
68
68
  process = mockProcess;
69
69
  await sidecar.send("test-command", "test");
@@ -312,7 +312,9 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
312
312
  const builtfile = dest;
313
313
  let haltReturns = false;
314
314
  const ipcfile = "/tmp/tpipe_" + Math.random();
315
- const child = (0, node_child_process_1.spawn)("node", [builtfile, testResources, ipcfile], {
315
+ const child = (0, node_child_process_1.spawn)("node",
316
+ // "node --inspect-brk ",
317
+ [builtfile, testResources, ipcfile], {
316
318
  stdio: ["pipe", "pipe", "pipe", "ipc"],
317
319
  });
318
320
  let buffer = new Buffer("");
@@ -367,7 +369,6 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
367
369
  oStream.write(`stdout > ${data}`);
368
370
  });
369
371
  child.on("close", (code) => {
370
- console.log("close");
371
372
  oStream.close();
372
373
  server.close();
373
374
  // this.receiveFeaturesV2(reportDest, src, "node");
@@ -386,14 +387,12 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
386
387
  haltReturns = true;
387
388
  });
388
389
  child.on("exit", (code) => {
389
- console.log("exit");
390
390
  haltReturns = true;
391
391
  for (let i = 0; i <= portsToUse.length; i++) {
392
392
  if (portsToUse[i]) {
393
393
  this.ports[portsToUse[i]] = true; //port is open again
394
394
  }
395
395
  }
396
- console.log("exitthis.ports", this.ports);
397
396
  });
398
397
  child.on("error", (e) => {
399
398
  console.log("error");
@@ -429,7 +428,10 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
429
428
  files[src] = new Set();
430
429
  }
431
430
  // files[t].add(filepath);
432
- fs_1.default.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[src])));
431
+ // fs.writeFileSync(
432
+ // destFolder + "/manifest.json",
433
+ // JSON.stringify(Array.from(files[src]))
434
+ // );
433
435
  delete files[src];
434
436
  Promise.all(screenshots[src] || []).then(() => {
435
437
  delete screenshots[src];
@@ -749,7 +751,10 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
749
751
  files[src] = new Set();
750
752
  }
751
753
  // files[t].add(filepath);
752
- fs_1.default.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[src])));
754
+ // fs.writeFileSync(
755
+ // destFolder + "/manifest.json",
756
+ // JSON.stringify(Array.from(files[src]))
757
+ // );
753
758
  delete files[src];
754
759
  Promise.all(screenshots[src] || []).then(() => {
755
760
  delete screenshots[src];
@@ -970,7 +975,7 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
970
975
  slowMo: 1,
971
976
  waitForInitialPage: false,
972
977
  executablePath,
973
- headless: false,
978
+ headless: true,
974
979
  dumpio: false,
975
980
  devtools: false,
976
981
  args: [