movehat 0.1.9 → 0.2.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 (445) hide show
  1. package/README.md +2 -2
  2. package/dist/__tests__/deployContract.test.d.ts +2 -0
  3. package/dist/__tests__/deployContract.test.d.ts.map +1 -0
  4. package/dist/__tests__/deployContract.test.js +368 -0
  5. package/dist/__tests__/deployContract.test.js.map +1 -0
  6. package/dist/__tests__/errors.test.d.ts +2 -0
  7. package/dist/__tests__/errors.test.d.ts.map +1 -0
  8. package/dist/__tests__/errors.test.js +46 -0
  9. package/dist/__tests__/errors.test.js.map +1 -0
  10. package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +24 -0
  11. package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +1 -0
  12. package/dist/__tests__/fixtures/sigint-deploy-harness.js +82 -0
  13. package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +1 -0
  14. package/dist/__tests__/fork/api.test.d.ts +2 -0
  15. package/dist/__tests__/fork/api.test.d.ts.map +1 -0
  16. package/dist/__tests__/fork/api.test.js +110 -0
  17. package/dist/__tests__/fork/api.test.js.map +1 -0
  18. package/dist/__tests__/harness/Harness.createLive.test.d.ts +2 -0
  19. package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +1 -0
  20. package/dist/__tests__/harness/Harness.createLive.test.js +53 -0
  21. package/dist/__tests__/harness/Harness.createLive.test.js.map +1 -0
  22. package/dist/__tests__/harness/Harness.proxy.test.d.ts +2 -0
  23. package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +1 -0
  24. package/dist/__tests__/harness/Harness.proxy.test.js +93 -0
  25. package/dist/__tests__/harness/Harness.proxy.test.js.map +1 -0
  26. package/dist/__tests__/harness/_fixture.d.ts +54 -0
  27. package/dist/__tests__/harness/_fixture.d.ts.map +1 -0
  28. package/dist/__tests__/harness/_fixture.js +69 -0
  29. package/dist/__tests__/harness/_fixture.js.map +1 -0
  30. package/dist/__tests__/harness/codeObject.deploy.test.d.ts +2 -0
  31. package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +1 -0
  32. package/dist/__tests__/harness/codeObject.deploy.test.js +288 -0
  33. package/dist/__tests__/harness/codeObject.deploy.test.js.map +1 -0
  34. package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +2 -0
  35. package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +1 -0
  36. package/dist/__tests__/harness/codeObject.upgrade.test.js +138 -0
  37. package/dist/__tests__/harness/codeObject.upgrade.test.js.map +1 -0
  38. package/dist/__tests__/harness/script.test.d.ts +2 -0
  39. package/dist/__tests__/harness/script.test.d.ts.map +1 -0
  40. package/dist/__tests__/harness/script.test.js +219 -0
  41. package/dist/__tests__/harness/script.test.js.map +1 -0
  42. package/dist/__tests__/harness/view.test.d.ts +2 -0
  43. package/dist/__tests__/harness/view.test.d.ts.map +1 -0
  44. package/dist/__tests__/harness/view.test.js +92 -0
  45. package/dist/__tests__/harness/view.test.js.map +1 -0
  46. package/dist/__tests__/runtime.test.d.ts +2 -0
  47. package/dist/__tests__/runtime.test.d.ts.map +1 -0
  48. package/dist/__tests__/runtime.test.js +141 -0
  49. package/dist/__tests__/runtime.test.js.map +1 -0
  50. package/dist/cli.js +2 -1
  51. package/dist/cli.js.map +1 -1
  52. package/dist/commands/__tests__/compile.test.d.ts +2 -0
  53. package/dist/commands/__tests__/compile.test.d.ts.map +1 -0
  54. package/dist/commands/__tests__/compile.test.js +351 -0
  55. package/dist/commands/__tests__/compile.test.js.map +1 -0
  56. package/dist/commands/__tests__/init.test.d.ts +2 -0
  57. package/dist/commands/__tests__/init.test.d.ts.map +1 -0
  58. package/dist/commands/__tests__/init.test.js +101 -0
  59. package/dist/commands/__tests__/init.test.js.map +1 -0
  60. package/dist/commands/__tests__/run.test.d.ts +2 -0
  61. package/dist/commands/__tests__/run.test.d.ts.map +1 -0
  62. package/dist/commands/__tests__/run.test.js +166 -0
  63. package/dist/commands/__tests__/run.test.js.map +1 -0
  64. package/dist/commands/__tests__/test-move.test.d.ts +2 -0
  65. package/dist/commands/__tests__/test-move.test.d.ts.map +1 -0
  66. package/dist/commands/__tests__/test-move.test.js +59 -0
  67. package/dist/commands/__tests__/test-move.test.js.map +1 -0
  68. package/dist/commands/__tests__/test.test.d.ts +2 -0
  69. package/dist/commands/__tests__/test.test.d.ts.map +1 -0
  70. package/dist/commands/__tests__/test.test.js +168 -0
  71. package/dist/commands/__tests__/test.test.js.map +1 -0
  72. package/dist/commands/__tests__/update.test.d.ts +2 -0
  73. package/dist/commands/__tests__/update.test.d.ts.map +1 -0
  74. package/dist/commands/__tests__/update.test.js +176 -0
  75. package/dist/commands/__tests__/update.test.js.map +1 -0
  76. package/dist/commands/compile.d.ts +7 -1
  77. package/dist/commands/compile.d.ts.map +1 -1
  78. package/dist/commands/compile.js +150 -33
  79. package/dist/commands/compile.js.map +1 -1
  80. package/dist/commands/fork/__tests__/create.test.d.ts +2 -0
  81. package/dist/commands/fork/__tests__/create.test.d.ts.map +1 -0
  82. package/dist/commands/fork/__tests__/create.test.js +108 -0
  83. package/dist/commands/fork/__tests__/create.test.js.map +1 -0
  84. package/dist/commands/fork/__tests__/fund.test.d.ts +2 -0
  85. package/dist/commands/fork/__tests__/fund.test.d.ts.map +1 -0
  86. package/dist/commands/fork/__tests__/fund.test.js +72 -0
  87. package/dist/commands/fork/__tests__/fund.test.js.map +1 -0
  88. package/dist/commands/fork/__tests__/list.test.d.ts +2 -0
  89. package/dist/commands/fork/__tests__/list.test.d.ts.map +1 -0
  90. package/dist/commands/fork/__tests__/list.test.js +119 -0
  91. package/dist/commands/fork/__tests__/list.test.js.map +1 -0
  92. package/dist/commands/fork/__tests__/serve.test.d.ts +2 -0
  93. package/dist/commands/fork/__tests__/serve.test.d.ts.map +1 -0
  94. package/dist/commands/fork/__tests__/serve.test.js +97 -0
  95. package/dist/commands/fork/__tests__/serve.test.js.map +1 -0
  96. package/dist/commands/fork/__tests__/view-resource.test.d.ts +2 -0
  97. package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +1 -0
  98. package/dist/commands/fork/__tests__/view-resource.test.js +77 -0
  99. package/dist/commands/fork/__tests__/view-resource.test.js.map +1 -0
  100. package/dist/commands/fork/create.d.ts +1 -1
  101. package/dist/commands/fork/create.d.ts.map +1 -1
  102. package/dist/commands/fork/create.js +3 -2
  103. package/dist/commands/fork/create.js.map +1 -1
  104. package/dist/commands/fork/fund.d.ts.map +1 -1
  105. package/dist/commands/fork/fund.js +15 -8
  106. package/dist/commands/fork/fund.js.map +1 -1
  107. package/dist/commands/fork/list.d.ts.map +1 -1
  108. package/dist/commands/fork/list.js +2 -1
  109. package/dist/commands/fork/list.js.map +1 -1
  110. package/dist/commands/fork/serve.d.ts +1 -0
  111. package/dist/commands/fork/serve.d.ts.map +1 -1
  112. package/dist/commands/fork/serve.js +4 -2
  113. package/dist/commands/fork/serve.js.map +1 -1
  114. package/dist/commands/fork/view-resource.d.ts.map +1 -1
  115. package/dist/commands/fork/view-resource.js +10 -5
  116. package/dist/commands/fork/view-resource.js.map +1 -1
  117. package/dist/commands/run.d.ts +15 -0
  118. package/dist/commands/run.d.ts.map +1 -1
  119. package/dist/commands/run.js +50 -27
  120. package/dist/commands/run.js.map +1 -1
  121. package/dist/commands/test-move.d.ts.map +1 -1
  122. package/dist/commands/test-move.js +3 -2
  123. package/dist/commands/test-move.js.map +1 -1
  124. package/dist/commands/test.js +52 -46
  125. package/dist/commands/test.js.map +1 -1
  126. package/dist/commands/update.d.ts.map +1 -1
  127. package/dist/commands/update.js +15 -13
  128. package/dist/commands/update.js.map +1 -1
  129. package/dist/core/AccountManager.d.ts +1 -1
  130. package/dist/core/AccountManager.d.ts.map +1 -1
  131. package/dist/core/AccountManager.js +20 -7
  132. package/dist/core/AccountManager.js.map +1 -1
  133. package/dist/core/Publisher.d.ts +31 -0
  134. package/dist/core/Publisher.d.ts.map +1 -0
  135. package/dist/core/Publisher.js +248 -0
  136. package/dist/core/Publisher.js.map +1 -0
  137. package/dist/core/__tests__/AccountManager.test.d.ts +2 -0
  138. package/dist/core/__tests__/AccountManager.test.d.ts.map +1 -0
  139. package/dist/core/__tests__/AccountManager.test.js +239 -0
  140. package/dist/core/__tests__/AccountManager.test.js.map +1 -0
  141. package/dist/core/__tests__/config.test.d.ts +2 -0
  142. package/dist/core/__tests__/config.test.d.ts.map +1 -0
  143. package/dist/core/__tests__/config.test.js +311 -0
  144. package/dist/core/__tests__/config.test.js.map +1 -0
  145. package/dist/core/__tests__/deployments.test.d.ts +2 -0
  146. package/dist/core/__tests__/deployments.test.d.ts.map +1 -0
  147. package/dist/core/__tests__/deployments.test.js +201 -0
  148. package/dist/core/__tests__/deployments.test.js.map +1 -0
  149. package/dist/core/__tests__/shell.test.d.ts +2 -0
  150. package/dist/core/__tests__/shell.test.d.ts.map +1 -0
  151. package/dist/core/__tests__/shell.test.js +107 -0
  152. package/dist/core/__tests__/shell.test.js.map +1 -0
  153. package/dist/core/config.d.ts +13 -1
  154. package/dist/core/config.d.ts.map +1 -1
  155. package/dist/core/config.js +80 -11
  156. package/dist/core/config.js.map +1 -1
  157. package/dist/core/contract.d.ts +1 -1
  158. package/dist/core/contract.d.ts.map +1 -1
  159. package/dist/core/contract.js +15 -4
  160. package/dist/core/contract.js.map +1 -1
  161. package/dist/core/deployments.d.ts +2 -2
  162. package/dist/core/deployments.d.ts.map +1 -1
  163. package/dist/core/deployments.js +8 -6
  164. package/dist/core/deployments.js.map +1 -1
  165. package/dist/core/movementProfile.d.ts +34 -0
  166. package/dist/core/movementProfile.d.ts.map +1 -0
  167. package/dist/core/movementProfile.js +150 -0
  168. package/dist/core/movementProfile.js.map +1 -0
  169. package/dist/core/shell.d.ts +23 -7
  170. package/dist/core/shell.d.ts.map +1 -1
  171. package/dist/core/shell.js +32 -14
  172. package/dist/core/shell.js.map +1 -1
  173. package/dist/errors.d.ts +35 -0
  174. package/dist/errors.d.ts.map +1 -1
  175. package/dist/errors.js +54 -0
  176. package/dist/errors.js.map +1 -1
  177. package/dist/fork/__tests__/manager.test.d.ts +2 -0
  178. package/dist/fork/__tests__/manager.test.d.ts.map +1 -0
  179. package/dist/fork/__tests__/manager.test.js +309 -0
  180. package/dist/fork/__tests__/manager.test.js.map +1 -0
  181. package/dist/fork/__tests__/server.test.d.ts +2 -0
  182. package/dist/fork/__tests__/server.test.d.ts.map +1 -0
  183. package/dist/fork/__tests__/server.test.js +54 -0
  184. package/dist/fork/__tests__/server.test.js.map +1 -0
  185. package/dist/fork/__tests__/storage.test.d.ts +2 -0
  186. package/dist/fork/__tests__/storage.test.d.ts.map +1 -0
  187. package/dist/fork/__tests__/storage.test.js +222 -0
  188. package/dist/fork/__tests__/storage.test.js.map +1 -0
  189. package/dist/fork/__tests__/test.test.d.ts +2 -0
  190. package/dist/fork/__tests__/test.test.d.ts.map +1 -0
  191. package/dist/fork/__tests__/test.test.js +81 -0
  192. package/dist/fork/__tests__/test.test.js.map +1 -0
  193. package/dist/fork/api.d.ts +14 -3
  194. package/dist/fork/api.d.ts.map +1 -1
  195. package/dist/fork/api.js +25 -14
  196. package/dist/fork/api.js.map +1 -1
  197. package/dist/fork/manager.d.ts +23 -9
  198. package/dist/fork/manager.d.ts.map +1 -1
  199. package/dist/fork/manager.js +79 -36
  200. package/dist/fork/manager.js.map +1 -1
  201. package/dist/fork/server.d.ts +11 -3
  202. package/dist/fork/server.d.ts.map +1 -1
  203. package/dist/fork/server.js +45 -13
  204. package/dist/fork/server.js.map +1 -1
  205. package/dist/fork/storage.d.ts +4 -4
  206. package/dist/fork/storage.d.ts.map +1 -1
  207. package/dist/fork/storage.js +7 -9
  208. package/dist/fork/storage.js.map +1 -1
  209. package/dist/fork/test.d.ts +13 -4
  210. package/dist/fork/test.d.ts.map +1 -1
  211. package/dist/fork/test.js +36 -27
  212. package/dist/fork/test.js.map +1 -1
  213. package/dist/harness/Harness.d.ts +124 -0
  214. package/dist/harness/Harness.d.ts.map +1 -0
  215. package/dist/harness/Harness.js +193 -0
  216. package/dist/harness/Harness.js.map +1 -0
  217. package/dist/harness/codeObject.d.ts +31 -0
  218. package/dist/harness/codeObject.d.ts.map +1 -0
  219. package/dist/harness/codeObject.js +271 -0
  220. package/dist/harness/codeObject.js.map +1 -0
  221. package/dist/harness/errors.d.ts +14 -0
  222. package/dist/harness/errors.d.ts.map +1 -0
  223. package/dist/harness/errors.js +22 -0
  224. package/dist/harness/errors.js.map +1 -0
  225. package/dist/harness/index.d.ts +4 -0
  226. package/dist/harness/index.d.ts.map +1 -0
  227. package/dist/harness/index.js +3 -0
  228. package/dist/harness/index.js.map +1 -0
  229. package/dist/harness/proxy.d.ts +7 -0
  230. package/dist/harness/proxy.d.ts.map +1 -0
  231. package/dist/harness/proxy.js +36 -0
  232. package/dist/harness/proxy.js.map +1 -0
  233. package/dist/harness/script.d.ts +21 -0
  234. package/dist/harness/script.d.ts.map +1 -0
  235. package/dist/harness/script.js +155 -0
  236. package/dist/harness/script.js.map +1 -0
  237. package/dist/harness/view.d.ts +22 -0
  238. package/dist/harness/view.d.ts.map +1 -0
  239. package/dist/harness/view.js +28 -0
  240. package/dist/harness/view.js.map +1 -0
  241. package/dist/helpers/__tests__/semver-utils.test.d.ts +2 -0
  242. package/dist/helpers/__tests__/semver-utils.test.d.ts.map +1 -0
  243. package/dist/helpers/__tests__/semver-utils.test.js +103 -0
  244. package/dist/helpers/__tests__/semver-utils.test.js.map +1 -0
  245. package/dist/helpers/index.d.ts +3 -2
  246. package/dist/helpers/index.d.ts.map +1 -1
  247. package/dist/helpers/index.js +2 -2
  248. package/dist/helpers/index.js.map +1 -1
  249. package/dist/helpers/move-tests.d.ts +3 -3
  250. package/dist/helpers/move-tests.d.ts.map +1 -1
  251. package/dist/helpers/move-tests.js +21 -20
  252. package/dist/helpers/move-tests.js.map +1 -1
  253. package/dist/helpers/npm-registry.d.ts.map +1 -1
  254. package/dist/helpers/npm-registry.js +1 -3
  255. package/dist/helpers/npm-registry.js.map +1 -1
  256. package/dist/helpers/semver-utils.d.ts.map +1 -1
  257. package/dist/helpers/semver-utils.js +4 -3
  258. package/dist/helpers/semver-utils.js.map +1 -1
  259. package/dist/helpers/setup.d.ts.map +1 -1
  260. package/dist/helpers/setup.js +6 -4
  261. package/dist/helpers/setup.js.map +1 -1
  262. package/dist/helpers/setupLocalTesting.d.ts +32 -27
  263. package/dist/helpers/setupLocalTesting.d.ts.map +1 -1
  264. package/dist/helpers/setupLocalTesting.js +179 -180
  265. package/dist/helpers/setupLocalTesting.js.map +1 -1
  266. package/dist/helpers/testFixtures.d.ts +19 -53
  267. package/dist/helpers/testFixtures.d.ts.map +1 -1
  268. package/dist/helpers/testFixtures.js +89 -107
  269. package/dist/helpers/testFixtures.js.map +1 -1
  270. package/dist/index.d.ts +4 -2
  271. package/dist/index.d.ts.map +1 -1
  272. package/dist/index.js +7 -3
  273. package/dist/index.js.map +1 -1
  274. package/dist/node/LocalNodeManager.d.ts +9 -1
  275. package/dist/node/LocalNodeManager.d.ts.map +1 -1
  276. package/dist/node/LocalNodeManager.js +75 -58
  277. package/dist/node/LocalNodeManager.js.map +1 -1
  278. package/dist/node/__tests__/LocalNodeManager.test.d.ts +2 -0
  279. package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +1 -0
  280. package/dist/node/__tests__/LocalNodeManager.test.js +349 -0
  281. package/dist/node/__tests__/LocalNodeManager.test.js.map +1 -0
  282. package/dist/runtime.d.ts +12 -15
  283. package/dist/runtime.d.ts.map +1 -1
  284. package/dist/runtime.js +28 -239
  285. package/dist/runtime.js.map +1 -1
  286. package/dist/templates/README.md +1 -1
  287. package/dist/templates/movehat.config.ts +10 -0
  288. package/dist/templates/package.json +2 -1
  289. package/dist/templates/scripts/deploy-counter.ts +46 -38
  290. package/dist/templates/tests/Counter.test.ts +39 -51
  291. package/dist/templates/types/movehat.d.ts +6 -9
  292. package/dist/types/config.d.ts +8 -0
  293. package/dist/types/config.d.ts.map +1 -1
  294. package/dist/types/fork.d.ts +7 -1
  295. package/dist/types/fork.d.ts.map +1 -1
  296. package/dist/types/harness.d.ts +166 -0
  297. package/dist/types/harness.d.ts.map +1 -0
  298. package/dist/types/harness.js +2 -0
  299. package/dist/types/harness.js.map +1 -0
  300. package/dist/types/runtime.d.ts +7 -1
  301. package/dist/types/runtime.d.ts.map +1 -1
  302. package/dist/ui/__tests__/colors.test.d.ts +2 -0
  303. package/dist/ui/__tests__/colors.test.d.ts.map +1 -0
  304. package/dist/ui/__tests__/colors.test.js +127 -0
  305. package/dist/ui/__tests__/colors.test.js.map +1 -0
  306. package/dist/ui/colors.d.ts.map +1 -1
  307. package/dist/ui/colors.js +6 -2
  308. package/dist/ui/colors.js.map +1 -1
  309. package/dist/ui/logger.d.ts +17 -0
  310. package/dist/ui/logger.d.ts.map +1 -1
  311. package/dist/ui/logger.js +22 -0
  312. package/dist/ui/logger.js.map +1 -1
  313. package/dist/ui/symbols.d.ts +1 -0
  314. package/dist/ui/symbols.d.ts.map +1 -1
  315. package/dist/ui/symbols.js +7 -1
  316. package/dist/ui/symbols.js.map +1 -1
  317. package/dist/utils/__tests__/address.test.d.ts +2 -0
  318. package/dist/utils/__tests__/address.test.d.ts.map +1 -0
  319. package/dist/utils/__tests__/address.test.js +70 -0
  320. package/dist/utils/__tests__/address.test.js.map +1 -0
  321. package/dist/utils/__tests__/childProcessAdapter.test.d.ts +2 -0
  322. package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +1 -0
  323. package/dist/utils/__tests__/childProcessAdapter.test.js +217 -0
  324. package/dist/utils/__tests__/childProcessAdapter.test.js.map +1 -0
  325. package/dist/utils/__tests__/runCli.test.d.ts +2 -0
  326. package/dist/utils/__tests__/runCli.test.d.ts.map +1 -0
  327. package/dist/utils/__tests__/runCli.test.js +187 -0
  328. package/dist/utils/__tests__/runCli.test.js.map +1 -0
  329. package/dist/utils/address.d.ts +33 -0
  330. package/dist/utils/address.d.ts.map +1 -0
  331. package/dist/utils/address.js +52 -0
  332. package/dist/utils/address.js.map +1 -0
  333. package/dist/utils/childProcessAdapter.d.ts +93 -0
  334. package/dist/utils/childProcessAdapter.d.ts.map +1 -0
  335. package/dist/utils/childProcessAdapter.js +109 -0
  336. package/dist/utils/childProcessAdapter.js.map +1 -0
  337. package/dist/utils/parseCliOutput.d.ts +20 -0
  338. package/dist/utils/parseCliOutput.d.ts.map +1 -0
  339. package/dist/utils/parseCliOutput.js +26 -0
  340. package/dist/utils/parseCliOutput.js.map +1 -0
  341. package/dist/utils/redact.d.ts +15 -0
  342. package/dist/utils/redact.d.ts.map +1 -0
  343. package/dist/utils/redact.js +24 -0
  344. package/dist/utils/redact.js.map +1 -0
  345. package/dist/utils/runCli.d.ts +24 -0
  346. package/dist/utils/runCli.d.ts.map +1 -0
  347. package/dist/utils/runCli.js +37 -0
  348. package/dist/utils/runCli.js.map +1 -0
  349. package/package.json +14 -4
  350. package/src/__tests__/deployContract.test.ts +429 -0
  351. package/src/__tests__/errors.test.ts +84 -0
  352. package/src/__tests__/fixtures/sigint-deploy-harness.ts +95 -0
  353. package/src/__tests__/fork/api.test.ts +143 -0
  354. package/src/__tests__/harness/Harness.createLive.test.ts +57 -0
  355. package/src/__tests__/harness/Harness.proxy.test.ts +115 -0
  356. package/src/__tests__/harness/_fixture.ts +131 -0
  357. package/src/__tests__/harness/codeObject.deploy.test.ts +319 -0
  358. package/src/__tests__/harness/codeObject.upgrade.test.ts +156 -0
  359. package/src/__tests__/harness/script.test.ts +245 -0
  360. package/src/__tests__/harness/view.test.ts +104 -0
  361. package/src/__tests__/runtime.test.ts +182 -0
  362. package/src/cli.ts +2 -1
  363. package/src/commands/__tests__/compile.test.ts +407 -0
  364. package/src/commands/__tests__/init.test.ts +125 -0
  365. package/src/commands/__tests__/run.test.ts +192 -0
  366. package/src/commands/__tests__/test-move.test.ts +81 -0
  367. package/src/commands/__tests__/test.test.ts +204 -0
  368. package/src/commands/__tests__/update.test.ts +223 -0
  369. package/src/commands/compile.ts +168 -32
  370. package/src/commands/fork/__tests__/create.test.ts +132 -0
  371. package/src/commands/fork/__tests__/fund.test.ts +104 -0
  372. package/src/commands/fork/__tests__/list.test.ts +139 -0
  373. package/src/commands/fork/__tests__/serve.test.ts +121 -0
  374. package/src/commands/fork/__tests__/view-resource.test.ts +101 -0
  375. package/src/commands/fork/create.ts +4 -3
  376. package/src/commands/fork/fund.ts +16 -9
  377. package/src/commands/fork/list.ts +3 -2
  378. package/src/commands/fork/serve.ts +6 -3
  379. package/src/commands/fork/view-resource.ts +11 -6
  380. package/src/commands/run.ts +54 -28
  381. package/src/commands/test-move.ts +4 -3
  382. package/src/commands/test.ts +56 -44
  383. package/src/commands/update.ts +19 -16
  384. package/src/core/AccountManager.ts +23 -10
  385. package/src/core/Publisher.ts +322 -0
  386. package/src/core/__tests__/AccountManager.test.ts +290 -0
  387. package/src/core/__tests__/config.test.ts +377 -0
  388. package/src/core/__tests__/deployments.test.ts +247 -0
  389. package/src/core/__tests__/shell.test.ts +138 -0
  390. package/src/core/config.ts +96 -12
  391. package/src/core/contract.ts +13 -4
  392. package/src/core/deployments.ts +13 -11
  393. package/src/core/movementProfile.ts +179 -0
  394. package/src/core/shell.ts +34 -14
  395. package/src/errors.ts +60 -0
  396. package/src/fork/__tests__/manager.test.ts +385 -0
  397. package/src/fork/__tests__/server.test.ts +65 -0
  398. package/src/fork/__tests__/storage.test.ts +281 -0
  399. package/src/fork/__tests__/test.test.ts +97 -0
  400. package/src/fork/api.ts +28 -14
  401. package/src/fork/manager.ts +88 -43
  402. package/src/fork/server.ts +53 -19
  403. package/src/fork/storage.ts +12 -15
  404. package/src/fork/test.ts +58 -32
  405. package/src/harness/Harness.ts +228 -0
  406. package/src/harness/codeObject.ts +388 -0
  407. package/src/harness/errors.ts +22 -0
  408. package/src/harness/index.ts +3 -0
  409. package/src/harness/proxy.ts +40 -0
  410. package/src/harness/script.ts +196 -0
  411. package/src/harness/view.ts +34 -0
  412. package/src/helpers/__tests__/semver-utils.test.ts +121 -0
  413. package/src/helpers/index.ts +2 -8
  414. package/src/helpers/move-tests.ts +27 -23
  415. package/src/helpers/npm-registry.ts +4 -3
  416. package/src/helpers/semver-utils.ts +4 -3
  417. package/src/helpers/setup.ts +6 -4
  418. package/src/helpers/setupLocalTesting.ts +219 -200
  419. package/src/helpers/testFixtures.ts +106 -118
  420. package/src/index.ts +9 -3
  421. package/src/node/LocalNodeManager.ts +87 -62
  422. package/src/node/__tests__/LocalNodeManager.test.ts +452 -0
  423. package/src/runtime.ts +30 -288
  424. package/src/templates/README.md +1 -1
  425. package/src/templates/movehat.config.ts +10 -0
  426. package/src/templates/package.json +2 -1
  427. package/src/templates/scripts/deploy-counter.ts +46 -38
  428. package/src/templates/tests/Counter.test.ts +39 -51
  429. package/src/templates/types/movehat.d.ts +6 -9
  430. package/src/types/config.ts +8 -0
  431. package/src/types/fork.ts +7 -1
  432. package/src/types/harness.ts +182 -0
  433. package/src/types/runtime.ts +11 -3
  434. package/src/ui/__tests__/colors.test.ts +156 -0
  435. package/src/ui/colors.ts +5 -2
  436. package/src/ui/logger.ts +22 -0
  437. package/src/ui/symbols.ts +7 -1
  438. package/src/utils/__tests__/address.test.ts +93 -0
  439. package/src/utils/__tests__/childProcessAdapter.test.ts +266 -0
  440. package/src/utils/__tests__/runCli.test.ts +240 -0
  441. package/src/utils/address.ts +56 -0
  442. package/src/utils/childProcessAdapter.ts +215 -0
  443. package/src/utils/parseCliOutput.ts +27 -0
  444. package/src/utils/redact.ts +24 -0
  445. package/src/utils/runCli.ts +64 -0
@@ -2,7 +2,8 @@ import type { Account } from "@aptos-labs/ts-sdk";
2
2
  import type { MovehatRuntime } from "../types/runtime.js";
3
3
  import type { MoveContract } from "../core/contract.js";
4
4
  import { AccountManager } from "../core/AccountManager.js";
5
- import { setupLocalTesting, stopLocalTesting } from "./setupLocalTesting.js";
5
+ import { setupLocalTesting } from "./setupLocalTesting.js";
6
+ import { logger } from "../ui/index.js";
6
7
  import type { LocalTestOptions } from "../types/config.js";
7
8
 
8
9
  /**
@@ -24,6 +25,16 @@ export interface TestFixture<TModules extends string = string> {
24
25
 
25
26
  /** Deployed contracts by module name - type-safe based on modules parameter */
26
27
  contracts: Record<TModules, MoveContract>;
28
+
29
+ /**
30
+ * Stop the local node / fork server this fixture started.
31
+ *
32
+ * Does **not** clear the shared `AccountManager` pool — clearing it
33
+ * would break parallel `setupTestFixture` invocations that share the
34
+ * pool. The pool grows for the lifetime of the process; the process
35
+ * exit reclaims it.
36
+ */
37
+ teardown: () => Promise<void>;
27
38
  }
28
39
 
29
40
  /**
@@ -38,43 +49,30 @@ export interface TestFixture<TModules extends string = string> {
38
49
  * @param modules Array of module names to auto-deploy
39
50
  * @param accountLabels Optional array of account labels (defaults to ['alice', 'bob'])
40
51
  * @param options Optional LocalTestOptions for advanced configuration
41
- * @returns TestFixture with runtime, accounts, and contracts
52
+ * @returns TestFixture with runtime, accounts, contracts, and a teardown closure
42
53
  *
43
54
  * @example
44
55
  * ```typescript
45
- * import { setupTestFixture } from "movehat/helpers";
56
+ * import { setupTestFixture, type TestFixture } from "movehat/helpers";
46
57
  *
47
58
  * describe("Counter Contract", () => {
48
- * let fixture: TestFixture;
59
+ * let fixture: TestFixture<"counter">;
49
60
  *
50
61
  * before(async function () {
51
- * this.timeout(60000); // Allow time for fork + deployment
52
- *
53
- * fixture = await setupTestFixture(['counter'], ['alice', 'bob']);
62
+ * this.timeout(60000);
63
+ * fixture = await setupTestFixture(['counter'] as const, ['alice', 'bob']);
54
64
  * });
55
65
  *
56
- * it("should initialize with value 0", async () => {
57
- * const counter = fixture.contracts.counter;
58
- * const value = await counter.view<number>("get", [
59
- * fixture.accounts.deployer.accountAddress.toString()
60
- * ]);
61
- *
62
- * expect(value).to.equal(0);
66
+ * after(async () => {
67
+ * await fixture.teardown();
63
68
  * });
64
69
  *
65
- * it("alice can increment counter", async () => {
70
+ * it("alice can increment", async () => {
66
71
  * const tx = await fixture.contracts.counter.call(
67
- * fixture.accounts.alice,
68
- * "increment",
69
- * []
72
+ * fixture.accounts.alice, "increment", []
70
73
  * );
71
- *
72
74
  * expect(tx.success).to.be.true;
73
75
  * });
74
- *
75
- * after(async () => {
76
- * await teardownTestFixture();
77
- * });
78
76
  * });
79
77
  * ```
80
78
  */
@@ -83,85 +81,76 @@ export async function setupTestFixture<TModules extends readonly string[]>(
83
81
  accountLabels: string[] = ["alice", "bob"],
84
82
  options: Partial<LocalTestOptions> = {}
85
83
  ): Promise<TestFixture<TModules[number]>> {
86
- console.log(`\n🧪 Setting up test fixture...`);
87
- console.log(` Modules to deploy: ${modules.join(", ")}`);
88
- console.log(` Account labels: deployer, ${accountLabels.join(", ")}\n`);
84
+ logger.newline();
85
+ logger.step("Setting up test fixture...");
86
+ logger.plain(` Modules to deploy: ${modules.join(", ")}`);
87
+ logger.plain(` Account labels: deployer, ${accountLabels.join(", ")}`);
88
+ logger.newline();
89
89
 
90
- // Ensure 'deployer' is always in the account labels
91
90
  const allLabels = ["deployer", ...accountLabels.filter((l) => l !== "deployer")];
92
91
 
93
- // Setup local testing environment with auto-deploy
94
92
  const setupOptions: LocalTestOptions = {
95
93
  ...options,
96
94
  accountLabels: allLabels,
97
- autoDeploy: modules, // Auto-deploy specified modules
95
+ autoDeploy: modules,
98
96
  };
99
97
 
100
- const mh = await setupLocalTesting(setupOptions);
101
-
102
- // Get all labeled accounts
103
- const labeledAccounts = AccountManager.getLabeledAccounts();
104
-
105
- // Build accounts object with required accounts
106
- const accounts: any = {
107
- deployer: labeledAccounts.deployer!,
108
- };
98
+ const ctx = await setupLocalTesting(setupOptions);
99
+
100
+ // Assembly is fallible — a missing deployment address (autoDeploy
101
+ // silently failed) or any unexpected throw would leak the started
102
+ // infrastructure. Tear down ctx on failure; the outer caller sees
103
+ // the original assembly error unchanged.
104
+ try {
105
+ const mh = ctx.runtime;
106
+
107
+ const labeledAccounts = AccountManager.getLabeledAccounts();
108
+
109
+ // any: TestFixture.accounts has a structural shape with required
110
+ // `deployer/alice/bob` plus a `[key: string]: Account` index. The
111
+ // builder fills the index dynamically; typing this as the exact
112
+ // intersection would require a generic over `accountLabels` and
113
+ // produce noisy errors for the dynamic key assignment below.
114
+ const accounts: any = {
115
+ // non-null: setupLocalTesting → setupWithLocalNode/Fork unconditionally
116
+ // funds the deployer account via accountLabels[0]; deployer is always
117
+ // first by construction at L93 above.
118
+ deployer: labeledAccounts.deployer!,
119
+ };
120
+
121
+ for (const label of accountLabels) {
122
+ accounts[label] = labeledAccounts[label] || AccountManager.getOrCreateLabeled(label);
123
+ }
109
124
 
110
- // Add other labeled accounts
111
- for (const label of accountLabels) {
112
- accounts[label] = labeledAccounts[label] || AccountManager.getOrCreateLabeled(label);
113
- }
125
+ const contracts = {} as Record<TModules[number], MoveContract>;
114
126
 
115
- // Build contracts object - TypeScript will infer the correct type
116
- const contracts = {} as Record<TModules[number], MoveContract>;
127
+ for (const moduleName of modules) {
128
+ const deploymentAddress = mh.getDeploymentAddress(moduleName);
117
129
 
118
- for (const moduleName of modules) {
119
- // Get deployed contract instance
120
- const deploymentAddress = mh.getDeploymentAddress(moduleName);
130
+ if (!deploymentAddress) {
131
+ throw new Error(
132
+ `Module "${moduleName}" was not deployed. Check auto-deploy logs.`
133
+ );
134
+ }
121
135
 
122
- if (!deploymentAddress) {
123
- throw new Error(
124
- `Module "${moduleName}" was not deployed. Check auto-deploy logs.`
125
- );
136
+ contracts[moduleName as TModules[number]] = mh.getContract(deploymentAddress, moduleName);
137
+ logger.success(`Contract "${moduleName}" ready at ${deploymentAddress}`, 2);
126
138
  }
127
139
 
128
- contracts[moduleName as TModules[number]] = mh.getContract(deploymentAddress, moduleName);
129
- console.log(` ✓ Contract "${moduleName}" ready at ${deploymentAddress}`);
140
+ logger.newline();
141
+ logger.success("Test fixture ready!");
142
+ logger.newline();
143
+
144
+ return {
145
+ mh,
146
+ accounts,
147
+ contracts,
148
+ teardown: ctx.teardown,
149
+ } as TestFixture<TModules[number]>;
150
+ } catch (error) {
151
+ await ctx.teardown().catch(() => {});
152
+ throw error;
130
153
  }
131
-
132
- console.log(`\n✅ Test fixture ready!\n`);
133
-
134
- return {
135
- mh,
136
- accounts,
137
- contracts,
138
- } as TestFixture<TModules[number]>;
139
- }
140
-
141
- /**
142
- * Teardown test fixture and cleanup resources
143
- *
144
- * Call this in your test suite's `after` hook to properly cleanup:
145
- * - Stops fork server
146
- * - Clears account pool
147
- *
148
- * @example
149
- * ```typescript
150
- * after(async () => {
151
- * await teardownTestFixture();
152
- * });
153
- * ```
154
- */
155
- export async function teardownTestFixture(): Promise<void> {
156
- console.log(`\n🧹 Tearing down test fixture...`);
157
-
158
- // Stop fork server
159
- await stopLocalTesting();
160
-
161
- // Clear account pool for test isolation
162
- AccountManager.clearPool();
163
-
164
- console.log(`✓ Teardown complete\n`);
165
154
  }
166
155
 
167
156
  /**
@@ -170,53 +159,52 @@ export async function teardownTestFixture(): Promise<void> {
170
159
  *
171
160
  * @param accountLabels Account labels to create (defaults to ['alice', 'bob'])
172
161
  * @param options Optional LocalTestOptions
173
- * @returns Partial TestFixture (without contracts)
174
- *
175
- * @example
176
- * ```typescript
177
- * let fixture: Partial<TestFixture>;
178
- *
179
- * before(async function () {
180
- * this.timeout(30000);
181
- * fixture = await setupMinimalFixture(['alice', 'bob', 'charlie']);
182
- * });
183
- *
184
- * it("should deploy contract manually", async () => {
185
- * await fixture.mh!.deployContract("counter");
186
- * // ...
187
- * });
188
- * ```
162
+ * @returns Partial TestFixture (without contracts) plus a teardown closure
189
163
  */
190
164
  export async function setupMinimalFixture(
191
165
  accountLabels: string[] = ["alice", "bob"],
192
166
  options: Partial<LocalTestOptions> = {}
193
167
  ): Promise<Omit<TestFixture, "contracts">> {
194
- console.log(`\n🧪 Setting up minimal test fixture (no auto-deploy)...`);
168
+ logger.newline();
169
+ logger.step("Setting up minimal test fixture (no auto-deploy)...");
195
170
 
196
171
  const allLabels = ["deployer", ...accountLabels.filter((l) => l !== "deployer")];
197
172
 
198
173
  const setupOptions: LocalTestOptions = {
199
174
  ...options,
200
175
  accountLabels: allLabels,
201
- autoDeploy: [], // No auto-deploy
176
+ autoDeploy: [],
202
177
  };
203
178
 
204
- const mh = await setupLocalTesting(setupOptions);
179
+ const ctx = await setupLocalTesting(setupOptions);
205
180
 
206
- const labeledAccounts = AccountManager.getLabeledAccounts();
181
+ // Same teardown-on-assembly-failure pattern as setupTestFixture.
182
+ try {
183
+ const mh = ctx.runtime;
207
184
 
208
- const accounts: any = {
209
- deployer: labeledAccounts.deployer!,
210
- };
185
+ const labeledAccounts = AccountManager.getLabeledAccounts();
211
186
 
212
- for (const label of accountLabels) {
213
- accounts[label] = labeledAccounts[label] || AccountManager.getOrCreateLabeled(label);
214
- }
187
+ // any: see setupTestFixture above — same dynamic-key builder pattern.
188
+ const accounts: any = {
189
+ // non-null: deployer is unconditionally added to allLabels at L156 above.
190
+ deployer: labeledAccounts.deployer!,
191
+ };
215
192
 
216
- console.log(`\n✅ Minimal fixture ready!\n`);
193
+ for (const label of accountLabels) {
194
+ accounts[label] = labeledAccounts[label] || AccountManager.getOrCreateLabeled(label);
195
+ }
217
196
 
218
- return {
219
- mh,
220
- accounts,
221
- };
197
+ logger.newline();
198
+ logger.success("Minimal fixture ready!");
199
+ logger.newline();
200
+
201
+ return {
202
+ mh,
203
+ accounts,
204
+ teardown: ctx.teardown,
205
+ };
206
+ } catch (error) {
207
+ await ctx.teardown().catch(() => {});
208
+ throw error;
209
+ }
222
210
  }
package/src/index.ts CHANGED
@@ -2,8 +2,10 @@
2
2
  export * from "./helpers/index.js";
3
3
  export type { MovehatConfig } from "./types/config.js";
4
4
 
5
- // Export Movehat Runtime Environment
6
- export { initRuntime, getRuntime, getMovehat, mh } from "./runtime.js";
5
+ // Movehat Runtime Environment. `initRuntime` is a public utility but
6
+ // external callers should prefer Harness; it's the construction primitive
7
+ // `Harness.createLive` uses.
8
+ export { initRuntime } from "./runtime.js";
7
9
  export type { MovehatRuntime, NetworkInfo } from "./types/runtime.js";
8
10
 
9
11
  // Export Fork system
@@ -14,4 +16,8 @@ export { ForkServer } from "./fork/server.js";
14
16
  export type { ForkMetadata, AccountState, LedgerInfo, AccountData, AccountResource } from "./types/fork.js";
15
17
 
16
18
  // Export custom errors
17
- export { ModuleAlreadyDeployedError } from "./errors.js";
19
+ export { ModuleAlreadyDeployedError, PostPublishError } from "./errors.js";
20
+
21
+ // Export Harness (Hardhat-style API — primary public surface from M2 onward)
22
+ export { Harness, HarnessDisposedError } from "./harness/index.js";
23
+ export type { HarnessMode } from "./harness/index.js";
@@ -1,7 +1,12 @@
1
- import { spawn, ChildProcess } from "child_process";
2
1
  import { existsSync, rmSync } from "fs";
3
2
  import { join } from "path";
4
3
  import { Account } from "@aptos-labs/ts-sdk";
4
+ import {
5
+ defaultChildProcessAdapter,
6
+ type ChildProcessAdapter,
7
+ type SpawnedProcess,
8
+ } from "../utils/childProcessAdapter.js";
9
+ import { logger } from "../ui/index.js";
5
10
 
6
11
  export interface LocalNodeOptions {
7
12
  testDir?: string; // Directory for node data (default: .movehat/local-node)
@@ -10,6 +15,11 @@ export interface LocalNodeOptions {
10
15
  apiPort?: number; // API/RPC port (default: 8080)
11
16
  readyPort?: number; // Ready server port (default: 8070)
12
17
  silent?: boolean; // Suppress node output
18
+ /**
19
+ * Override the child-process adapter. Tests inject a fake adapter so
20
+ * the daemon spawn never reaches the real `movement` binary.
21
+ */
22
+ adapter?: ChildProcessAdapter;
13
23
  }
14
24
 
15
25
  export interface LocalNodeInfo {
@@ -29,11 +39,14 @@ export interface LocalNodeInfo {
29
39
  * - Cleanup on shutdown
30
40
  */
31
41
  export class LocalNodeManager {
32
- private process: ChildProcess | null = null;
33
- private options: Required<LocalNodeOptions>;
42
+ private spawned: SpawnedProcess | null = null;
43
+ private killed = false;
44
+ private options: Required<Omit<LocalNodeOptions, "adapter">>;
45
+ private readonly adapter: ChildProcessAdapter;
34
46
  private starting: boolean = false;
35
47
 
36
48
  constructor(options: LocalNodeOptions = {}) {
49
+ this.adapter = options.adapter ?? defaultChildProcessAdapter;
37
50
  this.options = {
38
51
  testDir: options.testDir || join(process.cwd(), ".movehat", "local-node"),
39
52
  forceRestart: options.forceRestart ?? false,
@@ -50,7 +63,7 @@ export class LocalNodeManager {
50
63
  * @returns LocalNodeInfo with connection details
51
64
  */
52
65
  async start(): Promise<LocalNodeInfo> {
53
- if (this.process) {
66
+ if (this.spawned) {
54
67
  console.log("Local node already running");
55
68
  return this.getNodeInfo();
56
69
  }
@@ -62,15 +75,17 @@ export class LocalNodeManager {
62
75
  this.starting = true;
63
76
 
64
77
  try {
65
- console.log("\n🚀 Starting local Movement node...");
66
- console.log(` Test directory: ${this.options.testDir}`);
67
- console.log(` RPC port: ${this.options.apiPort}`);
68
- console.log(` Faucet port: ${this.options.faucetPort}`);
69
- console.log(` Ready port: ${this.options.readyPort}\n`);
78
+ logger.newline();
79
+ logger.step("Starting local Movement node...");
80
+ logger.plain(` Test directory: ${this.options.testDir}`);
81
+ logger.plain(` RPC port: ${this.options.apiPort}`);
82
+ logger.plain(` Faucet port: ${this.options.faucetPort}`);
83
+ logger.plain(` Ready port: ${this.options.readyPort}`);
84
+ logger.newline();
70
85
 
71
86
  // Clean state if force restart
72
87
  if (this.options.forceRestart && existsSync(this.options.testDir)) {
73
- console.log("🧹 Cleaning previous node state...");
88
+ logger.step("Cleaning previous node state...");
74
89
  rmSync(this.options.testDir, { recursive: true, force: true });
75
90
  }
76
91
 
@@ -88,22 +103,24 @@ export class LocalNodeManager {
88
103
  args.push("--force-restart");
89
104
  }
90
105
 
91
- // Start the node process
92
- this.process = spawn("movement", args, {
106
+ // Start the node process via the injectable adapter.
107
+ this.killed = false;
108
+ this.spawned = this.adapter.spawn({
109
+ command: "movement",
110
+ args,
93
111
  stdio: this.options.silent ? "ignore" : "pipe",
94
- detached: false,
95
112
  });
96
113
 
97
114
  // Handle process output
98
- if (!this.options.silent && this.process.stdout && this.process.stderr) {
99
- this.process.stdout.on("data", (data) => {
115
+ if (!this.options.silent && this.spawned.stdout && this.spawned.stderr) {
116
+ this.spawned.stdout.on("data", (data: Buffer) => {
100
117
  const output = data.toString().trim();
101
118
  if (output) {
102
119
  console.log(`[Node] ${output}`);
103
120
  }
104
121
  });
105
122
 
106
- this.process.stderr.on("data", (data) => {
123
+ this.spawned.stderr.on("data", (data: Buffer) => {
107
124
  const output = data.toString().trim();
108
125
  if (output && !output.includes("WARN")) {
109
126
  console.error(`[Node Error] ${output}`);
@@ -111,24 +128,23 @@ export class LocalNodeManager {
111
128
  });
112
129
  }
113
130
 
114
- // Handle process exit
115
- this.process.on("exit", (code) => {
116
- if (code !== 0 && code !== null) {
117
- console.error(`\n❌ Local node exited with code ${code}`);
131
+ // The adapter's `exited` promise settles on both natural exit and on
132
+ // spawn-time error (e.g. ENOENT). On error the code is `null` — we don't
133
+ // log a generic "spawn failed" message here because `waitForReady` will
134
+ // surface a detailed timeout-with-hints error if movement never starts.
135
+ void this.spawned.exited.then(({ code }) => {
136
+ if (code !== null && code !== 0) {
137
+ logger.error(`Local node exited with code ${code}`);
118
138
  }
119
- this.process = null;
120
- });
121
-
122
- this.process.on("error", (error) => {
123
- console.error(`\n❌ Failed to start local node: ${error.message}`);
124
- this.process = null;
139
+ this.spawned = null;
125
140
  });
126
141
 
127
142
  // Wait for node to be ready
128
- console.log("Waiting for node to be ready...");
143
+ logger.step("Waiting for node to be ready...");
129
144
  await this.waitForReady(60000); // 60 second timeout
130
145
 
131
- console.log("Local Movement node is ready!\n");
146
+ logger.success("Local Movement node is ready!");
147
+ logger.newline();
132
148
 
133
149
  this.starting = false;
134
150
  return this.getNodeInfo();
@@ -137,9 +153,10 @@ export class LocalNodeManager {
137
153
  this.starting = false;
138
154
 
139
155
  // Cleanup on failure
140
- if (this.process) {
141
- this.process.kill();
142
- this.process = null;
156
+ if (this.spawned) {
157
+ this.killed = true;
158
+ this.spawned.kill();
159
+ this.spawned = null;
143
160
  }
144
161
 
145
162
  throw error;
@@ -150,42 +167,47 @@ export class LocalNodeManager {
150
167
  * Stop the local node
151
168
  */
152
169
  async stop(): Promise<void> {
153
- if (!this.process) {
170
+ if (!this.spawned) {
154
171
  return;
155
172
  }
156
173
 
157
- console.log("\n🛑 Stopping local Movement node...");
174
+ logger.newline();
175
+ logger.step("Stopping local Movement node...");
158
176
 
159
- return new Promise((resolve) => {
160
- if (!this.process) {
161
- resolve();
162
- return;
163
- }
177
+ const spawned = this.spawned;
164
178
 
165
- this.process.once("exit", () => {
166
- console.log("✅ Local node stopped\n");
167
- this.process = null;
168
- resolve();
169
- });
179
+ // Mark killed synchronously so isRunning() reflects the intent right away,
180
+ // mirroring node's ChildProcess.killed semantics.
181
+ this.killed = true;
170
182
 
171
- // Send SIGTERM for graceful shutdown
172
- this.process.kill("SIGTERM");
183
+ // Send SIGTERM for graceful shutdown
184
+ spawned.kill("SIGTERM");
173
185
 
174
- // Force kill after 5 seconds if still running
175
- setTimeout(() => {
176
- if (this.process) {
177
- console.log("⚠️ Force killing node...");
178
- this.process.kill("SIGKILL");
179
- }
180
- }, 5000);
181
- });
186
+ // Force kill after 5 seconds if still running
187
+ const forceTimer = setTimeout(() => {
188
+ if (this.spawned === spawned) {
189
+ logger.warning("Force killing node...");
190
+ spawned.kill("SIGKILL");
191
+ }
192
+ }, 5000);
193
+
194
+ try {
195
+ await spawned.exited;
196
+ logger.success("Local node stopped");
197
+ logger.newline();
198
+ } finally {
199
+ clearTimeout(forceTimer);
200
+ if (this.spawned === spawned) {
201
+ this.spawned = null;
202
+ }
203
+ }
182
204
  }
183
205
 
184
206
  /**
185
207
  * Check if the node is running
186
208
  */
187
209
  isRunning(): boolean {
188
- return this.process !== null && !this.process.killed;
210
+ return this.spawned !== null && !this.killed;
189
211
  }
190
212
 
191
213
  /**
@@ -245,7 +267,7 @@ export class LocalNodeManager {
245
267
  ? account
246
268
  : account.accountAddress.toString();
247
269
 
248
- // Use query parameters for Aptos/Movement faucet
270
+ // Use query parameters for the Movement faucet
249
271
  const faucetUrl = `http://127.0.0.1:${this.options.faucetPort}/mint?amount=${amount}&address=${address}`;
250
272
 
251
273
  try {
@@ -259,11 +281,12 @@ export class LocalNodeManager {
259
281
  }
260
282
 
261
283
  const result = await response.json();
262
- console.log(`Funded ${address} with ${amount} octas`);
284
+ logger.success(`Funded ${address} with ${amount} octas`, 2);
263
285
 
264
286
  return result;
265
- } catch (error: any) {
266
- throw new Error(`Failed to fund account: ${error.message}`);
287
+ } catch (error) {
288
+ const msg = error instanceof Error ? error.message : String(error);
289
+ throw new Error(`Failed to fund account: ${msg}`);
267
290
  }
268
291
  }
269
292
 
@@ -271,13 +294,15 @@ export class LocalNodeManager {
271
294
  * Fund multiple accounts in batch
272
295
  */
273
296
  async fundAccounts(accounts: (Account | string)[], amount: number = 100_000_000): Promise<void> {
274
- console.log(`\n💰 Funding ${accounts.length} accounts from local faucet...`);
297
+ logger.newline();
298
+ logger.step(`Funding ${accounts.length} accounts from local faucet...`);
275
299
 
276
300
  for (const account of accounts) {
277
301
  await this.fundAccount(account, amount);
278
302
  }
279
303
 
280
- console.log(`✓ All accounts funded successfully\n`);
304
+ logger.success("All accounts funded successfully");
305
+ logger.newline();
281
306
  }
282
307
 
283
308
  /**
@@ -289,9 +314,9 @@ export class LocalNodeManager {
289
314
  }
290
315
 
291
316
  if (existsSync(this.options.testDir)) {
292
- console.log(`🧹 Cleaning node data at ${this.options.testDir}...`);
317
+ logger.step(`Cleaning node data at ${this.options.testDir}...`);
293
318
  rmSync(this.options.testDir, { recursive: true, force: true });
294
- console.log("Node data cleaned");
319
+ logger.success("Node data cleaned");
295
320
  }
296
321
  }
297
322
  }