@smoothbricks/nx-plugin 0.5.6 → 0.6.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 (440) hide show
  1. package/README.md +1095 -360
  2. package/dist/.build-inputs.json +138 -0
  3. package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
  4. package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
  6. package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
  7. package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
  9. package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
  10. package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-nextest-timings.js +28 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +14 -15
  15. package/dist/build-state-output-policy.d.ts +95 -1
  16. package/dist/build-state-output-policy.d.ts.map +1 -1
  17. package/dist/build-state-output-policy.js +368 -30
  18. package/dist/bun-lock-scope.d.ts +44 -0
  19. package/dist/bun-lock-scope.d.ts.map +1 -0
  20. package/dist/bun-lock-scope.js +97 -0
  21. package/dist/cargo-build-script-env.d.ts +49 -0
  22. package/dist/cargo-build-script-env.d.ts.map +1 -0
  23. package/dist/cargo-build-script-env.js +324 -0
  24. package/dist/cargo-closure-input.d.ts +31 -4
  25. package/dist/cargo-closure-input.d.ts.map +1 -1
  26. package/dist/cargo-closure-input.js +66 -6
  27. package/dist/cargo-retention-hook.d.ts +17 -0
  28. package/dist/cargo-retention-hook.d.ts.map +1 -0
  29. package/dist/cargo-retention-hook.js +85 -0
  30. package/dist/cargo-source-hash.d.ts +25 -7
  31. package/dist/cargo-source-hash.d.ts.map +1 -1
  32. package/dist/cargo-source-hash.js +108 -43
  33. package/dist/cargo-toolchain-paths.d.ts +40 -0
  34. package/dist/cargo-toolchain-paths.d.ts.map +1 -0
  35. package/dist/cargo-toolchain-paths.js +84 -0
  36. package/dist/cargo-toolchain-policy.d.ts +25 -8
  37. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  38. package/dist/cargo-toolchain-policy.js +39 -5
  39. package/dist/cargo-workspace.d.ts +10 -4
  40. package/dist/cargo-workspace.d.ts.map +1 -1
  41. package/dist/cargo-workspace.js +65 -95
  42. package/dist/cross-check-policy.d.ts +9 -9
  43. package/dist/cross-check-policy.d.ts.map +1 -1
  44. package/dist/cross-check-policy.js +11 -11
  45. package/dist/disk-command-policy.d.ts.map +1 -1
  46. package/dist/disk-command-policy.js +1 -0
  47. package/dist/ensure-built-receipt.d.ts +13 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +126 -47
  50. package/dist/ensure-built-witness.d.ts +27 -8
  51. package/dist/ensure-built-witness.d.ts.map +1 -1
  52. package/dist/ensure-built-witness.js +45 -15
  53. package/dist/ensure-built.d.ts.map +1 -1
  54. package/dist/ensure-built.js +9 -1
  55. package/dist/eslint-config-closure.d.ts +7 -0
  56. package/dist/eslint-config-closure.d.ts.map +1 -0
  57. package/dist/eslint-config-closure.js +346 -0
  58. package/dist/executors/all-verdicts/executor.d.ts +35 -0
  59. package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
  60. package/dist/executors/all-verdicts/executor.js +133 -0
  61. package/dist/executors/all-verdicts/schema.d.ts +10 -0
  62. package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
  63. package/dist/executors/all-verdicts/schema.js +2 -0
  64. package/dist/executors/bounded-exec/bounds.d.ts +56 -0
  65. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
  66. package/dist/executors/bounded-exec/bounds.js +43 -0
  67. package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
  68. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/cpu-pool.js +54 -119
  70. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  71. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/executor.js +371 -239
  73. package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
  74. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  75. package/dist/executors/bounded-exec/gateway-lease.js +81 -28
  76. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  77. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  78. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  79. package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
  80. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/lease-wait.js +68 -0
  82. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  83. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  84. package/dist/executors/bounded-exec/lock-wait.js +108 -0
  85. package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
  86. package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/owned-subtree.js +178 -0
  88. package/dist/executors/bounded-exec/progress.d.ts +4 -1
  89. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  90. package/dist/executors/bounded-exec/progress.js +5 -2
  91. package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
  92. package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
  93. package/dist/executors/bounded-exec/ram-attach.js +207 -0
  94. package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
  95. package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
  96. package/dist/executors/bounded-exec/ram-detach.js +207 -0
  97. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
  98. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
  99. package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
  100. package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
  101. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  102. package/dist/executors/bounded-exec/ram-temp.js +1213 -399
  103. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
  104. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  105. package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
  106. package/dist/executors/bounded-exec/runner-hook.js +14 -5
  107. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
  108. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  109. package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
  110. package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
  111. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
  112. package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
  113. package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
  114. package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
  115. package/dist/executors/bounded-exec/runtime-pin.js +167 -0
  116. package/dist/executors/bounded-exec/schema.d.ts +18 -1
  117. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  118. package/dist/executors/bounded-exec/verdict.d.ts +40 -11
  119. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  120. package/dist/executors/bounded-exec/verdict.js +88 -19
  121. package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
  122. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  123. package/dist/executors/cargo-zigbuild/executor.js +67 -12
  124. package/dist/executors/clean-outputs/executor.js +1 -0
  125. package/dist/executors/scriptc-native/executor.d.ts +79 -0
  126. package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
  127. package/dist/executors/scriptc-native/executor.js +367 -0
  128. package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
  129. package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
  130. package/dist/executors/scriptc-native/ffi-paths.js +25 -0
  131. package/dist/executors/scriptc-native/schema.d.ts +34 -0
  132. package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
  133. package/dist/executors/scriptc-native/schema.js +1 -0
  134. package/dist/executors/typescript-emit/executor.d.ts +3 -1
  135. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  136. package/dist/executors/typescript-emit/executor.js +164 -33
  137. package/dist/forbidden-spelling-policy.d.ts +56 -0
  138. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  139. package/dist/forbidden-spelling-policy.js +176 -0
  140. package/dist/generators/create-package/generator.d.ts.map +1 -1
  141. package/dist/generators/create-package/generator.js +3 -4
  142. package/dist/graph-input-contract.d.ts +14 -0
  143. package/dist/graph-input-contract.d.ts.map +1 -1
  144. package/dist/graph-input-contract.js +67 -2
  145. package/dist/index.d.ts +23 -6
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +676 -215
  148. package/dist/managed-assets.d.ts +2 -0
  149. package/dist/managed-assets.d.ts.map +1 -1
  150. package/dist/managed-files/files.d.ts +3 -3
  151. package/dist/managed-files/files.d.ts.map +1 -1
  152. package/dist/managed-files/files.js +28 -3
  153. package/dist/managed-files/managed-format.d.ts.map +1 -1
  154. package/dist/managed-files/managed-format.js +1 -0
  155. package/dist/nextest-code-bound.js +1 -0
  156. package/dist/nextest-timings.d.ts +35 -0
  157. package/dist/nextest-timings.d.ts.map +1 -0
  158. package/dist/nextest-timings.js +168 -0
  159. package/dist/owned-installation.d.ts +6 -5
  160. package/dist/owned-installation.d.ts.map +1 -1
  161. package/dist/owned-installation.js +150 -26
  162. package/dist/package-target-policy.d.ts.map +1 -1
  163. package/dist/package-target-policy.js +2 -3
  164. package/dist/process-children.d.ts +7 -0
  165. package/dist/process-children.d.ts.map +1 -0
  166. package/dist/process-children.darwin.d.ts +7 -0
  167. package/dist/process-children.darwin.d.ts.map +1 -0
  168. package/dist/process-children.darwin.js +13 -0
  169. package/dist/process-children.js +14 -0
  170. package/dist/process-children.linux.d.ts +8 -0
  171. package/dist/process-children.linux.d.ts.map +1 -0
  172. package/dist/process-children.linux.js +25 -0
  173. package/dist/process-group.d.ts +108 -0
  174. package/dist/process-group.d.ts.map +1 -0
  175. package/dist/process-group.js +171 -0
  176. package/dist/process-listing.d.ts +7 -0
  177. package/dist/process-listing.d.ts.map +1 -0
  178. package/dist/process-listing.js +51 -0
  179. package/dist/producer-receipts.d.ts +8 -2
  180. package/dist/producer-receipts.d.ts.map +1 -1
  181. package/dist/producer-receipts.js +75 -48
  182. package/dist/task-graph-policy.d.ts +21 -0
  183. package/dist/task-graph-policy.d.ts.map +1 -0
  184. package/dist/task-graph-policy.js +91 -0
  185. package/dist/test-timings.js +4 -4
  186. package/dist/test-walk-policy.d.ts +14 -5
  187. package/dist/test-walk-policy.d.ts.map +1 -1
  188. package/dist/test-walk-policy.js +8 -2
  189. package/dist/testing.d.ts +73 -28
  190. package/dist/testing.d.ts.map +1 -1
  191. package/dist/testing.js +217 -223
  192. package/dist/tool-bins.d.ts +33 -0
  193. package/dist/tool-bins.d.ts.map +1 -0
  194. package/dist/tool-bins.js +72 -0
  195. package/dist/typecheck-test-policy.d.ts.map +1 -1
  196. package/dist/typecheck-test-policy.js +3 -4
  197. package/dist/wait-why-policy.d.ts +28 -0
  198. package/dist/wait-why-policy.d.ts.map +1 -0
  199. package/dist/wait-why-policy.js +223 -0
  200. package/dist/workspace-config-policy.d.ts +14 -8
  201. package/dist/workspace-config-policy.d.ts.map +1 -1
  202. package/dist/workspace-config-policy.js +60 -16
  203. package/dist/workspace-manifest.d.ts +41 -6
  204. package/dist/workspace-manifest.d.ts.map +1 -1
  205. package/dist/workspace-manifest.js +57 -0
  206. package/executors.json +21 -1
  207. package/loader.js +2 -0
  208. package/managed/raw/envrc +11 -0
  209. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  210. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  211. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  212. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  213. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  214. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  215. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  216. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  217. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  218. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  219. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  220. package/managed/raw/tooling/direnv/repo-path +68 -6
  221. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  222. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  223. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  224. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  225. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  226. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  227. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  228. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  229. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  230. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  231. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  232. package/package.json +77 -13
  233. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  234. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  235. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  236. package/src/bounded-test-policy.ts +12 -14
  237. package/src/build-state-output-policy.ts +458 -34
  238. package/src/bun-lock-scope.ts +108 -0
  239. package/src/cargo-build-script-env.ts +265 -0
  240. package/src/cargo-closure-input.ts +74 -7
  241. package/src/cargo-retention-hook.ts +94 -0
  242. package/src/cargo-source-hash.ts +138 -41
  243. package/src/cargo-toolchain-paths.ts +95 -0
  244. package/src/cargo-toolchain-policy.ts +49 -5
  245. package/src/cargo-workspace.ts +72 -123
  246. package/src/cross-check-policy.ts +12 -10
  247. package/src/disk-command-policy.ts +1 -0
  248. package/src/ensure-built-receipt.ts +132 -39
  249. package/src/ensure-built-witness.ts +62 -10
  250. package/src/ensure-built.ts +11 -1
  251. package/src/eslint-config-closure.ts +357 -0
  252. package/src/executors/all-verdicts/executor.ts +164 -0
  253. package/src/executors/all-verdicts/schema.json +22 -0
  254. package/src/executors/all-verdicts/schema.ts +10 -0
  255. package/src/executors/bounded-exec/bounds.ts +76 -0
  256. package/src/executors/bounded-exec/cpu-pool.ts +51 -117
  257. package/src/executors/bounded-exec/executor.ts +423 -259
  258. package/src/executors/bounded-exec/gateway-lease.ts +82 -33
  259. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  260. package/src/executors/bounded-exec/lease-wait.ts +89 -0
  261. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  262. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  263. package/src/executors/bounded-exec/progress.ts +9 -3
  264. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  265. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  266. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  267. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  268. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  269. package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
  270. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  271. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  272. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  273. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  274. package/src/executors/bounded-exec/schema.json +11 -2
  275. package/src/executors/bounded-exec/schema.ts +19 -1
  276. package/src/executors/bounded-exec/verdict.ts +137 -34
  277. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  278. package/src/executors/clean-outputs/executor.ts +1 -0
  279. package/src/executors/scriptc-native/executor.ts +394 -0
  280. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  281. package/src/executors/scriptc-native/schema.json +60 -0
  282. package/src/executors/scriptc-native/schema.ts +34 -0
  283. package/src/executors/typescript-emit/executor.ts +205 -38
  284. package/src/forbidden-spelling-policy.ts +226 -0
  285. package/src/generators/create-package/generator.ts +7 -7
  286. package/src/graph-input-contract.ts +61 -2
  287. package/src/index.ts +792 -225
  288. package/src/managed-assets.ts +3 -0
  289. package/src/managed-files/files.ts +28 -3
  290. package/src/managed-files/managed-format.ts +1 -0
  291. package/src/nextest-code-bound.ts +1 -0
  292. package/src/nextest-timings.ts +106 -0
  293. package/src/owned-installation.ts +150 -23
  294. package/src/package-target-policy.ts +2 -3
  295. package/src/process-children.darwin.ts +14 -0
  296. package/src/process-children.linux.ts +33 -0
  297. package/src/process-children.ts +22 -0
  298. package/src/process-group.ts +209 -0
  299. package/src/process-listing.ts +54 -0
  300. package/src/producer-receipts.ts +68 -45
  301. package/src/task-graph-policy.ts +98 -0
  302. package/src/test-walk-policy.ts +23 -8
  303. package/src/testing.ts +240 -232
  304. package/src/tool-bins.ts +108 -0
  305. package/src/typecheck-test-policy.ts +2 -3
  306. package/src/wait-why-policy.ts +226 -0
  307. package/src/workspace-config-policy.ts +63 -15
  308. package/src/workspace-manifest.ts +89 -6
  309. package/test-timings.json +123 -98
  310. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  311. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  312. package/dist/bin/smoo-nx-failures.js +0 -3
  313. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  314. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  315. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  316. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  317. package/dist/failure-summary.d.ts +0 -5
  318. package/dist/failure-summary.d.ts.map +0 -1
  319. package/dist/failure-summary.js +0 -118
  320. package/dist/nextest-extraction.d.ts +0 -117
  321. package/dist/nextest-extraction.d.ts.map +0 -1
  322. package/dist/nextest-extraction.js +0 -303
  323. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  324. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  325. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  326. package/src/__tests__/counted-cargo-process.ts +0 -286
  327. package/src/__tests__/counted-cargo.ts +0 -713
  328. package/src/__tests__/directory-change.ts +0 -27
  329. package/src/__tests__/fixture-cargo-home.ts +0 -36
  330. package/src/__tests__/fixture-nx-env.ts +0 -193
  331. package/src/__tests__/owned-installation.ts +0 -13
  332. package/src/__tests__/past-tick.ts +0 -12
  333. package/src/__tests__/progress-clock.ts +0 -43
  334. package/src/__tests__/runtime-input.ts +0 -23
  335. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  336. package/src/bin/smoo-nx-failures.ts +0 -4
  337. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  338. package/src/bounded-test-policy.test.ts +0 -1029
  339. package/src/build-state-output-policy.test.ts +0 -115
  340. package/src/bun-bootstrap.test.ts +0 -102
  341. package/src/bun-file-packages.test.ts +0 -47
  342. package/src/cargo-closure-filesets.test.ts +0 -63
  343. package/src/cargo-closure-input.property.test.ts +0 -50
  344. package/src/cargo-closure-input.test.ts +0 -506
  345. package/src/cargo-closure-key.test.ts +0 -240
  346. package/src/cargo-resolve-cache.test.ts +0 -1181
  347. package/src/cargo-source-hash.test.ts +0 -707
  348. package/src/cargo-workspace.test.ts +0 -615
  349. package/src/cross-check-policy.test.ts +0 -316
  350. package/src/disk-command-policy.test.ts +0 -61
  351. package/src/ensure-built-receipt.test.ts +0 -279
  352. package/src/ensure-built-witness.test.ts +0 -688
  353. package/src/ensure-built.test.ts +0 -1462
  354. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  355. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  356. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  357. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  358. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  359. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  360. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  361. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  362. package/src/executors/bounded-exec/progress.test.ts +0 -139
  363. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  364. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  365. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  366. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  367. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  368. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  369. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  370. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  371. package/src/executors/clean-outputs/executor.test.ts +0 -20
  372. package/src/executors/typescript-emit/executor.test.ts +0 -83
  373. package/src/failure-summary.ts +0 -119
  374. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  375. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  376. package/src/generators/create-package/generator.test.ts +0 -190
  377. package/src/generators/make-public/generator.test.ts +0 -137
  378. package/src/graph-input-contract.test.ts +0 -379
  379. package/src/host-controller-wiring.test.ts +0 -31
  380. package/src/index.test.ts +0 -3319
  381. package/src/linked-snapshots.nx.test.ts +0 -254
  382. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  383. package/src/managed-files/generator.test.ts +0 -243
  384. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  385. package/src/managed-files/json-edit.test.ts +0 -216
  386. package/src/managed-files/managed-content.test.ts +0 -166
  387. package/src/managed-files/managed-format-json.test.ts +0 -308
  388. package/src/managed-files/repo-path.test.ts +0 -172
  389. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  390. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  391. package/src/managed-files/tree-permissions.test.ts +0 -109
  392. package/src/managed-files/tree.test.ts +0 -123
  393. package/src/manifest-hash.test.ts +0 -219
  394. package/src/nextest-code-bound.test.ts +0 -161
  395. package/src/nextest-extraction.test.ts +0 -216
  396. package/src/nextest-extraction.ts +0 -371
  397. package/src/nextest-partitions.test.ts +0 -501
  398. package/src/nx-cache-bound.test.ts +0 -109
  399. package/src/nx-cache-restore-mtime.test.ts +0 -170
  400. package/src/nx-daemon-claim.test.ts +0 -279
  401. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  402. package/src/nx-daemon-idle-policy.test.ts +0 -111
  403. package/src/nx-daemon-ignore-files.test.ts +0 -210
  404. package/src/nx-daemon-root-normalization.test.ts +0 -105
  405. package/src/nx-daemon-start-never.test.ts +0 -292
  406. package/src/nx-daemon-validity.test.ts +0 -1055
  407. package/src/nx-dot-input-policy.test.ts +0 -353
  408. package/src/nx-failure-life-cycles.test.ts +0 -207
  409. package/src/nx-files-archive-racy.test.ts +0 -97
  410. package/src/nx-foreign-workspace-env.test.ts +0 -329
  411. package/src/nx-incomplete-run-summary.test.ts +0 -70
  412. package/src/nx-plugin-load-errors.test.ts +0 -120
  413. package/src/nx-project-graph-errors.test.ts +0 -70
  414. package/src/nx-project-resolution-cache.test.ts +0 -176
  415. package/src/nx-raw-inputs.test.ts +0 -166
  416. package/src/nx-resident-graph-workers.test.ts +0 -112
  417. package/src/nx-run-information.test.ts +0 -118
  418. package/src/nx-skipped-task-exit.test.ts +0 -180
  419. package/src/nx-state-location.test.ts +0 -63
  420. package/src/nx-store-resolution.test.ts +0 -81
  421. package/src/nx-task-graph-cycles.test.ts +0 -148
  422. package/src/nx-task-output-lease.test.ts +0 -550
  423. package/src/nx-use-local.test.ts +0 -105
  424. package/src/owned-installation.test.ts +0 -105
  425. package/src/package-target-policy.test.ts +0 -1014
  426. package/src/producer-receipts.test.ts +0 -285
  427. package/src/release-config-policy.test.ts +0 -311
  428. package/src/runtime-input.test.ts +0 -393
  429. package/src/serial-group-wiring.test.ts +0 -326
  430. package/src/task-history-namespace.test.ts +0 -181
  431. package/src/task-results.test.ts +0 -228
  432. package/src/test-clock-policy.test.ts +0 -338
  433. package/src/test-program.test.ts +0 -303
  434. package/src/test-timings.test.ts +0 -240
  435. package/src/test-walk-policy.test.ts +0 -620
  436. package/src/testing.test.ts +0 -509
  437. package/src/typecheck-test-policy.test.ts +0 -1468
  438. package/src/typescript-resolution.test.ts +0 -76
  439. package/src/version-actions.test.ts +0 -80
  440. package/src/workspace-config-policy.test.ts +0 -737
@@ -1,171 +0,0 @@
1
- import { afterEach, describe, expect, it, jest } from 'bun:test';
2
- import { chmod, mkdir, rm, writeFile } from 'node:fs/promises';
3
- import { createServer, type Socket } from 'node:net';
4
- import { join } from 'node:path';
5
- import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from '../../bounded-test-policy.js';
6
- import { ownedSocketDirectory } from '../../testing.js';
7
- import { createProcessTreeKiller, runBoundedExec } from './executor.js';
8
-
9
- const roots: string[] = [];
10
-
11
- /** Real Go build/run events; only the executor's clock is controlled, never compiler speed. */
12
- describe('Go test progress host proofs', () => {
13
- afterEach(async () => {
14
- jest.useRealTimers();
15
- await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
16
- });
17
-
18
- it('excludes held initial linking and inter-package linking from test idle time', async () => {
19
- const root = await goFixture();
20
- for (const name of ['first', 'second']) {
21
- await mkdir(join(root, name));
22
- await writeFile(
23
- join(root, name, 'ready_test.go'),
24
- `package ${name}\nimport "testing"\nfunc TestReady(t *testing.T) {}\n`,
25
- );
26
- }
27
- const endpoint = join(root, 'runner.sock');
28
- const wrapper = join(root, 'tool.cjs');
29
- await writeFile(
30
- wrapper,
31
- [
32
- '#!/usr/bin/env node',
33
- "const { spawnSync } = require('node:child_process');",
34
- "const { connect } = require('node:net');",
35
- "const { basename } = require('node:path');",
36
- 'const [tool, ...args] = process.argv.slice(2);',
37
- 'function run() {',
38
- " const result = spawnSync(tool, args, { stdio: 'inherit' });",
39
- ' if (result.error) throw result.error;',
40
- ' if (result.signal) process.kill(process.pid, result.signal);',
41
- ' else process.exit(result.status ?? 1);',
42
- '}',
43
- "if (basename(tool) !== 'link' || args.some(arg => arg.startsWith('-V'))) run();",
44
- 'else {',
45
- ` const socket = connect(${JSON.stringify(endpoint)}, () => socket.write('link-ready\\n'));`,
46
- " socket.once('error', error => { throw error; });",
47
- " let answer = '';",
48
- " socket.on('data', data => { answer += data.toString(); });",
49
- " socket.once('end', () => {",
50
- " if (answer !== 'go\\n') throw new Error('unexpected link release');",
51
- ' socket.end(); run();',
52
- ' });',
53
- '}',
54
- '',
55
- ].join('\n'),
56
- );
57
- await chmod(wrapper, 0o700);
58
- const sockets = new Set<Socket>();
59
- const exchanges: Promise<unknown>[] = [];
60
- const firstFinished = Promise.withResolvers<boolean>();
61
- let links = 0;
62
- const server = createServer((socket) => {
63
- sockets.add(socket);
64
- socket.once('close', () => sockets.delete(socket));
65
- exchanges.push(
66
- new Promise<void>((resolve, reject) => {
67
- socket.once('error', reject);
68
- let request = '';
69
- const received = (data: Buffer) => {
70
- request += data.toString();
71
- if (!request.includes('\n')) return;
72
- socket.off('data', received);
73
- void (async () => {
74
- expect(request).toBe('link-ready\n');
75
- links += 1;
76
- if (links === 2) expect(await firstFinished.promise).toBe(true);
77
- // The linker is held at a real IPC barrier while virtual idle time crosses the
78
- // unchanged production bound twice. No test binary exists for this package yet.
79
- jest.advanceTimersByTime(2 * BOUNDED_TEST_IDLE_TIMEOUT_MS);
80
- socket.end('go\n');
81
- resolve();
82
- })().catch(reject);
83
- };
84
- socket.on('data', received);
85
- }).catch((error: unknown) => error),
86
- );
87
- });
88
- await new Promise<void>((resolve) => server.listen(endpoint, resolve));
89
- const stdout = process.stdout.write;
90
- const stderr = process.stderr.write;
91
- let output = '';
92
- process.stdout.write = (chunk) => {
93
- output += chunk.toString();
94
- if (output.includes('"Action":"pass","Package":"example/first","Elapsed":')) firstFinished.resolve(true);
95
- return true;
96
- };
97
- process.stderr.write = () => true;
98
- jest.useFakeTimers();
99
- try {
100
- const command = ['first', 'second']
101
- .map((name) => `go test -p=1 -count=1 -toolexec=${JSON.stringify(wrapper)} ./${name}`)
102
- .join(' && ');
103
- const result = await runBoundedExec(
104
- { command, idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS, killAfterMs: 0 },
105
- { root },
106
- createProcessTreeKiller(),
107
- null,
108
- null,
109
- );
110
- firstFinished.resolve(false);
111
- const exchangeErrors = (await Promise.all(exchanges)).filter((error) => error !== undefined);
112
- expect(result.success, result.terminalOutput).toBe(true);
113
- expect(exchangeErrors).toEqual([]);
114
- expect(links).toBe(2);
115
- expect(result.terminalOutput).not.toContain('Command made no progress');
116
- } finally {
117
- firstFinished.resolve(false);
118
- jest.useRealTimers();
119
- process.stdout.write = stdout;
120
- process.stderr.write = stderr;
121
- for (const socket of sockets) socket.destroy();
122
- await new Promise<void>((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
123
- }
124
- });
125
-
126
- it('ends a real hanging Go test when its unchanged active-test budget expires', async () => {
127
- const root = await goFixture();
128
- await writeFile(
129
- join(root, 'hang_test.go'),
130
- 'package example\nimport ("runtime"; "testing")\nfunc TestHang(t *testing.T) { for { runtime.Gosched() } }\n',
131
- );
132
- const stdout = process.stdout.write;
133
- const stderr = process.stderr.write;
134
- let output = '';
135
- let advanced = false;
136
- process.stdout.write = (chunk) => {
137
- output += chunk.toString();
138
- if (!advanced && output.includes('"Action":"run","Package":"example","Test":"TestHang"')) {
139
- advanced = true;
140
- queueMicrotask(() => jest.advanceTimersByTime(BOUNDED_TEST_IDLE_TIMEOUT_MS));
141
- }
142
- return true;
143
- };
144
- process.stderr.write = () => true;
145
- jest.useFakeTimers();
146
- try {
147
- const result = await runBoundedExec(
148
- { command: 'go test -p=1 -count=1 .', idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS, killAfterMs: 0 },
149
- { root },
150
- createProcessTreeKiller(),
151
- null,
152
- null,
153
- );
154
- expect(advanced).toBe(true);
155
- expect(result.success).toBe(false);
156
- expect(result.terminalOutput).toContain(`no test finished for ${BOUNDED_TEST_IDLE_TIMEOUT_MS}ms`);
157
- expect(result.terminalOutput).toContain('still running: example TestHang');
158
- } finally {
159
- jest.useRealTimers();
160
- process.stdout.write = stdout;
161
- process.stderr.write = stderr;
162
- }
163
- });
164
- });
165
-
166
- async function goFixture(): Promise<string> {
167
- const root = await ownedSocketDirectory('go-progress-', 'runner.sock');
168
- roots.push(root);
169
- await writeFile(join(root, 'go.mod'), 'module example\n\ngo 1.24\n');
170
- return root;
171
- }
@@ -1,291 +0,0 @@
1
- import { describe, expect, it, jest } from 'bun:test';
2
- import { mkdtemp, rm, writeFile } from 'node:fs/promises';
3
- import { tmpdir } from 'node:os';
4
- import { join } from 'node:path';
5
- import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from '../../bounded-test-policy.js';
6
- import {
7
- captureHangDiagnostics,
8
- type HangCaptureRequest,
9
- type HangDiagnosticHost,
10
- type HangProbeResult,
11
- } from './hang-diagnostics.js';
12
-
13
- const ROOT = 101;
14
- const STARTED = 'Thu Oct 15 12:34:56 2026';
15
- const rootRow = `${ROOT} 1 ${ROOT} S 0.0 03:01 ${STARTED} runner --test selected`;
16
- const childRow = `202 ${ROOT} ${ROOT} S 0.0 03:00 ${STARTED} child waiting`;
17
- const grandchildRow = `303 202 ${ROOT} S 0.0 02:59 ${STARTED} grandchild holding pipe`;
18
- const reparentedRow = `404 1 ${ROOT} S 0.0 02:58 ${STARTED} reparented group member`;
19
- const unrelatedRow = `505 1 505 S 0.0 02:58 ${STARTED} unrelated process`;
20
- const census = [rootRow, childRow, grandchildRow, reparentedRow, unrelatedRow].join('\n');
21
- const fileObservation =
22
- 'COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME\nchild 303 tester 7r REG 1,2 4 123 /fixture/held-file\n';
23
- const exited = (stdout: string, code = 0, stderr = ''): HangProbeResult => ({ status: 'exited', code, stdout, stderr });
24
- const request = (): HangCaptureRequest => ({
25
- pid: ROOT,
26
- pgid: ROOT,
27
- expiresAtMs: Date.now() + BOUNDED_TEST_IDLE_TIMEOUT_MS,
28
- deadlineMs: BOUNDED_TEST_IDLE_TIMEOUT_MS,
29
- });
30
-
31
- function scriptedHost(results: readonly HangProbeResult[]) {
32
- const calls: { file: string; args: readonly string[]; timeoutMs: number }[] = [];
33
- let index = 0;
34
- const host: HangDiagnosticHost = {
35
- platform: 'darwin',
36
- async probe(file, args, timeoutMs) {
37
- calls.push({ file, args, timeoutMs });
38
- const result = results[index++];
39
- if (result === undefined) throw new Error(`unexpected probe ${file}`);
40
- return result;
41
- },
42
- };
43
- return { host, calls };
44
- }
45
-
46
- describe('pre-expiry hang diagnostics', () => {
47
- it('keeps grandchildren and reparented group members, but not unrelated host rows', async () => {
48
- const { host, calls } = scriptedHost([exited(census), exited(fileObservation), exited(census)]);
49
- const capture = await captureHangDiagnostics(request(), host);
50
- expect(capture.outcome).toBe('holders');
51
- for (const row of [rootRow, childRow, grandchildRow, reparentedRow]) expect(capture.text).toContain(row);
52
- expect(capture.text).not.toContain(unrelatedRow);
53
- expect(capture.text).toContain('/fixture/held-file');
54
- expect(capture.text).toContain('not proof of a contested lock');
55
- expect(capture.text).toContain('pid=101 pgid=101');
56
- expect(calls.map((call) => call.file)).toEqual(['ps', 'sudo', 'ps']);
57
- expect(calls[1]?.args).toEqual(['-n', 'lsof', '-nP', '-p', '101,202,303,404']);
58
- expect(capture.offsetFromExpiryMs).toBeGreaterThan(0);
59
- expect(capture.capturedAtMs).toBeGreaterThanOrEqual(capture.startedAtMs);
60
- });
61
-
62
- it('reports no matches only after successful resource inspection and stable identities', async () => {
63
- const { host } = scriptedHost([exited(rootRow), exited('', 1), exited(rootRow)]);
64
- const capture = await captureHangDiagnostics(request(), host);
65
- expect(capture.outcome).toBe('none');
66
- expect(capture.text).toContain('no open-file matches within its stated visibility');
67
- });
68
-
69
- it('names denied privileged access and limits fallback claims to ordinary-user visibility', async () => {
70
- const denied: HangProbeResult = {
71
- status: 'unavailable',
72
- detail: 'sudo: permission denied',
73
- stdout: '',
74
- stderr: '',
75
- };
76
- const { host, calls } = scriptedHost([exited(rootRow), denied, exited(fileObservation), exited(rootRow)]);
77
- const capture = await captureHangDiagnostics(request(), host);
78
- expect(capture.outcome).toBe('incomplete');
79
- expect(capture.text).toContain('sudo: permission denied');
80
- expect(capture.text).toContain('ordinary-user visibility only');
81
- expect(capture.text).toContain('/fixture/held-file');
82
- expect(calls[2]?.file).toBe('lsof');
83
- });
84
-
85
- it('retains partial failed output instead of replacing it with an empty fallback', async () => {
86
- const partial: HangProbeResult = {
87
- status: 'failed',
88
- detail: 'probe output exceeded bound; output is incomplete',
89
- stdout: fileObservation,
90
- stderr: 'read failed',
91
- };
92
- const { host } = scriptedHost([exited(rootRow), partial, exited('', 1), exited(rootRow)]);
93
- const capture = await captureHangDiagnostics(request(), host);
94
- expect(capture.outcome).toBe('incomplete');
95
- expect(capture.text).toContain('Partial privileged lsof output');
96
- expect(capture.text).toContain('/fixture/held-file');
97
- expect(capture.text).toContain('read failed');
98
- });
99
-
100
- it('does not turn an exited root, reused pid, or changed descendant membership into no holders', async () => {
101
- const absent = scriptedHost([exited(unrelatedRow)]);
102
- expect((await captureHangDiagnostics(request(), absent.host)).outcome).toBe('incomplete');
103
- expect(absent.calls).toHaveLength(1);
104
- for (const after of [rootRow.replace(STARTED, 'Thu Oct 15 12:35:00 2026'), `${rootRow}\n${childRow}`]) {
105
- const { host } = scriptedHost([exited(rootRow), exited('', 1), exited(after)]);
106
- const capture = await captureHangDiagnostics(request(), host);
107
- expect(capture.outcome).toBe('incomplete');
108
- expect(capture.text).toContain('identities or membership changed');
109
- }
110
- });
111
-
112
- it('names process probe failures and malformed census output without throwing', async () => {
113
- for (const result of [
114
- exited('', 1, 'ps: denied'),
115
- exited('not a ps row'),
116
- { status: 'timed-out', detail: 'ps deadline', stdout: '', stderr: '' } satisfies HangProbeResult,
117
- ]) {
118
- const { host } = scriptedHost([result]);
119
- const capture = await captureHangDiagnostics(request(), host);
120
- expect(capture.outcome).toBe('incomplete');
121
- expect(capture.text).toContain('ps before');
122
- }
123
- const throwing: HangDiagnosticHost = {
124
- platform: 'darwin',
125
- async probe() {
126
- throw new Error('probe rejected');
127
- },
128
- };
129
- expect((await captureHangDiagnostics(request(), throwing)).text).toContain('probe rejected');
130
- });
131
-
132
- it('returns at its own deadline even when the probe never answers, and starts no later probe', async () => {
133
- let calls = 0;
134
- let signal: AbortSignal | undefined;
135
- const unresponsive: HangDiagnosticHost = {
136
- platform: 'darwin',
137
- probe(_file, _args, _timeoutMs, captureSignal) {
138
- calls += 1;
139
- signal = captureSignal;
140
- // An unanswered process boundary; the capture must not rely on its cooperation.
141
- return new Promise<HangProbeResult>(() => {});
142
- },
143
- };
144
- // The probe is held off by construction, so the 1 ms deadline timer is the only event that can end this capture.
145
- const capture = await captureHangDiagnostics({ ...request(), deadlineMs: 1 }, unresponsive);
146
- expect(capture.outcome).toBe('incomplete');
147
- expect(capture.text).toContain('1ms deadline reached during ps before');
148
- expect(signal?.aborted).toBe(true);
149
- expect(calls).toBe(1);
150
- });
151
-
152
- it('cancels a pending probe when its progress generation ends without starting another', async () => {
153
- const controller = new AbortController();
154
- let calls = 0;
155
- let seen: AbortSignal | undefined;
156
- const pending: HangDiagnosticHost = {
157
- platform: 'darwin',
158
- probe(_file, _args, _timeoutMs, signal) {
159
- calls += 1;
160
- seen = signal;
161
- return new Promise<HangProbeResult>(() => {});
162
- },
163
- };
164
- const collecting = captureHangDiagnostics({ ...request(), signal: controller.signal }, pending);
165
- expect(calls).toBe(1);
166
- controller.abort();
167
- const capture = await collecting;
168
- expect(capture.outcome).toBe('incomplete');
169
- expect(capture.text).toContain('Capture cancelled during ps before');
170
- expect(seen?.aborted).toBe(true);
171
- expect(calls).toBe(1);
172
- });
173
-
174
- it('starts no probe for a generation already cancelled', async () => {
175
- const controller = new AbortController();
176
- controller.abort();
177
- const { host, calls } = scriptedHost([]);
178
- const capture = await captureHangDiagnostics({ ...request(), signal: controller.signal }, host);
179
- expect(capture.outcome).toBe('incomplete');
180
- expect(capture.text).toContain('Capture cancelled');
181
- expect(calls).toHaveLength(0);
182
- });
183
-
184
- it('starts no process probe after the pre-expiry window or with no remaining budget', async () => {
185
- for (const bounds of [{ expiresAtMs: Date.now() - 1 }, { deadlineMs: 0 }]) {
186
- const { host, calls } = scriptedHost([]);
187
- const capture = await captureHangDiagnostics({ ...request(), ...bounds }, host);
188
- expect(capture.outcome).toBe('incomplete');
189
- expect(capture.text).toContain('no probe started');
190
- expect(calls).toEqual([]);
191
- }
192
- });
193
-
194
- it('keeps process-only visibility explicit on platforms without the Darwin open-file probe', async () => {
195
- const { host, calls } = scriptedHost([exited(rootRow), exited(rootRow)]);
196
- const capture = await captureHangDiagnostics(request(), { ...host, platform: 'linux' });
197
- expect(capture.outcome).toBe('holders');
198
- expect(capture.text).toContain('observations below name processes only');
199
- expect(calls.map((call) => call.file)).toEqual(['ps', 'ps']);
200
- });
201
-
202
- it('captures a real child, its grandchild, and an actually open file before either is stopped', async () => {
203
- const directory = await mkdtemp(join(tmpdir(), 'hang-snapshot-'));
204
- const held = join(directory, 'held');
205
- await writeFile(held, 'owned file\n');
206
- const child = Bun.spawn(
207
- [
208
- process.execPath,
209
- '-e',
210
- `
211
- const fs = require('node:fs');
212
- fs.openSync(process.env.HANG_SNAPSHOT_FILE, 'r');
213
- const descendant = Bun.spawn([process.execPath, '-e', "console.log('ready'); process.stdin.resume()"], {
214
- stdin: 'pipe', stdout: 'pipe', stderr: 'ignore',
215
- });
216
- const ready = descendant.stdout.getReader();
217
- await ready.read();
218
- ready.releaseLock();
219
- console.log('PID=' + descendant.pid);
220
- process.stdin.resume();
221
- `,
222
- ],
223
- {
224
- env: { ...process.env, HANG_SNAPSHOT_FILE: held },
225
- stdin: 'pipe',
226
- stdout: 'pipe',
227
- stderr: 'pipe',
228
- },
229
- );
230
- let descendant: number | undefined;
231
- const failures: unknown[] = [];
232
- try {
233
- const reader = child.stdout.pipeThrough(new TextDecoderStream()).getReader();
234
- let text = '';
235
- try {
236
- // The first complete line is the readiness event; a child that exits first ends the stream instead. No timer
237
- // ends this loop.
238
- for (;;) {
239
- const chunk = await reader.read();
240
- if (chunk.done) throw new Error('child stdout ended before a complete PID line');
241
- text += chunk.value;
242
- if (text.includes('\n')) break;
243
- }
244
- } catch (cause) {
245
- throw new Error(`PID readiness failed; observed ${JSON.stringify(text)}`, { cause });
246
- } finally {
247
- reader.releaseLock();
248
- }
249
- const line = text.slice(0, text.indexOf('\n'));
250
- const match = /^PID=(\d+)$/.exec(line);
251
- descendant = match === null ? Number.NaN : Number(match[1]);
252
- expect(
253
- Number.isSafeInteger(descendant) && descendant > 0,
254
- `expected a tagged PID line, observed ${JSON.stringify(line)}`,
255
- ).toBe(true);
256
- // The capture budget (`HANG_CAPTURE_MS`) and probe limits are product constants this test cannot set, so the
257
- // clock is stopped while the real `ps` and `lsof` run: each ends when it exits; no timer cuts it short.
258
- jest.useFakeTimers();
259
- const capture = await captureHangDiagnostics({ ...request(), pid: child.pid, pgid: null }).finally(() =>
260
- jest.useRealTimers(),
261
- );
262
- expect(capture.outcome).toBe('holders');
263
- expect(capture.text).toContain(String(child.pid));
264
- expect(capture.text).toContain(String(descendant));
265
- if (process.platform === 'darwin') expect(capture.text).toContain(held);
266
- } catch (error) {
267
- failures.push(error);
268
- }
269
- if (descendant !== undefined && Number.isSafeInteger(descendant) && descendant > 0) {
270
- try {
271
- process.kill(descendant, 'SIGKILL');
272
- } catch (error) {
273
- if (!(error instanceof Error && 'code' in error && error.code === 'ESRCH')) failures.push(error);
274
- }
275
- }
276
- try {
277
- child.kill('SIGKILL');
278
- await child.exited;
279
- } catch (error) {
280
- failures.push(error);
281
- }
282
- try {
283
- await rm(directory, { recursive: true, force: true });
284
- } catch (error) {
285
- failures.push(error);
286
- }
287
- if (failures.length > 0) {
288
- throw new AggregateError(failures, `hang snapshot fixture ${directory} failed`);
289
- }
290
- });
291
- });
@@ -1,139 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
-
3
- import { createRunProgress, withProgressReport } from './progress.js';
4
-
5
- describe('run progress', () => {
6
- it('observes Go package execution and test completions, not build output or heartbeats', () => {
7
- const progress = createRunProgress();
8
- expect(
9
- progress.scan('stdout', '{"Action":"build-output","ImportPath":"example/first","Output":"linking\\n"}\n'),
10
- ).toBe(false);
11
- expect(progress.inFlight()).toEqual([]);
12
- expect(progress.scan('stdout', '{"Action":"start","Package":"example/first"}\n')).toBe(false);
13
- expect(progress.inFlight()).toEqual(['example/first']);
14
- expect(progress.scan('stdout', '{"Action":"run","Package":"example/first","Test":"TestReady"}\n')).toBe(false);
15
- expect(progress.inFlight()).toEqual(['example/first TestReady']);
16
- expect(progress.scan('stdout', '{"Action":"output","Package":"example/first","Output":"...\\n"}\n')).toBe(false);
17
- expect(progress.scan('stdout', '{"Action":"pass","Package":"example/first","Test":"TestReady"}\n')).toBe(true);
18
- expect(progress.scan('stdout', '{"Action":"pass","Package":"example/first"}\n')).toBe(true);
19
- expect(progress.inFlight()).toEqual([]);
20
- expect(
21
- progress.scan('stdout', '{"Action":"build-output","ImportPath":"example/second","Output":"compiling\\n"}\n'),
22
- ).toBe(false);
23
- expect(progress.scan('stdout', '{"Action":"start","Package":"example/second"}\n')).toBe(false);
24
- expect(progress.scan('stdout', '{"Action":"run","Package":"example/second","Test":"TestHang"}\n')).toBe(false);
25
- expect(progress.inFlight()).toEqual(['example/second TestHang']);
26
- });
27
-
28
- it('tracks Go package startup and parallel packages until their terminal reports', () => {
29
- const progress = createRunProgress('go test ./...');
30
- progress.scan('stdout', '{"Action":"start","Package":"first"}\n{"Action":"start","Package":"second"}\n');
31
- expect(progress.inFlight()).toEqual(['first', 'second']);
32
- progress.scan('stdout', '{"Action":"pass","Package":"first"}\n');
33
- expect(progress.inFlight()).toEqual(['second']);
34
- progress.scan('stdout', '{"Action":"fail","Package":"second"}\n');
35
- expect(progress.inFlight()).toEqual([]);
36
- });
37
-
38
- it('buffers split Go events and does not mistake test output for lifecycle events', () => {
39
- const progress = createRunProgress('go test ./...');
40
- expect(progress.scan('stdout', '{"Action":"sta')).toBe(false);
41
- expect(progress.scan('stdout', 'rt","Package":"example"}\n')).toBe(false);
42
- expect(progress.scan('stdout', '{"Action":"run","Package":"example","Test":"TestHang"}\n')).toBe(false);
43
- expect(progress.scan('stdout', '{"Action":"pause","Package":"example","Test":"TestHang"}\n')).toBe(false);
44
- expect(progress.inFlight()).toEqual(['example TestHang']);
45
- expect(progress.scan('stdout', '{"Action":"cont","Package":"example","Test":"TestHang"}\n')).toBe(false);
46
- expect(progress.scan('stdout', '{"Action":"output","Package":"example","Output":"test fake ... ok\\n"}\n')).toBe(
47
- false,
48
- );
49
- expect(progress.scan('stderr', '...\n')).toBe(false);
50
- expect(progress.scan('stderr', '{invalid JSON}\n')).toBe(false);
51
- expect(progress.scan('stdout', '{"Action":"skip","Package":"example","Test":"TestHang"}\n')).toBe(true);
52
- expect(progress.inFlight()).toEqual(['example']);
53
- expect(progress.scan('stdout', '{"Action":"pass","Package":"example"}\n')).toBe(true);
54
- });
55
-
56
- it('counts a nextest status line with its run counter as a finished test, and a SLOW line as none', () => {
57
- const progress = createRunProgress();
58
- expect(progress.scan('stderr', ' SLOW [> 1.000s] (───) nt tests::hangs\n')).toBe(false);
59
- expect(progress.scan('stderr', ' SLOW [> 1.000s] (───) nt tests::slow3\n')).toBe(false);
60
- expect(progress.inFlight()).toEqual(['nt tests::hangs', 'nt tests::slow3']);
61
- expect(progress.scan('stderr', ' PASS [ 2.512s] (2/4) nt tests::slow3\n')).toBe(true);
62
- expect(progress.inFlight()).toEqual(['nt tests::hangs']);
63
- for (const finished of [
64
- ' FAIL [ 0.443s] (3/4) nt tests::fails',
65
- ' SIGSEGV [ 0.010s] ( 4/12) nt tests::crash',
66
- ' TRY 2 FAIL [ 0.010s] (5/12) nt tests::flaky',
67
- ' LEAK-FAIL [ 0.010s] (6/12) nt tests::leaky',
68
- ]) {
69
- expect(createRunProgress().scan('stderr', `${finished}\n`)).toBe(true);
70
- }
71
- });
72
-
73
- it('counts libtest result lines and names a test libtest says is still running', () => {
74
- const progress = createRunProgress();
75
- expect(progress.scan('stdout', 'running 3 tests\n')).toBe(false);
76
- expect(progress.scan('stdout', 'test tests::slow has been running for over 60 seconds\n')).toBe(false);
77
- expect(progress.inFlight()).toEqual(['tests::slow']);
78
- expect(progress.scan('stdout', 'test tests::quick ... ok\n')).toBe(true);
79
- expect(progress.scan('stdout', 'test tests::slow ... FAILED\n')).toBe(true);
80
- expect(progress.inFlight()).toEqual([]);
81
- });
82
-
83
- it("counts bun's result lines and each new dot, however the chunks split them", () => {
84
- const progress = createRunProgress();
85
- expect(progress.scan('stderr', '(pass) suite > one [0.02ms]\n')).toBe(true);
86
- expect(progress.scan('stderr', '.')).toBe(true);
87
- expect(progress.scan('stderr', '.')).toBe(true);
88
- // The newline that ends the dots line reports nothing new.
89
- expect(progress.scan('stderr', '\n')).toBe(false);
90
- expect(progress.scan('stderr', '..\n.')).toBe(true);
91
- expect(progress.scan('stderr', '\n\n4 pass\n0 fail\n')).toBe(false);
92
- });
93
-
94
- it('keeps each stream its own partial line', () => {
95
- const progress = createRunProgress();
96
- expect(progress.scan('stderr', ' PASS [ 0.001s] (1/2) nt ')).toBe(false);
97
- expect(progress.scan('stdout', 'unrelated\n')).toBe(false);
98
- expect(progress.scan('stderr', 'tests::split\n')).toBe(true);
99
- });
100
-
101
- it('finds no progress in a heartbeat, a warning, or ANSI-coloured noise', () => {
102
- const progress = createRunProgress();
103
- expect(progress.scan('stdout', 'still waiting...\n')).toBe(false);
104
- expect(progress.scan('stderr', 'warning: slow host\n')).toBe(false);
105
- expect(progress.scan('stderr', '\u001b[33m SLOW\u001b[0m [> 30.000s] (───) nt tests::hangs\n')).toBe(false);
106
- expect(progress.inFlight()).toEqual(['nt tests::hangs']);
107
- expect(progress.scan('stderr', '\u001b[32m PASS\u001b[0m [ 31.000s] (1/1) nt tests::hangs\n')).toBe(true);
108
- expect(progress.inFlight()).toEqual([]);
109
- });
110
- });
111
-
112
- describe('progress report', () => {
113
- it('asks Go for its package execution events without changing its test selection', () => {
114
- expect(withProgressReport('go test -count=1 ./hts/... ./host/...')).toBe(
115
- 'go test -json -count=1 ./hts/... ./host/...',
116
- );
117
- expect(withProgressReport('go test -json -count=1 ./...')).toBe('go test -json -count=1 ./...');
118
- expect(withProgressReport('go test -json=false ./first && go test -count=1 ./second')).toBe(
119
- 'go test -json ./first && go test -json -count=1 ./second',
120
- );
121
- });
122
-
123
- it('asks a lone bun test for dots, keeping the runtime the target named', () => {
124
- expect(withProgressReport('bun test --timeout=0 src')).toBe('bun test --dots --timeout=0 src');
125
- expect(withProgressReport('../x/.runtime/bun test a')).toBe('../x/.runtime/bun test --dots a');
126
- });
127
-
128
- it('leaves a command with no bun, two runners, or dots already chosen unchanged', () => {
129
- for (const command of [
130
- 'cargo nextest run -E all()',
131
- 'bun test a && bun test b',
132
- 'bun test --dots src',
133
- 'bun test --reporter=dots src',
134
- 'node script.js',
135
- ]) {
136
- expect(withProgressReport(command)).toBe(command);
137
- }
138
- });
139
- });