@neurodevs/node-tdd 0.2.5 → 1.0.1

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 (326) hide show
  1. package/.vscode/launch.json +52 -57
  2. package/.vscode/settings.json +61 -66
  3. package/.vscode/tasks.json +98 -129
  4. package/README.md +1 -0
  5. package/build/.spruce/settings.json +3 -10
  6. package/build/__tests__/MockFetch.d.ts +18 -0
  7. package/build/__tests__/MockFetch.js +55 -0
  8. package/build/__tests__/MockFetch.js.map +1 -0
  9. package/build/__tests__/{impl → behavioral}/AbstractModuleTest.test.d.ts +2 -3
  10. package/build/__tests__/{impl → behavioral}/AbstractModuleTest.test.js +3 -12
  11. package/build/__tests__/behavioral/AbstractModuleTest.test.js.map +1 -0
  12. package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.d.ts +5 -0
  13. package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js +34 -0
  14. package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js.map +1 -0
  15. package/build/__tests__/behavioral/utilities/Assert.test.d.ts +45 -0
  16. package/build/__tests__/behavioral/utilities/Assert.test.js +645 -0
  17. package/build/__tests__/behavioral/utilities/Assert.test.js.map +1 -0
  18. package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.d.ts +4 -0
  19. package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js +23 -0
  20. package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js.map +1 -0
  21. package/build/__tests__/behavioral/utilities/MockFetch.test.d.ts +28 -0
  22. package/build/__tests__/behavioral/utilities/MockFetch.test.js +211 -0
  23. package/build/__tests__/behavioral/utilities/MockFetch.test.js.map +1 -0
  24. package/build/__tests__/behavioral/utilities/StackCleaner.test.d.ts +4 -0
  25. package/build/__tests__/behavioral/utilities/StackCleaner.test.js +46 -0
  26. package/build/__tests__/behavioral/utilities/StackCleaner.test.js.map +1 -0
  27. package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.d.ts +7 -0
  28. package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js +32 -0
  29. package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js.map +1 -0
  30. package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.d.ts +4 -0
  31. package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js +19 -0
  32. package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js.map +1 -0
  33. package/build/__tests__/behavioral/utilities/Stringify.test.d.ts +5 -0
  34. package/build/__tests__/behavioral/utilities/Stringify.test.js +127 -0
  35. package/build/__tests__/behavioral/utilities/Stringify.test.js.map +1 -0
  36. package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.d.ts +7 -0
  37. package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js +38 -0
  38. package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js.map +1 -0
  39. package/build/__tests__/behavioral/utilities/TestOnBasic.test.d.ts +12 -0
  40. package/build/__tests__/behavioral/utilities/TestOnBasic.test.js +68 -0
  41. package/build/__tests__/behavioral/utilities/TestOnBasic.test.js.map +1 -0
  42. package/build/__tests__/behavioral/utilities/TestOnInstance.test.d.ts +28 -0
  43. package/build/__tests__/behavioral/utilities/TestOnInstance.test.js +289 -0
  44. package/build/__tests__/behavioral/utilities/TestOnInstance.test.js.map +1 -0
  45. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.d.ts +9 -0
  46. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js +118 -0
  47. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js.map +1 -0
  48. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.d.ts +5 -0
  49. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js +78 -0
  50. package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js.map +1 -0
  51. package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.d.ts +4 -0
  52. package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js +23 -0
  53. package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js.map +1 -0
  54. package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.d.ts +4 -0
  55. package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js +24 -0
  56. package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js.map +1 -0
  57. package/build/__tests__/behavioral/utilities/TestResolver.test.d.ts +7 -0
  58. package/build/__tests__/behavioral/utilities/TestResolver.test.js +38 -0
  59. package/build/__tests__/behavioral/utilities/TestResolver.test.js.map +1 -0
  60. package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.d.ts +4 -0
  61. package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js +20 -0
  62. package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js.map +1 -0
  63. package/build/__tests__/behavioral/workspace/JestJsonParser.test.d.ts +18 -0
  64. package/build/__tests__/behavioral/workspace/JestJsonParser.test.js +267 -0
  65. package/build/__tests__/behavioral/workspace/JestJsonParser.test.js.map +1 -0
  66. package/build/__tests__/behavioral/workspace/TestReporter.test.d.ts +16 -0
  67. package/build/__tests__/behavioral/workspace/TestReporter.test.js +227 -0
  68. package/build/__tests__/behavioral/workspace/TestReporter.test.js.map +1 -0
  69. package/build/__tests__/behavioral/workspace/TestRunner.test.d.ts +15 -0
  70. package/build/__tests__/behavioral/workspace/TestRunner.test.js +99 -0
  71. package/build/__tests__/behavioral/workspace/TestRunner.test.js.map +1 -0
  72. package/build/__tests__/behavioral/workspace/Widgets.test.d.ts +13 -0
  73. package/build/__tests__/behavioral/workspace/Widgets.test.js +99 -0
  74. package/build/__tests__/behavioral/workspace/Widgets.test.js.map +1 -0
  75. package/build/__tests__/mock-terminal-kit.d.ts +79 -0
  76. package/build/__tests__/mock-terminal-kit.js +103 -0
  77. package/build/__tests__/mock-terminal-kit.js.map +1 -0
  78. package/build/__tests__/support/AbstractForInstanceTest.d.ts +4 -0
  79. package/build/__tests__/support/AbstractForInstanceTest.js +9 -0
  80. package/build/__tests__/support/AbstractForInstanceTest.js.map +1 -0
  81. package/build/__tests__/support/AbstractLevelOneTest.d.ts +3 -0
  82. package/build/__tests__/support/AbstractLevelOneTest.js +4 -0
  83. package/build/__tests__/support/AbstractLevelOneTest.js.map +1 -0
  84. package/build/__tests__/support/AbstractLevelTwoTest.d.ts +7 -0
  85. package/build/__tests__/support/AbstractLevelTwoTest.js +14 -0
  86. package/build/__tests__/support/AbstractLevelTwoTest.js.map +1 -0
  87. package/build/__tests__/support/AbstractStaticTest.d.ts +7 -0
  88. package/build/__tests__/support/AbstractStaticTest.js +14 -0
  89. package/build/__tests__/support/AbstractStaticTest.js.map +1 -0
  90. package/build/__tests__/support/AbstractTestOnInstanceTest.d.ts +22 -0
  91. package/build/__tests__/support/AbstractTestOnInstanceTest.js +23 -0
  92. package/build/__tests__/support/AbstractTestOnInstanceTest.js.map +1 -0
  93. package/build/__tests__/support/AbstractTestOnInstanceWithHooks.d.ts +26 -0
  94. package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js +59 -0
  95. package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js.map +1 -0
  96. package/build/__tests__/support/jest.setup.d.ts +1 -0
  97. package/build/__tests__/support/jest.setup.js +4 -0
  98. package/build/__tests__/support/jest.setup.js.map +1 -0
  99. package/build/__tests__/support/onTestFileResult.d.ts +244 -0
  100. package/build/__tests__/support/onTestFileResult.js +980 -0
  101. package/build/__tests__/support/onTestFileResult.js.map +1 -0
  102. package/build/impl/AbstractModuleTest.d.ts +18 -4
  103. package/build/impl/AbstractModuleTest.js +47 -9
  104. package/build/impl/AbstractModuleTest.js.map +1 -1
  105. package/build/index.d.ts +4 -4
  106. package/build/index.js +4 -4
  107. package/build/index.js.map +1 -1
  108. package/build/utilities/AssertionError.d.ts +3 -0
  109. package/build/utilities/AssertionError.js +12 -0
  110. package/build/utilities/AssertionError.js.map +1 -0
  111. package/build/utilities/StackCleaner.d.ts +4 -0
  112. package/build/utilities/StackCleaner.js +10 -0
  113. package/build/utilities/StackCleaner.js.map +1 -0
  114. package/build/utilities/TestDecoratorResolver.d.ts +35 -0
  115. package/build/utilities/TestDecoratorResolver.js +93 -0
  116. package/build/utilities/TestDecoratorResolver.js.map +1 -0
  117. package/build/utilities/assert.d.ts +49 -0
  118. package/build/utilities/assert.js +255 -0
  119. package/build/utilities/assert.js.map +1 -0
  120. package/build/utilities/assert.utility.d.ts +28 -0
  121. package/build/utilities/assert.utility.js +185 -0
  122. package/build/utilities/assert.utility.js.map +1 -0
  123. package/build/utilities/decorators.d.ts +9 -0
  124. package/build/utilities/decorators.js +133 -0
  125. package/build/utilities/decorators.js.map +1 -0
  126. package/build/workspace/CommandService.d.ts +49 -0
  127. package/build/workspace/CommandService.js +179 -0
  128. package/build/workspace/CommandService.js.map +1 -0
  129. package/build/workspace/JestJsonParser.d.ts +15 -0
  130. package/build/workspace/JestJsonParser.js +149 -0
  131. package/build/workspace/JestJsonParser.js.map +1 -0
  132. package/build/workspace/TKButtonWidget.d.ts +13 -0
  133. package/build/workspace/TKButtonWidget.js +37 -0
  134. package/build/workspace/TKButtonWidget.js.map +1 -0
  135. package/build/workspace/TestLogItemGenerator.d.ts +15 -0
  136. package/build/workspace/TestLogItemGenerator.js +142 -0
  137. package/build/workspace/TestLogItemGenerator.js.map +1 -0
  138. package/build/workspace/TestReporter.d.ts +103 -0
  139. package/build/workspace/TestReporter.js +677 -0
  140. package/build/workspace/TestReporter.js.map +1 -0
  141. package/build/workspace/TestRunner.d.ts +24 -0
  142. package/build/workspace/TestRunner.js +95 -0
  143. package/build/workspace/TestRunner.js.map +1 -0
  144. package/build/workspace/TkBaseWidget.d.ts +37 -0
  145. package/build/workspace/TkBaseWidget.js +185 -0
  146. package/build/workspace/TkBaseWidget.js.map +1 -0
  147. package/build/workspace/TkInputWidget.d.ts +16 -0
  148. package/build/workspace/TkInputWidget.js +64 -0
  149. package/build/workspace/TkInputWidget.js.map +1 -0
  150. package/build/workspace/TkLayoutCellWidget.d.ts +18 -0
  151. package/build/workspace/TkLayoutCellWidget.js +32 -0
  152. package/build/workspace/TkLayoutCellWidget.js.map +1 -0
  153. package/build/workspace/TkLayoutWidget.d.ts +34 -0
  154. package/build/workspace/TkLayoutWidget.js +130 -0
  155. package/build/workspace/TkLayoutWidget.js.map +1 -0
  156. package/build/workspace/TkMenuBarWidget.d.ts +13 -0
  157. package/build/workspace/TkMenuBarWidget.js +71 -0
  158. package/build/workspace/TkMenuBarWidget.js.map +1 -0
  159. package/build/workspace/TkPopupWidget.d.ts +16 -0
  160. package/build/workspace/TkPopupWidget.js +36 -0
  161. package/build/workspace/TkPopupWidget.js.map +1 -0
  162. package/build/workspace/TkProgressBarWidget.d.ts +10 -0
  163. package/build/workspace/TkProgressBarWidget.js +39 -0
  164. package/build/workspace/TkProgressBarWidget.js.map +1 -0
  165. package/build/workspace/TkTextWidget.d.ts +20 -0
  166. package/build/workspace/TkTextWidget.js +115 -0
  167. package/build/workspace/TkTextWidget.js.map +1 -0
  168. package/build/workspace/TkWindowWidget.d.ts +22 -0
  169. package/build/workspace/TkWindowWidget.js +88 -0
  170. package/build/workspace/TkWindowWidget.js.map +1 -0
  171. package/build/workspace/WidgetFactory.d.ts +6 -0
  172. package/build/workspace/WidgetFactory.js +21 -0
  173. package/build/workspace/WidgetFactory.js.map +1 -0
  174. package/build/workspace/button.types.d.ts +15 -0
  175. package/build/workspace/button.types.js +6 -0
  176. package/build/workspace/button.types.js.map +1 -0
  177. package/build/workspace/duration.utility.d.ts +4 -0
  178. package/build/workspace/duration.utility.js +26 -0
  179. package/build/workspace/duration.utility.js.map +1 -0
  180. package/build/workspace/factory.types.d.ts +89 -0
  181. package/build/workspace/factory.types.js +37 -0
  182. package/build/workspace/factory.types.js.map +1 -0
  183. package/build/workspace/input.types.d.ts +18 -0
  184. package/build/workspace/input.types.js +7 -0
  185. package/build/workspace/input.types.js.map +1 -0
  186. package/build/workspace/keySelectChoices.d.ts +517 -0
  187. package/build/workspace/keySelectChoices.js +2 -0
  188. package/build/workspace/keySelectChoices.js.map +1 -0
  189. package/build/workspace/layout.types.d.ts +33 -0
  190. package/build/workspace/layout.types.js +2 -0
  191. package/build/workspace/layout.types.js.map +1 -0
  192. package/build/workspace/menuBar.types.d.ts +19 -0
  193. package/build/workspace/menuBar.types.js +6 -0
  194. package/build/workspace/menuBar.types.js.map +1 -0
  195. package/build/workspace/popup.types.d.ts +13 -0
  196. package/build/workspace/popup.types.js +6 -0
  197. package/build/workspace/popup.types.js.map +1 -0
  198. package/build/workspace/progressBar.types.d.ts +10 -0
  199. package/build/workspace/progressBar.types.js +2 -0
  200. package/build/workspace/progressBar.types.js.map +1 -0
  201. package/build/workspace/table.types.d.ts +6 -0
  202. package/build/workspace/table.types.js +2 -0
  203. package/build/workspace/table.types.js.map +1 -0
  204. package/build/workspace/termKit.utility.d.ts +12 -0
  205. package/build/workspace/termKit.utility.js +128 -0
  206. package/build/workspace/termKit.utility.js.map +1 -0
  207. package/build/workspace/test.types.d.ts +24 -0
  208. package/build/workspace/test.types.js +2 -0
  209. package/build/workspace/test.types.js.map +1 -0
  210. package/build/workspace/testRunner.cli.d.ts +1 -0
  211. package/build/workspace/testRunner.cli.js +149 -0
  212. package/build/workspace/testRunner.cli.js.map +1 -0
  213. package/build/workspace/text.types.d.ts +20 -0
  214. package/build/workspace/text.types.js +7 -0
  215. package/build/workspace/text.types.js.map +1 -0
  216. package/build/workspace/widget.utilities.d.ts +5 -0
  217. package/build/workspace/widget.utilities.js +20 -0
  218. package/build/workspace/widget.utilities.js.map +1 -0
  219. package/build/workspace/widgets.types.d.ts +66 -0
  220. package/build/workspace/widgets.types.js +2 -0
  221. package/build/workspace/widgets.types.js.map +1 -0
  222. package/build/workspace/window.types.d.ts +18 -0
  223. package/build/workspace/window.types.js +9 -0
  224. package/build/workspace/window.types.js.map +1 -0
  225. package/eslint.config.js +3 -0
  226. package/package.json +31 -37
  227. package/prettier.config.js +3 -0
  228. package/src/.spruce/settings.json +3 -10
  229. package/src/__tests__/MockFetch.ts +100 -0
  230. package/src/__tests__/behavioral/AbstractModuleTest.test.ts +15 -0
  231. package/src/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.ts +31 -0
  232. package/src/__tests__/behavioral/utilities/Assert.test.ts +826 -0
  233. package/src/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.ts +14 -0
  234. package/src/__tests__/behavioral/utilities/MockFetch.test.ts +240 -0
  235. package/src/__tests__/behavioral/utilities/StackCleaner.test.ts +46 -0
  236. package/src/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.ts +34 -0
  237. package/src/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.ts +11 -0
  238. package/src/__tests__/behavioral/utilities/Stringify.test.ts +169 -0
  239. package/src/__tests__/behavioral/utilities/TestDecoratorResolver.test.ts +51 -0
  240. package/src/__tests__/behavioral/utilities/TestOnBasic.test.ts +62 -0
  241. package/src/__tests__/behavioral/utilities/TestOnInstance.test.ts +439 -0
  242. package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.ts +237 -0
  243. package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.ts +85 -0
  244. package/src/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.ts +14 -0
  245. package/src/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.ts +16 -0
  246. package/src/__tests__/behavioral/utilities/TestResolver.test.ts +48 -0
  247. package/src/__tests__/behavioral/utilities/TestResolverOnStatic.test.ts +12 -0
  248. package/src/__tests__/behavioral/workspace/JestJsonParser.test.ts +357 -0
  249. package/src/__tests__/behavioral/workspace/TestReporter.test.ts +257 -0
  250. package/src/__tests__/behavioral/workspace/TestRunner.test.ts +87 -0
  251. package/src/__tests__/behavioral/workspace/Widgets.test.ts +90 -0
  252. package/src/__tests__/mock-terminal-kit.ts +115 -0
  253. package/src/__tests__/support/AbstractForInstanceTest.ts +12 -0
  254. package/src/__tests__/support/AbstractLevelOneTest.ts +3 -0
  255. package/src/__tests__/support/AbstractLevelTwoTest.ts +16 -0
  256. package/src/__tests__/support/AbstractStaticTest.ts +16 -0
  257. package/src/__tests__/support/AbstractTestOnInstanceTest.ts +30 -0
  258. package/src/__tests__/support/AbstractTestOnInstanceWithHooks.ts +138 -0
  259. package/src/__tests__/support/jest.setup.ts +2 -0
  260. package/src/__tests__/support/onTestFileResult.ts +1008 -0
  261. package/src/impl/AbstractModuleTest.ts +59 -10
  262. package/src/index.ts +4 -4
  263. package/src/utilities/AssertionError.ts +14 -0
  264. package/src/utilities/StackCleaner.ts +14 -0
  265. package/src/utilities/TestDecoratorResolver.ts +118 -0
  266. package/src/utilities/assert.ts +583 -0
  267. package/src/utilities/assert.utility.ts +295 -0
  268. package/src/utilities/decorators.ts +167 -0
  269. package/src/workspace/CommandService.ts +256 -0
  270. package/src/workspace/JestJsonParser.ts +255 -0
  271. package/src/workspace/TKButtonWidget.ts +54 -0
  272. package/src/workspace/TestLogItemGenerator.ts +184 -0
  273. package/src/workspace/TestReporter.ts +865 -0
  274. package/src/workspace/TestRunner.ts +128 -0
  275. package/src/workspace/TkBaseWidget.ts +249 -0
  276. package/src/workspace/TkInputWidget.ts +83 -0
  277. package/src/workspace/TkLayoutCellWidget.ts +46 -0
  278. package/src/workspace/TkLayoutWidget.ts +181 -0
  279. package/src/workspace/TkMenuBarWidget.ts +95 -0
  280. package/src/workspace/TkPopupWidget.ts +47 -0
  281. package/src/workspace/TkProgressBarWidget.ts +54 -0
  282. package/src/workspace/TkTextWidget.ts +158 -0
  283. package/src/workspace/TkWindowWidget.ts +122 -0
  284. package/src/workspace/WidgetFactory.ts +33 -0
  285. package/src/workspace/button.types.ts +19 -0
  286. package/src/workspace/duration.utility.ts +34 -0
  287. package/src/workspace/factory.types.ts +101 -0
  288. package/src/workspace/input.types.ts +22 -0
  289. package/src/workspace/keySelectChoices.ts +134 -0
  290. package/src/workspace/layout.types.ts +40 -0
  291. package/src/workspace/menuBar.types.ts +24 -0
  292. package/src/workspace/popup.types.ts +17 -0
  293. package/src/workspace/progressBar.types.ts +13 -0
  294. package/src/workspace/table.types.ts +9 -0
  295. package/src/workspace/termKit.utility.ts +130 -0
  296. package/src/workspace/terminal-kit.d.ts +28 -0
  297. package/src/workspace/test.types.ts +34 -0
  298. package/src/workspace/testRunner.cli.ts +159 -0
  299. package/src/workspace/text.types.ts +26 -0
  300. package/src/workspace/widget.utilities.ts +35 -0
  301. package/src/workspace/widgets.types.ts +102 -0
  302. package/src/workspace/window.types.ts +22 -0
  303. package/tsconfig.json +23 -27
  304. package/build/__tests__/AbstractPackageTest.d.ts +0 -4
  305. package/build/__tests__/AbstractPackageTest.js +0 -7
  306. package/build/__tests__/AbstractPackageTest.js.map +0 -1
  307. package/build/__tests__/functions/assertFunction.test.d.ts +0 -5
  308. package/build/__tests__/functions/assertFunction.test.js +0 -23
  309. package/build/__tests__/functions/assertFunction.test.js.map +0 -1
  310. package/build/__tests__/functions/testFunction.test.d.ts +0 -5
  311. package/build/__tests__/functions/testFunction.test.js +0 -23
  312. package/build/__tests__/functions/testFunction.test.js.map +0 -1
  313. package/build/__tests__/impl/AbstractModuleTest.test.js.map +0 -1
  314. package/build/functions/assert.d.ts +0 -3
  315. package/build/functions/assert.js +0 -4
  316. package/build/functions/assert.js.map +0 -1
  317. package/build/functions/test.d.ts +0 -3
  318. package/build/functions/test.js +0 -4
  319. package/build/functions/test.js.map +0 -1
  320. package/eslint.config.mjs +0 -3
  321. package/src/__tests__/AbstractPackageTest.ts +0 -7
  322. package/src/__tests__/functions/assertFunction.test.ts +0 -22
  323. package/src/__tests__/functions/testFunction.test.ts +0 -22
  324. package/src/__tests__/impl/AbstractModuleTest.test.ts +0 -34
  325. package/src/functions/assert.ts +0 -4
  326. package/src/functions/test.ts +0 -4
@@ -0,0 +1,227 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import AbstractModuleTest from '../../../impl/AbstractModuleTest.js';
8
+ import test from '../../../utilities/decorators.js';
9
+ import assert from '../../../utilities/assert.js';
10
+ import TestReporter from '../../../workspace/TestReporter.js';
11
+ export default class TestReporterTest extends AbstractModuleTest {
12
+ static async canInstantiateTestReporter() {
13
+ const reporter = this.TestReporter();
14
+ assert.isTruthy(reporter);
15
+ }
16
+ static async canInstantiateWithOptions() {
17
+ const reporter = this.TestReporter({
18
+ cwd: this.cwd,
19
+ watchMode: 'off',
20
+ status: 'ready',
21
+ isDebugging: false,
22
+ });
23
+ assert.isTruthy(reporter);
24
+ }
25
+ static async hasStartMethod() {
26
+ const reporter = this.TestReporter();
27
+ assert.isFunction(reporter.start);
28
+ }
29
+ static async hasDestroyMethod() {
30
+ const reporter = this.TestReporter();
31
+ assert.isFunction(reporter.destroy);
32
+ }
33
+ static async hasUpdateResultsMethod() {
34
+ const reporter = this.TestReporter();
35
+ assert.isFunction(reporter.updateResults);
36
+ }
37
+ static async hasSetStatusMethod() {
38
+ const reporter = this.TestReporter();
39
+ assert.isFunction(reporter.setStatus);
40
+ }
41
+ static async hasResetMethod() {
42
+ const reporter = this.TestReporter();
43
+ assert.isFunction(reporter.reset);
44
+ }
45
+ static async hasAppendErrorMethod() {
46
+ const reporter = this.TestReporter();
47
+ assert.isFunction(reporter.appendError);
48
+ }
49
+ static async throwsIfUpdateResultsCalledBeforeStart() {
50
+ const reporter = this.TestReporter();
51
+ assert.doesThrow(() => {
52
+ reporter.updateResults({ totalTestFiles: 0 });
53
+ });
54
+ }
55
+ static async doesNotDestroyOnUncaughtException() {
56
+ const reporter = this.TestReporter();
57
+ let destroyCalled = false;
58
+ let killHandler;
59
+ const fakeWidget = new Proxy({}, {
60
+ get: (_t, prop) => {
61
+ if (prop === 'getFrame') {
62
+ return () => ({
63
+ left: 0,
64
+ top: 0,
65
+ width: 100,
66
+ height: 50,
67
+ });
68
+ }
69
+ if (prop === 'getChildById') {
70
+ return () => null;
71
+ }
72
+ if (prop === 'getRows') {
73
+ return () => [{}];
74
+ }
75
+ if (prop === 'getFocusedWidget') {
76
+ return () => null;
77
+ }
78
+ if (prop === 'on') {
79
+ return (event, handler) => {
80
+ if (event === 'kill') {
81
+ killHandler = handler;
82
+ }
83
+ };
84
+ }
85
+ return () => fakeWidget;
86
+ },
87
+ });
88
+ reporter.widgets = { Widget: () => fakeWidget };
89
+ reporter.destroy = async () => {
90
+ destroyCalled = true;
91
+ };
92
+ await reporter.start();
93
+ assert.isTruthy(killHandler, 'kill handler must be registered');
94
+ killHandler({
95
+ code: new Error('terminal-kit mouse boundary crash'),
96
+ });
97
+ assert.isFalse(destroyCalled, 'uncaughtException must not destroy the UI');
98
+ killHandler({ code: 0 });
99
+ assert.isTrue(destroyCalled, 'real exit signal must still destroy the UI');
100
+ clearInterval(reporter.updateInterval);
101
+ }
102
+ static async grabsInputToResetMouseStateAfterCrash() {
103
+ const reporter = this.TestReporter();
104
+ let destroyCalled = false;
105
+ let grabInputCalled = false;
106
+ let killHandler;
107
+ const fakeTerm = {
108
+ grabInput: () => {
109
+ grabInputCalled = true;
110
+ },
111
+ };
112
+ const fakeWidget = new Proxy({}, {
113
+ get: (_t, prop) => {
114
+ if (prop === 'getFrame') {
115
+ return () => ({
116
+ left: 0,
117
+ top: 0,
118
+ width: 100,
119
+ height: 50,
120
+ });
121
+ }
122
+ if (prop === 'getChildById') {
123
+ return () => null;
124
+ }
125
+ if (prop === 'getRows') {
126
+ return () => [{}];
127
+ }
128
+ if (prop === 'getFocusedWidget') {
129
+ return () => null;
130
+ }
131
+ if (prop === 'term') {
132
+ return fakeTerm;
133
+ }
134
+ if (prop === 'on') {
135
+ return (event, handler) => {
136
+ if (event === 'kill') {
137
+ killHandler = handler;
138
+ }
139
+ };
140
+ }
141
+ return () => fakeWidget;
142
+ },
143
+ });
144
+ reporter.widgets = { Widget: () => fakeWidget };
145
+ reporter.destroy = async () => {
146
+ destroyCalled = true;
147
+ };
148
+ await reporter.start();
149
+ assert.isTruthy(killHandler, 'kill handler must be registered');
150
+ killHandler({
151
+ code: new Error('terminal-kit mouse boundary crash'),
152
+ });
153
+ assert.isFalse(destroyCalled, 'uncaughtException must not destroy the UI');
154
+ killHandler({ code: 0 });
155
+ assert.isTrue(destroyCalled, 'real exit signal must still destroy the UI');
156
+ assert.isTrue(grabInputCalled, 'grabInput must be called to reset mouse state after terminal crash');
157
+ clearInterval(reporter.updateInterval);
158
+ }
159
+ static async errorLogIsCreatedWithFocusableSetToFalse() {
160
+ const reporter = this.TestReporter();
161
+ let capturedTextOptions;
162
+ const fakeCell = { getFrame: () => ({ width: 100, height: 50 }) };
163
+ reporter.orientation = 'landscape';
164
+ reporter.bottomLayout = {
165
+ getRows: () => [{ id: 'row_1' }],
166
+ addColumn: () => { },
167
+ setColumnWidth: () => { },
168
+ updateLayout: () => { },
169
+ getChildById: (id) => {
170
+ return id === 'errors' ? fakeCell : null;
171
+ },
172
+ };
173
+ reporter.widgets = {
174
+ Widget: (type, options) => {
175
+ if (type === 'text') {
176
+ capturedTextOptions = options;
177
+ }
178
+ return {
179
+ on: () => { },
180
+ getFrame: () => ({ width: 100, height: 50 }),
181
+ };
182
+ },
183
+ };
184
+ reporter.dropInErrorLog();
185
+ assert.isFalse(capturedTextOptions?.focusable, 'errorLog must be created with focusable: false to prevent UI lockup on click');
186
+ }
187
+ static TestReporter(options) {
188
+ return new TestReporter(options);
189
+ }
190
+ }
191
+ __decorate([
192
+ test()
193
+ ], TestReporterTest, "canInstantiateTestReporter", null);
194
+ __decorate([
195
+ test()
196
+ ], TestReporterTest, "canInstantiateWithOptions", null);
197
+ __decorate([
198
+ test()
199
+ ], TestReporterTest, "hasStartMethod", null);
200
+ __decorate([
201
+ test()
202
+ ], TestReporterTest, "hasDestroyMethod", null);
203
+ __decorate([
204
+ test()
205
+ ], TestReporterTest, "hasUpdateResultsMethod", null);
206
+ __decorate([
207
+ test()
208
+ ], TestReporterTest, "hasSetStatusMethod", null);
209
+ __decorate([
210
+ test()
211
+ ], TestReporterTest, "hasResetMethod", null);
212
+ __decorate([
213
+ test()
214
+ ], TestReporterTest, "hasAppendErrorMethod", null);
215
+ __decorate([
216
+ test()
217
+ ], TestReporterTest, "throwsIfUpdateResultsCalledBeforeStart", null);
218
+ __decorate([
219
+ test()
220
+ ], TestReporterTest, "doesNotDestroyOnUncaughtException", null);
221
+ __decorate([
222
+ test()
223
+ ], TestReporterTest, "grabsInputToResetMouseStateAfterCrash", null);
224
+ __decorate([
225
+ test()
226
+ ], TestReporterTest, "errorLogIsCreatedWithFocusableSetToFalse", null);
227
+ //# sourceMappingURL=TestReporter.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestReporter.test.js","sourceRoot":"","sources":["../../../../src/__tests__/behavioral/workspace/TestReporter.test.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,MAAM,qCAAqC,CAAA;AACpE,OAAO,IAAI,MAAM,kCAAkC,CAAA;AACnD,OAAO,MAAM,MAAM,8BAA8B,CAAA;AACjD,OAAO,YAEN,MAAM,oCAAoC,CAAA;AAE3C,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAA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AO,GAAG;YACf,MAAM,EAAE,CAAC,IAAY,EAAE,OAAY,EAAE,EAAE;gBACnC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;oBAClB,mBAAmB,GAAG,OAAO,CAAA;gBACjC,CAAC;gBACD,OAAO;oBACH,EAAE,EAAE,GAAG,EAAE,GAAE,CAAC;oBACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;iBAC/C,CAAA;YACL,CAAC;SACJ,CAAA;QAED,QAAQ,CAAC,cAAc,EAAE,CAAA;QAEzB,MAAM,CAAC,OAAO,CACV,mBAAmB,EAAE,SAAS,EAC9B,8EAA8E,CACjF,CAAA;IACL,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,OAA6B;QACrD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAQ,CAAA;IAC3C,CAAC;CACJ;AAvP0B;IADtB,IAAI,EAAE;wDAIN;AAGsB;IADtB,IAAI,EAAE;uDASN;AAGsB;IADtB,IAAI,EAAE;4CAIN;AAGsB;IADtB,IAAI,EAAE;8CAIN;AAGsB;IADtB,IAAI,EAAE;oDAIN;AAGsB;IADtB,IAAI,EAAE;gDAIN;AAGsB;IADtB,IAAI,EAAE;4CAIN;AAGsB;IADtB,IAAI,EAAE;kDAIN;AAGsB;IADtB,IAAI,EAAE;oEAMN;AAGsB;IADtB,IAAI,EAAE;+DA+DN;AAGsB;IADtB,IAAI,EAAE;mEA8EN;AAGsB;IADtB,IAAI,EAAE;sEAqCN"}
@@ -0,0 +1,15 @@
1
+ import AbstractModuleTest from '../../../impl/AbstractModuleTest.js';
2
+ export default class TestRunnerTest extends AbstractModuleTest {
3
+ private static runner;
4
+ protected static beforeEach(): Promise<void>;
5
+ protected static canInstantiateTestRunner(): Promise<void>;
6
+ protected static hasHasFailedTestsMethod(): Promise<void>;
7
+ protected static hasHasSkippedTestsMethod(): Promise<void>;
8
+ protected static hasKillMethod(): Promise<void>;
9
+ protected static hasRunMethod(): Promise<void>;
10
+ protected static hasFailedTestsReturnsFalseByDefault(): Promise<void>;
11
+ protected static hasSkippedTestsReturnsFalseByDefault(): Promise<void>;
12
+ protected static emitsDidUpdateEvent(): Promise<void>;
13
+ protected static emitsDidErrorEvent(): Promise<void>;
14
+ protected static passesNodeNoWarningsToCommandService(): Promise<void>;
15
+ }
@@ -0,0 +1,99 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import AbstractModuleTest from '../../../impl/AbstractModuleTest.js';
8
+ import test from '../../../utilities/decorators.js';
9
+ import assert from '../../../utilities/assert.js';
10
+ import TestRunner from '../../../workspace/TestRunner.js';
11
+ import CommandServiceImpl from '../../../workspace/CommandService.js';
12
+ export default class TestRunnerTest extends AbstractModuleTest {
13
+ static runner;
14
+ static async beforeEach() {
15
+ await super.beforeEach();
16
+ const commandService = new CommandServiceImpl(this.cwd);
17
+ this.runner = new TestRunner({ cwd: this.cwd, commandService });
18
+ }
19
+ static async canInstantiateTestRunner() {
20
+ assert.isTruthy(this.runner);
21
+ }
22
+ static async hasHasFailedTestsMethod() {
23
+ assert.isFunction(this.runner.hasFailedTests);
24
+ }
25
+ static async hasHasSkippedTestsMethod() {
26
+ assert.isFunction(this.runner.hasSkippedTests);
27
+ }
28
+ static async hasKillMethod() {
29
+ assert.isFunction(this.runner.kill);
30
+ }
31
+ static async hasRunMethod() {
32
+ assert.isFunction(this.runner.run);
33
+ }
34
+ static async hasFailedTestsReturnsFalseByDefault() {
35
+ assert.isFalse(this.runner.hasFailedTests());
36
+ }
37
+ static async hasSkippedTestsReturnsFalseByDefault() {
38
+ assert.isFalse(this.runner.hasSkippedTests());
39
+ }
40
+ static async emitsDidUpdateEvent() {
41
+ let emitted = false;
42
+ this.runner.on('did-update', () => {
43
+ emitted = true;
44
+ });
45
+ assert.isFalse(emitted);
46
+ this.runner.emit('did-update', { results: { totalTestFiles: 0 } });
47
+ assert.isTrue(emitted);
48
+ }
49
+ static async emitsDidErrorEvent() {
50
+ let errorMessage = '';
51
+ this.runner.on('did-error', (payload) => {
52
+ errorMessage = payload.message;
53
+ });
54
+ this.runner.emit('did-error', { message: 'test error' });
55
+ assert.isEqual(errorMessage, 'test error');
56
+ }
57
+ static async passesNodeNoWarningsToCommandService() {
58
+ let capturedEnv;
59
+ const commandService = new CommandServiceImpl(this.cwd);
60
+ commandService.execute = async (_cmd, options) => {
61
+ capturedEnv = options?.env;
62
+ return { stdout: '' };
63
+ };
64
+ const runner = new TestRunner({ cwd: this.cwd, commandService });
65
+ await runner.run();
66
+ assert.isEqual(capturedEnv?.NODE_NO_WARNINGS, '1');
67
+ }
68
+ }
69
+ __decorate([
70
+ test()
71
+ ], TestRunnerTest, "canInstantiateTestRunner", null);
72
+ __decorate([
73
+ test()
74
+ ], TestRunnerTest, "hasHasFailedTestsMethod", null);
75
+ __decorate([
76
+ test()
77
+ ], TestRunnerTest, "hasHasSkippedTestsMethod", null);
78
+ __decorate([
79
+ test()
80
+ ], TestRunnerTest, "hasKillMethod", null);
81
+ __decorate([
82
+ test()
83
+ ], TestRunnerTest, "hasRunMethod", null);
84
+ __decorate([
85
+ test()
86
+ ], TestRunnerTest, "hasFailedTestsReturnsFalseByDefault", null);
87
+ __decorate([
88
+ test()
89
+ ], TestRunnerTest, "hasSkippedTestsReturnsFalseByDefault", null);
90
+ __decorate([
91
+ test()
92
+ ], TestRunnerTest, "emitsDidUpdateEvent", null);
93
+ __decorate([
94
+ test()
95
+ ], TestRunnerTest, "emitsDidErrorEvent", null);
96
+ __decorate([
97
+ test()
98
+ ], TestRunnerTest, "passesNodeNoWarningsToCommandService", null);
99
+ //# sourceMappingURL=TestRunner.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestRunner.test.js","sourceRoot":"","sources":["../../../../src/__tests__/behavioral/workspace/TestRunner.test.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,MAAM,qCAAqC,CAAA;AACpE,OAAO,IAAI,MAAM,kCAAkC,CAAA;AACnD,OAAO,MAAM,MAAM,8BAA8B,CAAA;AACjD,OAAO,UAAU,MAAM,kCAAkC,CAAA;AACzD,OAAO,kBAAkB,MAAM,sCAAsC,CAAA;AAErE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,kBAAkB;IAClD,MAAM,CAAC,MAAM,CAAY;IAEvB,MAAM,CAAC,KAAK,CAAC,UAAU;QAC7B,MAAM,KAAK,CAAC,UAAU,EAAE,CAAA;QACxB,MAAM,cAAc,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,CAAA;IACnE,CAAC;IAGsB,AAAb,MAAM,CAAC,KAAK,CAAC,wBAAwB;QAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IAGsB,AAAb,MAAM,CAAC,KAAK,CAAC,uBAAuB;QAC1C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IACjD,CAAC;IAGsB,AAAb,MAAM,CAAC,KAAK,CAAC,wBAAwB;QAC3C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;IAClD,CAAC;IAGsB,AAAb,MAAM,CAAC,KAAK,CAAC,aAAa;QAChC,MAAM,C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MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IAC9C,CAAC;IAGsB,AAAb,MAAM,CAAC,KAAK,CAAC,oCAAoC;QACvD,IAAI,WAA4C,CAAA;QAEhD,MAAM,cAAc,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvD,cAAc,CAAC,OAAO,GAAG,KAAK,EAAE,IAAY,EAAE,OAAa,EAAE,EAAE;YAC3D,WAAW,GAAG,OAAO,EAAE,GAAG,CAAA;YAC1B,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;QACzB,CAAC,CAAA;QAED,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,CAAA;QAChE,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;QAElB,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAA;IACtD,CAAC;CACJ;AAtE0B;IADtB,IAAI,EAAE;oDAGN;AAGsB;IADtB,IAAI,EAAE;mDAGN;AAGsB;IADtB,IAAI,EAAE;oDAGN;AAGsB;IADtB,IAAI,EAAE;yCAGN;AAGsB;IADtB,IAAI,EAAE;wCAGN;AAGsB;IADtB,IAAI,EAAE;+DAGN;AAGsB;IADtB,IAAI,EAAE;gEAGN;AAGsB;IADtB,IAAI,EAAE;+CASN;AAGsB;IADtB,IAAI,EAAE;8CAQN;AAGsB;IADtB,IAAI,EAAE;gEAcN"}
@@ -0,0 +1,13 @@
1
+ import AbstractModuleTest from '../../../impl/AbstractModuleTest.js';
2
+ export default class WidgetsTest extends AbstractModuleTest {
3
+ private static factory;
4
+ protected static beforeEach(): Promise<void>;
5
+ protected static canCreateFactory(): Promise<void>;
6
+ protected static canCreateTextWidget(): Promise<void>;
7
+ protected static setsStartingFrame(): Promise<void>;
8
+ protected static canCreateWindow(): void;
9
+ protected static canCreateProgressBar(): void;
10
+ protected static canCreateText(): void;
11
+ protected static canCreateLayout(): void;
12
+ private static buildText;
13
+ }
@@ -0,0 +1,99 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import AbstractModuleTest from '../../../impl/AbstractModuleTest.js';
8
+ import assert from '../../../utilities/assert.js';
9
+ import test from '../../../utilities/decorators.js';
10
+ import WidgetFactory from '../../../workspace/WidgetFactory.js';
11
+ export default class WidgetsTest extends AbstractModuleTest {
12
+ static factory;
13
+ static async beforeEach() {
14
+ await super.beforeEach();
15
+ this.factory = new WidgetFactory();
16
+ }
17
+ static async canCreateFactory() {
18
+ assert.isTruthy(this.factory);
19
+ }
20
+ static async canCreateTextWidget() {
21
+ const log = this.buildText();
22
+ assert.isTruthy(log);
23
+ }
24
+ static async setsStartingFrame() {
25
+ const text = this.buildText();
26
+ assert.isEqualDeep(text.getFrame(), {
27
+ left: 0,
28
+ top: 0,
29
+ width: 4,
30
+ height: 4,
31
+ });
32
+ }
33
+ static canCreateWindow() {
34
+ const window = this.factory.Widget('window', {});
35
+ assert.isTruthy(window);
36
+ }
37
+ static canCreateProgressBar() {
38
+ const progress = this.factory.Widget('progressBar', {
39
+ progress: 0,
40
+ });
41
+ assert.isTruthy(progress);
42
+ }
43
+ static canCreateText() {
44
+ const text = this.factory.Widget('text', {});
45
+ assert.isTruthy(text);
46
+ }
47
+ static canCreateLayout() {
48
+ const window = this.factory.Widget('window', {});
49
+ const layout = this.factory.Widget('layout', {
50
+ parent: window,
51
+ width: '100%',
52
+ rows: [
53
+ {
54
+ id: 'row_1',
55
+ height: '100%',
56
+ columns: [
57
+ {
58
+ id: 'column_1',
59
+ width: '100%',
60
+ },
61
+ ],
62
+ },
63
+ ],
64
+ });
65
+ assert.isTruthy(layout);
66
+ const column = layout.getChildById('results');
67
+ assert.isTruthy(column);
68
+ }
69
+ static buildText() {
70
+ return this.factory.Widget('text', {
71
+ left: 0,
72
+ top: 0,
73
+ width: 4,
74
+ height: 4,
75
+ });
76
+ }
77
+ }
78
+ __decorate([
79
+ test()
80
+ ], WidgetsTest, "canCreateFactory", null);
81
+ __decorate([
82
+ test()
83
+ ], WidgetsTest, "canCreateTextWidget", null);
84
+ __decorate([
85
+ test()
86
+ ], WidgetsTest, "setsStartingFrame", null);
87
+ __decorate([
88
+ test()
89
+ ], WidgetsTest, "canCreateWindow", null);
90
+ __decorate([
91
+ test()
92
+ ], WidgetsTest, "canCreateProgressBar", null);
93
+ __decorate([
94
+ test()
95
+ ], WidgetsTest, "canCreateText", null);
96
+ __decorate([
97
+ test.skip('enable when ready to fake termkit')
98
+ ], WidgetsTest, "canCreateLayout", null);
99
+ //# sourceMappingURL=Widgets.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Widgets.test.js","sourceRoot":"","sources":["../../../../src/__tests__/behavioral/workspace/Widgets.test.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,MAAM,qCAAqC,CAAA;AACpE,OAAO,MAAM,MAAM,8BAA8B,CAAA;AACjD,OAAO,IAAI,MAAM,kCAAkC,CAAA;AACnD,OAAO,aAAa,MAAM,qCAAqC,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,kBAAkB;IAC/C,MAAM,CAAC,OAAO,CAAe;IAE3B,MAAM,CAAC,KAAK,CAAC,UAAU;QAC7B,MAAM,KAAK,CAAC,UAAU,EAAE,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,EAAE,CAAA;IACtC,CAAC;IAGsB,AAA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AAQ,EAAE,EAAE,CAAC,CAAA;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;YACzC,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE;gBACF;oBACI,EAAE,EAAE,OAAO;oBACX,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE;wBACL;4BACI,EAAE,EAAE,UAAU;4BACd,KAAK,EAAE,MAAM;yBAChB;qBACJ;iBACJ;aACJ;SACJ,CAAC,CAAA;QACF,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAEvB,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QAE7C,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC3B,CAAC;IAEO,MAAM,CAAC,SAAS;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;YAC/B,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACZ,CAAC,CAAA;IACN,CAAC;CACJ;AA3E0B;IADtB,IAAI,EAAE;yCAGN;AAGsB;IADtB,IAAI,EAAE;4CAIN;AAGsB;IADtB,IAAI,EAAE;0CASN;AAGgB;IADhB,IAAI,EAAE;wCAIN;AAGgB;IADhB,IAAI,EAAE;6CAMN;AAGgB;IADhB,IAAI,EAAE;sCAIN;AAGgB;IADhB,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC;wCAwB9C"}
@@ -0,0 +1,79 @@
1
+ export declare class FakeElement {
2
+ outputX: number;
3
+ outputY: number;
4
+ outputWidth: number;
5
+ outputHeight: number;
6
+ constructorOptions: Record<string, any>;
7
+ private handlers;
8
+ constructor(options?: Record<string, any>);
9
+ on(event: string, cb: Function): void;
10
+ draw(): void;
11
+ destroy(): void;
12
+ resize(options: Record<string, any>): void;
13
+ }
14
+ export declare class TextBox extends FakeElement {
15
+ content: string;
16
+ scrollY: number;
17
+ scrollX: number;
18
+ textAreaHeight: number;
19
+ textBuffer: {
20
+ cy: number;
21
+ selectionRegion: any;
22
+ setSelectionRegion(_: any): void;
23
+ };
24
+ setContent(content: string): void;
25
+ setSizeAndPosition(opts: Record<string, any>): void;
26
+ scrollToBottom(): void;
27
+ }
28
+ export declare class Bar extends FakeElement {
29
+ setValue(_: number): void;
30
+ setContent(_: string): void;
31
+ }
32
+ export declare class Layout extends FakeElement {
33
+ computed: {
34
+ xmin: number;
35
+ ymin: number;
36
+ width: number;
37
+ height: number;
38
+ };
39
+ zChildren: any[];
40
+ updateLayout(): void;
41
+ addRow(_row: any): void;
42
+ setRowHeight(_idx: number, _h: any): void;
43
+ addColumn(_idx: number, _col: any): void;
44
+ setColumnWidth(_opts: any): void;
45
+ getRows(): never[];
46
+ off(_event: string, _cb: any): void;
47
+ onParentResize(): void;
48
+ }
49
+ export declare class Palette {
50
+ }
51
+ declare const terminalKit: {
52
+ terminal: {
53
+ createDocument: () => {
54
+ eventSource: {
55
+ on(_event: string, _cb: any): void;
56
+ };
57
+ __widget: any;
58
+ inputWidth: number;
59
+ inputHeight: number;
60
+ focusElement: {
61
+ __widget: null;
62
+ };
63
+ giveFocusTo: (_el: any) => void;
64
+ destroy: () => void;
65
+ };
66
+ grabInput: (_opts: any) => void;
67
+ on: (_event: string, _cb: any) => void;
68
+ hideCursor: (_v: boolean) => void;
69
+ windowTitle: (_t: string) => void;
70
+ styleReset: () => void;
71
+ clear: () => void;
72
+ removeAllListeners: () => void;
73
+ };
74
+ TextBox: typeof TextBox;
75
+ Bar: typeof Bar;
76
+ Layout: typeof Layout;
77
+ Palette: typeof Palette;
78
+ };
79
+ export default terminalKit;
@@ -0,0 +1,103 @@
1
+ export class FakeElement {
2
+ outputX;
3
+ outputY;
4
+ outputWidth;
5
+ outputHeight;
6
+ constructorOptions;
7
+ handlers = {};
8
+ constructor(options = {}) {
9
+ this.constructorOptions = options;
10
+ this.outputX = options.x ?? 0;
11
+ this.outputY = options.y ?? 0;
12
+ this.outputWidth = options.width ?? 0;
13
+ this.outputHeight = options.height ?? 0;
14
+ }
15
+ on(event, cb) {
16
+ if (!this.handlers[event]) {
17
+ this.handlers[event] = [];
18
+ }
19
+ this.handlers[event].push(cb);
20
+ }
21
+ draw() { }
22
+ destroy() { }
23
+ resize(options) {
24
+ if (options.x !== undefined) {
25
+ this.outputX = options.x;
26
+ }
27
+ if (options.y !== undefined) {
28
+ this.outputY = options.y;
29
+ }
30
+ if (options.width !== undefined) {
31
+ this.outputWidth = options.width;
32
+ }
33
+ if (options.height !== undefined) {
34
+ this.outputHeight = options.height;
35
+ }
36
+ }
37
+ }
38
+ export class TextBox extends FakeElement {
39
+ content = '';
40
+ scrollY = 0;
41
+ scrollX = 0;
42
+ textAreaHeight = 0;
43
+ textBuffer = {
44
+ cy: 0,
45
+ selectionRegion: null,
46
+ setSelectionRegion(_) { },
47
+ };
48
+ setContent(content) {
49
+ this.content = content;
50
+ }
51
+ setSizeAndPosition(opts) {
52
+ this.resize(opts);
53
+ }
54
+ scrollToBottom() { }
55
+ }
56
+ export class Bar extends FakeElement {
57
+ setValue(_) { }
58
+ setContent(_) { }
59
+ }
60
+ export class Layout extends FakeElement {
61
+ computed = { xmin: 0, ymin: 0, width: 80, height: 24 };
62
+ zChildren = [];
63
+ updateLayout() { }
64
+ addRow(_row) { }
65
+ setRowHeight(_idx, _h) { }
66
+ addColumn(_idx, _col) { }
67
+ setColumnWidth(_opts) { }
68
+ getRows() {
69
+ return [];
70
+ }
71
+ off(_event, _cb) { }
72
+ onParentResize() { }
73
+ }
74
+ export class Palette {
75
+ }
76
+ const fakeDocument = {
77
+ eventSource: { on(_event, _cb) { } },
78
+ __widget: null,
79
+ inputWidth: 120,
80
+ inputHeight: 40,
81
+ focusElement: { __widget: null },
82
+ giveFocusTo: (_el) => { },
83
+ destroy: () => { },
84
+ };
85
+ const fakeTerm = {
86
+ createDocument: () => fakeDocument,
87
+ grabInput: (_opts) => { },
88
+ on: (_event, _cb) => { },
89
+ hideCursor: (_v) => { },
90
+ windowTitle: (_t) => { },
91
+ styleReset: () => { },
92
+ clear: () => { },
93
+ removeAllListeners: () => { },
94
+ };
95
+ const terminalKit = {
96
+ terminal: fakeTerm,
97
+ TextBox,
98
+ Bar,
99
+ Layout,
100
+ Palette,
101
+ };
102
+ export default terminalKit;
103
+ //# sourceMappingURL=mock-terminal-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-terminal-kit.js","sourceRoot":"","sources":["../../src/__tests__/mock-terminal-kit.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IACb,OAAO,CAAQ;IACf,OAAO,CAAQ;IACf,WAAW,CAAQ;IACnB,YAAY,CAAQ;IACpB,kBAAkB,CAAqB;IACtC,QAAQ,GAA+B,EAAE,CAAA;IAEjD,YAAmB,UAA+B,EAAE;QAChD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA;QACrC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAA;IAC3C,CAAC;IAEM,EAAE,CAAC,KAAa,EAAE,EAAY;QACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;QAC7B,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC;IAEM,IAAI,KAAI,CAAC;IACT,OAAO,KAAI,CAAC;IACZ,MAAM,CAA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