@smoothbricks/nx-plugin 0.5.7 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1097 -360
- package/dist/.build-inputs.json +141 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +22 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +168 -48
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +28 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.js +20 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +35 -38
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +56 -120
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +389 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +23 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +102 -29
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +64 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +72 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +31 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/mbx-pool.js +24 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +10 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +122 -35
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +48 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +89 -20
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts +14 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts.map +1 -0
- package/dist/executors/typescript-emit/emit-overrides.js +24 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +146 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +672 -214
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/managed-files/publish-workflow.js +14 -11
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +514 -47
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +16 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +95 -14
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +173 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +43 -0
- package/src/executors/bounded-exec/cpu-pool.ts +55 -120
- package/src/executors/bounded-exec/executor.ts +442 -260
- package/src/executors/bounded-exec/gateway-lease.ts +94 -35
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +116 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/mbx-pool.ts +48 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +129 -35
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +145 -35
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/emit-overrides.ts +24 -0
- package/src/executors/typescript-emit/executor.ts +186 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +788 -224
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/managed-files/publish-workflow.ts +20 -15
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +92 -41
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +124 -99
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/all-verdicts/executor.test.ts +0 -135
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3321
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import fc from 'fast-check';
|
|
3
|
-
import {
|
|
4
|
-
extractInlineLocalBlocks,
|
|
5
|
-
INLINE_LOCAL_BEGIN,
|
|
6
|
-
INLINE_LOCAL_END,
|
|
7
|
-
LOCAL_SECTION_MARKER,
|
|
8
|
-
reinsertInlineLocalBlocks,
|
|
9
|
-
splitLocalSection,
|
|
10
|
-
} from './managed-content.js';
|
|
11
|
-
|
|
12
|
-
const MANAGED = '# managed content\npath merge=driver\n';
|
|
13
|
-
|
|
14
|
-
describe('managed-file local sections', () => {
|
|
15
|
-
it('content without a marker is entirely managed', () => {
|
|
16
|
-
const { managed, localTail } = splitLocalSection(MANAGED);
|
|
17
|
-
expect(managed).toBe(MANAGED);
|
|
18
|
-
expect(localTail).toBe('');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('everything from the marker onward is the repo-owned tail', () => {
|
|
22
|
-
const tail = `${LOCAL_SECTION_MARKER}\ncustom/*.jsonl merge=custom-log\n`;
|
|
23
|
-
const { managed, localTail } = splitLocalSection(`${MANAGED}\n${tail}`);
|
|
24
|
-
expect(managed).toBe(`${MANAGED}\n`);
|
|
25
|
-
expect(localTail).toBe(tail);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('a tail directly after the managed content tolerates the separating newline', () => {
|
|
29
|
-
// The compare rule accepts `managed === content + '\n'` when a tail exists,
|
|
30
|
-
// so update → check round-trips as unchanged.
|
|
31
|
-
const written = `${MANAGED}\n${LOCAL_SECTION_MARKER}\nextra\n`;
|
|
32
|
-
const { managed, localTail } = splitLocalSection(written);
|
|
33
|
-
expect(managed).toBe(`${MANAGED}\n`);
|
|
34
|
-
expect(localTail.startsWith(LOCAL_SECTION_MARKER)).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe('managed-file inline local blocks', () => {
|
|
39
|
-
it('content with no inline markers extracts as fully managed, no blocks', () => {
|
|
40
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(MANAGED);
|
|
41
|
-
expect(withoutInline).toBe(MANAGED);
|
|
42
|
-
expect(blocks).toEqual([]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('a wrapped block is extracted and removed, anchored on the preceding line', () => {
|
|
46
|
-
const current = ['a:', ' - one', ' - two', INLINE_LOCAL_BEGIN, ' - repo-owned', INLINE_LOCAL_END, 'b:'].join(
|
|
47
|
-
'\n',
|
|
48
|
-
);
|
|
49
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(current);
|
|
50
|
-
expect(withoutInline).toBe(['a:', ' - one', ' - two', 'b:'].join('\n'));
|
|
51
|
-
expect(blocks).toEqual([{ anchor: ' - two', lines: ' - repo-owned' }]);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('multiple blocks each anchor to their own preceding line', () => {
|
|
55
|
-
const current = [
|
|
56
|
-
'x',
|
|
57
|
-
INLINE_LOCAL_BEGIN,
|
|
58
|
-
'first',
|
|
59
|
-
INLINE_LOCAL_END,
|
|
60
|
-
'y',
|
|
61
|
-
INLINE_LOCAL_BEGIN,
|
|
62
|
-
'second',
|
|
63
|
-
INLINE_LOCAL_END,
|
|
64
|
-
'z',
|
|
65
|
-
].join('\n');
|
|
66
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(current);
|
|
67
|
-
expect(withoutInline).toBe(['x', 'y', 'z'].join('\n'));
|
|
68
|
-
expect(blocks).toEqual([
|
|
69
|
-
{ anchor: 'x', lines: 'first' },
|
|
70
|
-
{ anchor: 'y', lines: 'second' },
|
|
71
|
-
]);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('a begin marker with no preceding line throws rather than silently dropping content', () => {
|
|
75
|
-
const current = [INLINE_LOCAL_BEGIN, 'orphan', INLINE_LOCAL_END].join('\n');
|
|
76
|
-
expect(() => extractInlineLocalBlocks(current)).toThrow(/no preceding anchor/);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('an unterminated begin marker throws rather than silently dropping content', () => {
|
|
80
|
-
const current = ['a', INLINE_LOCAL_BEGIN, 'unterminated'].join('\n');
|
|
81
|
-
expect(() => extractInlineLocalBlocks(current)).toThrow(/no matching/);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('reinserting into fresh content with no blocks is a no-op', () => {
|
|
85
|
-
expect(reinsertInlineLocalBlocks(MANAGED, [])).toBe(MANAGED);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('reinserting splices the block back after its anchor in freshly rendered content', () => {
|
|
89
|
-
const fresh = ['a:', ' - one', ' - two', 'b:'].join('\n');
|
|
90
|
-
const result = reinsertInlineLocalBlocks(fresh, [{ anchor: ' - two', lines: ' - repo-owned' }]);
|
|
91
|
-
expect(result).toBe(
|
|
92
|
-
['a:', ' - one', ' - two', INLINE_LOCAL_BEGIN, ' - repo-owned', INLINE_LOCAL_END, 'b:'].join('\n'),
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('fences a TypeScript managed file with // markers and re-emits the same prefix', () => {
|
|
97
|
-
// setup-environment.ts is a managed TypeScript file; `# smoo-local-begin`
|
|
98
|
-
// is not a comment there. A repo-owned block (the dev-links re-link after
|
|
99
|
-
// install) used `//` fences that the update never recognised and dropped.
|
|
100
|
-
const current = [
|
|
101
|
-
'const a = 1;',
|
|
102
|
-
'// smoo-local-begin',
|
|
103
|
-
'linkDevPackages();',
|
|
104
|
-
'// smoo-local-end',
|
|
105
|
-
'const b = 2;',
|
|
106
|
-
].join('\n');
|
|
107
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(current);
|
|
108
|
-
expect(withoutInline).toBe(['const a = 1;', 'const b = 2;'].join('\n'));
|
|
109
|
-
expect(blocks).toEqual([{ anchor: 'const a = 1;', lines: 'linkDevPackages();', markerPrefix: '//' }]);
|
|
110
|
-
expect(reinsertInlineLocalBlocks(['const a = 1;', 'const b = 3;'].join('\n'), blocks)).toBe(
|
|
111
|
-
['const a = 1;', '// smoo-local-begin', 'linkDevPackages();', '// smoo-local-end', 'const b = 3;'].join('\n'),
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('preserves marker indentation when refreshing nested configuration', () => {
|
|
116
|
-
const markerIndent = ' ';
|
|
117
|
-
const current = [
|
|
118
|
-
'patterns:',
|
|
119
|
-
" - '*.html'",
|
|
120
|
-
`${markerIndent}${INLINE_LOCAL_BEGIN}`,
|
|
121
|
-
" - '!**/templates/*.html'",
|
|
122
|
-
`${markerIndent}${INLINE_LOCAL_END}`,
|
|
123
|
-
].join('\n');
|
|
124
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(current);
|
|
125
|
-
expect(reinsertInlineLocalBlocks(withoutInline, blocks)).toBe(current);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("reinserting refuses when the anchor no longer appears — never silently drops the repo's customization", () => {
|
|
129
|
-
const fresh = ['a:', ' - one', 'b:'].join('\n'); // ' - two' is gone
|
|
130
|
-
expect(() => reinsertInlineLocalBlocks(fresh, [{ anchor: ' - two', lines: ' - repo-owned' }])).toThrow(
|
|
131
|
-
/matches no line/,
|
|
132
|
-
);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('reinserting refuses an ambiguous multiply occurring anchor', () => {
|
|
136
|
-
const fresh = ['anchor', 'middle', 'anchor'].join('\n');
|
|
137
|
-
expect(() => reinsertInlineLocalBlocks(fresh, [{ anchor: 'anchor', lines: 'repo-owned' }])).toThrow(
|
|
138
|
-
/matches 2 lines/,
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('property: extract then reinsert round-trips to the original for unique, single-occurrence anchors', () => {
|
|
143
|
-
// Lines that can serve as anchors: non-empty, not a marker, and each drawn
|
|
144
|
-
// from a small alphabet so uniqueness is checkable — the round-trip only
|
|
145
|
-
// holds when an anchor line occurs exactly once in the managed section
|
|
146
|
-
// because ambiguous anchors are rejected rather than selecting one.
|
|
147
|
-
const linePool = fc.constantFrom('alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta');
|
|
148
|
-
fc.assert(
|
|
149
|
-
fc.property(
|
|
150
|
-
fc.uniqueArray(linePool, { minLength: 1, maxLength: 6 }),
|
|
151
|
-
fc.array(fc.string(), { maxLength: 3 }),
|
|
152
|
-
(anchors, blockLinesFlat) => {
|
|
153
|
-
const blockLines = blockLinesFlat.length > 0 ? [blockLinesFlat.join('|') || 'x'] : ['x'];
|
|
154
|
-
const fresh = anchors.join('\n');
|
|
155
|
-
const withBlocks = anchors
|
|
156
|
-
.map((anchor) => [anchor, INLINE_LOCAL_BEGIN, ...blockLines, INLINE_LOCAL_END].join('\n'))
|
|
157
|
-
.join('\n');
|
|
158
|
-
const { withoutInline, blocks } = extractInlineLocalBlocks(withBlocks);
|
|
159
|
-
expect(withoutInline).toBe(fresh);
|
|
160
|
-
const reinserted = reinsertInlineLocalBlocks(fresh, blocks);
|
|
161
|
-
expect(reinserted).toBe(withBlocks);
|
|
162
|
-
},
|
|
163
|
-
),
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { dirname, join } from 'node:path';
|
|
6
|
-
import { FsTree, flushChanges } from 'nx/src/generators/tree.js';
|
|
7
|
-
import typia from 'typia';
|
|
8
|
-
import { applyWorkspaceBoundedTestTargetPolicy } from '../bounded-test-policy.js';
|
|
9
|
-
import { managedAssetsRoot } from '../managed-assets.js';
|
|
10
|
-
import { applyPackageTargetPolicy } from '../package-target-policy.js';
|
|
11
|
-
import { applyReleaseConfigPolicy } from '../release-config-policy.js';
|
|
12
|
-
import { renderTypecheckTestFiles } from '../typecheck-test-policy.js';
|
|
13
|
-
import { applyWorkspaceConfigPolicy } from '../workspace-config-policy.js';
|
|
14
|
-
import { biomeHookArguments, formatJsonWithBiome, jsonFileText, writeJsonFile } from './managed-format.js';
|
|
15
|
-
import { inspectManagedPaths } from './paths.js';
|
|
16
|
-
import { assertNoManagedConflicts, stageManagedFiles } from './tree.js';
|
|
17
|
-
|
|
18
|
-
/** What a consumer's repository formats JSON as: the shape this repository's own biome.json declares. */
|
|
19
|
-
const SPACED_BIOME_CONFIG = {
|
|
20
|
-
formatter: { enabled: true, indentStyle: 'space', indentWidth: 2, lineWidth: 120, lineEnding: 'lf' },
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
async function makeRepo(config: object = SPACED_BIOME_CONFIG): Promise<string> {
|
|
24
|
-
const root = await mkdtemp(join(tmpdir(), 'smoo-managed-json-'));
|
|
25
|
-
await writeFile(join(root, 'biome.json'), `${JSON.stringify(config)}\n`);
|
|
26
|
-
return root;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function writeSourceJson(path: string, value: unknown): Promise<void> {
|
|
30
|
-
await mkdir(dirname(path), { recursive: true });
|
|
31
|
-
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The exact command `.git-format-staged.yml` runs on commit for a `*.json` file,
|
|
36
|
-
* read from the managed config and run as a subprocess, so the oracle is the
|
|
37
|
-
* commit hook itself rather than a second call into the code under test.
|
|
38
|
-
*/
|
|
39
|
-
async function hookCommand(): Promise<string> {
|
|
40
|
-
const config = typia.assert<{ formatters: { biome: { command: string } } }>(
|
|
41
|
-
Bun.YAML.parse(await readFile(join(managedAssetsRoot, 'raw', 'git-format-staged.yml'), 'utf8')),
|
|
42
|
-
);
|
|
43
|
-
return config.formatters.biome.command;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function hookOutput(root: string, path: string, text: string): Promise<string> {
|
|
47
|
-
const command = (await hookCommand()).replaceAll('{}', path);
|
|
48
|
-
const child = spawnSync('sh', ['-c', command], { cwd: root, input: text, encoding: 'utf8' });
|
|
49
|
-
expect(child.status).toBe(0);
|
|
50
|
-
return child.stdout;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function theHookWouldRewrite(root: string, path: string): Promise<boolean> {
|
|
54
|
-
const text = await readFile(join(root, path), 'utf8');
|
|
55
|
-
return (await hookOutput(root, path, text)) !== text;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
describe('JSON that smoo writes into a managed repository', () => {
|
|
59
|
-
it('keeps a short array on one line, the way the commit hook leaves it', async () => {
|
|
60
|
-
const root = await makeRepo();
|
|
61
|
-
try {
|
|
62
|
-
const text = jsonFileText(join(root, 'tsconfig.test.json'), { compilerOptions: { types: ['bun'] } });
|
|
63
|
-
|
|
64
|
-
expect(text).toBe('{\n "compilerOptions": {\n "types": ["bun"]\n }\n}\n');
|
|
65
|
-
} finally {
|
|
66
|
-
await rm(root, { recursive: true, force: true });
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('is a fixed point of the commit hook', async () => {
|
|
71
|
-
const root = await makeRepo();
|
|
72
|
-
try {
|
|
73
|
-
const value = {
|
|
74
|
-
extends: '../tsconfig.base.json',
|
|
75
|
-
compilerOptions: { types: ['bun'], lib: ['es2024', 'dom'] },
|
|
76
|
-
include: ['src/**/*.test.ts', 'src/**/*.spec.ts', 'src/**/__tests__/**/*.ts', 'src/**/__tests__/**/*.tsx'],
|
|
77
|
-
references: [{ path: '../packages/cli/tsconfig.lib.json' }],
|
|
78
|
-
};
|
|
79
|
-
const text = jsonFileText(join(root, 'tooling/tsconfig.test.json'), value);
|
|
80
|
-
|
|
81
|
-
expect(await hookOutput(root, 'tooling/tsconfig.test.json', text)).toBe(text);
|
|
82
|
-
expect(JSON.parse(text)).toEqual(value);
|
|
83
|
-
} finally {
|
|
84
|
-
await rm(root, { recursive: true, force: true });
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("obeys the consumer's own Biome configuration", async () => {
|
|
89
|
-
const root = await makeRepo({ formatter: { indentStyle: 'tab', lineWidth: 20 } });
|
|
90
|
-
try {
|
|
91
|
-
const text = jsonFileText(join(root, 'package.json'), { files: ['dist', 'src', 'README.md'] });
|
|
92
|
-
|
|
93
|
-
expect(text).toBe('{\n\t"files": [\n\t\t"dist",\n\t\t"src",\n\t\t"README.md"\n\t]\n}\n');
|
|
94
|
-
} finally {
|
|
95
|
-
await rm(root, { recursive: true, force: true });
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('formats a file whose directory does not exist yet', async () => {
|
|
100
|
-
const root = await makeRepo();
|
|
101
|
-
try {
|
|
102
|
-
const text = jsonFileText(join(root, 'packages/new/deep/tsconfig.json'), { include: ['src'] });
|
|
103
|
-
|
|
104
|
-
expect(text).toBe('{\n "include": ["src"]\n}\n');
|
|
105
|
-
} finally {
|
|
106
|
-
await rm(root, { recursive: true, force: true });
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('writes the formatted bytes to the file', async () => {
|
|
111
|
-
const root = await makeRepo();
|
|
112
|
-
try {
|
|
113
|
-
writeJsonFile(join(root, 'nx.json'), { plugins: ['@smoothbricks/nx-plugin'] });
|
|
114
|
-
|
|
115
|
-
expect(await readFile(join(root, 'nx.json'), 'utf8')).toBe('{\n "plugins": ["@smoothbricks/nx-plugin"]\n}\n');
|
|
116
|
-
expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
|
|
117
|
-
} finally {
|
|
118
|
-
await rm(root, { recursive: true, force: true });
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('runs the command the managed commit hook runs', async () => {
|
|
123
|
-
expect(`biome ${biomeHookArguments('{}').join(' ')}`).toBe((await hookCommand()).replaceAll("'", ''));
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('refuses to write what a Biome that rejects the repository configuration returned', async () => {
|
|
127
|
-
const root = await makeRepo({ formatter: { lineWidth: 'wide' } });
|
|
128
|
-
try {
|
|
129
|
-
expect(() => jsonFileText(join(root, 'package.json'), { name: 'x' })).toThrow(/lineWidth/);
|
|
130
|
-
} finally {
|
|
131
|
-
await rm(root, { recursive: true, force: true });
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('passes the text through where no Biome is installed: that tree has no hook output to agree with', async () => {
|
|
136
|
-
const root = await makeRepo();
|
|
137
|
-
const path = process.env.PATH;
|
|
138
|
-
try {
|
|
139
|
-
process.env.PATH = '';
|
|
140
|
-
const text = '{"a":[1]}\n';
|
|
141
|
-
|
|
142
|
-
expect(formatJsonWithBiome(join(root, 'a.json'), text)).toBe(text);
|
|
143
|
-
} finally {
|
|
144
|
-
if (path === undefined) delete process.env.PATH;
|
|
145
|
-
else process.env.PATH = path;
|
|
146
|
-
await rm(root, { recursive: true, force: true });
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('every update step that rewrites a JSON file leaves it as the commit hook would', () => {
|
|
152
|
-
it('nx.json through the workspace config policy', async () => {
|
|
153
|
-
const root = await makeRepo();
|
|
154
|
-
try {
|
|
155
|
-
await writeSourceJson(join(root, 'nx.json'), {
|
|
156
|
-
plugins: [],
|
|
157
|
-
targetDefaults: { build: { cache: false, dependsOn: ['^build'] } },
|
|
158
|
-
namedInputs: { default: ['{projectRoot}/**/*'] },
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
expect(applyWorkspaceConfigPolicy(root)).toBe(true);
|
|
162
|
-
expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
|
|
163
|
-
} finally {
|
|
164
|
-
await rm(root, { recursive: true, force: true });
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('nx.json through the release config policy', async () => {
|
|
169
|
-
const root = await makeRepo();
|
|
170
|
-
try {
|
|
171
|
-
await writeSourceJson(join(root, 'nx.json'), { namedInputs: { default: ['{projectRoot}/**/*'] } });
|
|
172
|
-
|
|
173
|
-
expect(applyReleaseConfigPolicy(root)).toBe(true);
|
|
174
|
-
expect(await theHookWouldRewrite(root, 'nx.json')).toBe(false);
|
|
175
|
-
} finally {
|
|
176
|
-
await rm(root, { recursive: true, force: true });
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('package.json through the package target policy', async () => {
|
|
181
|
-
const root = await makeRepo();
|
|
182
|
-
try {
|
|
183
|
-
await writeSourceJson(join(root, 'package.json'), {
|
|
184
|
-
name: '@scope/root',
|
|
185
|
-
private: true,
|
|
186
|
-
workspaces: ['packages/*'],
|
|
187
|
-
});
|
|
188
|
-
await writeSourceJson(join(root, 'packages/lib/package.json'), {
|
|
189
|
-
name: '@scope/lib',
|
|
190
|
-
files: ['dist'],
|
|
191
|
-
scripts: { 'build:ts': 'nx run lib:build:ts' },
|
|
192
|
-
nx: {
|
|
193
|
-
name: 'lib',
|
|
194
|
-
targets: {
|
|
195
|
-
'build:ts': {
|
|
196
|
-
executor: 'nx:run-commands',
|
|
197
|
-
options: { command: 'tsc --build tsconfig.lib.json', cwd: '{projectRoot}' },
|
|
198
|
-
},
|
|
199
|
-
build: { executor: 'nx:noop', dependsOn: ['^build', 'build:ts'] },
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
expect(applyPackageTargetPolicy(root)).toBe(true);
|
|
205
|
-
expect(await theHookWouldRewrite(root, 'packages/lib/package.json')).toBe(false);
|
|
206
|
-
} finally {
|
|
207
|
-
await rm(root, { recursive: true, force: true });
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('package.json through the bounded test target policy', async () => {
|
|
212
|
-
const root = await makeRepo();
|
|
213
|
-
try {
|
|
214
|
-
await writeSourceJson(join(root, 'package.json'), {
|
|
215
|
-
name: '@scope/root',
|
|
216
|
-
private: true,
|
|
217
|
-
workspaces: ['packages/*'],
|
|
218
|
-
});
|
|
219
|
-
await writeSourceJson(join(root, 'packages/app/package.json'), {
|
|
220
|
-
name: '@scope/app',
|
|
221
|
-
files: ['dist'],
|
|
222
|
-
scripts: { test: 'bun test --pass-with-no-tests' },
|
|
223
|
-
nx: { name: 'app' },
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
expect(applyWorkspaceBoundedTestTargetPolicy(root)).toBe(true);
|
|
227
|
-
expect(await theHookWouldRewrite(root, 'packages/app/package.json')).toBe(false);
|
|
228
|
-
} finally {
|
|
229
|
-
await rm(root, { recursive: true, force: true });
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
describe('tsconfig.test.json the managed generator writes', () => {
|
|
235
|
-
it('is what the commit hook would leave, so the workflow commit lints clean without the hook', async () => {
|
|
236
|
-
const root = await makeRepo();
|
|
237
|
-
try {
|
|
238
|
-
await writeSourceJson(join(root, 'package.json'), {
|
|
239
|
-
name: '@scope/root',
|
|
240
|
-
private: true,
|
|
241
|
-
workspaces: ['packages/*'],
|
|
242
|
-
});
|
|
243
|
-
await writeSourceJson(join(root, 'tsconfig.base.json'), { compilerOptions: {} });
|
|
244
|
-
await writeSourceJson(join(root, 'packages/app/package.json'), {
|
|
245
|
-
name: '@scope/app',
|
|
246
|
-
scripts: { test: 'bun test' },
|
|
247
|
-
});
|
|
248
|
-
await mkdir(join(root, 'packages/app/src'), { recursive: true });
|
|
249
|
-
await writeFile(join(root, 'packages/app/src/app.test.ts'), 'export {};\n');
|
|
250
|
-
|
|
251
|
-
const tree = new FsTree(root, false);
|
|
252
|
-
const files = renderTypecheckTestFiles(tree);
|
|
253
|
-
assertNoManagedConflicts(
|
|
254
|
-
stageManagedFiles(
|
|
255
|
-
tree,
|
|
256
|
-
files,
|
|
257
|
-
inspectManagedPaths(
|
|
258
|
-
root,
|
|
259
|
-
files.map((file) => file.target),
|
|
260
|
-
),
|
|
261
|
-
),
|
|
262
|
-
);
|
|
263
|
-
flushChanges(root, tree.listChanges());
|
|
264
|
-
|
|
265
|
-
expect(await readFile(join(root, 'packages/app/tsconfig.test.json'), 'utf8')).toContain('"types": ["bun"]');
|
|
266
|
-
expect(await theHookWouldRewrite(root, 'packages/app/tsconfig.test.json')).toBe(false);
|
|
267
|
-
} finally {
|
|
268
|
-
await rm(root, { recursive: true, force: true });
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe('the Biome smoo runs', () => {
|
|
274
|
-
async function repoWithBiome(script: string): Promise<string> {
|
|
275
|
-
const root = await makeRepo();
|
|
276
|
-
await mkdir(join(root, 'node_modules/.bin'), { recursive: true });
|
|
277
|
-
await writeFile(join(root, 'node_modules/.bin/biome'), `#!/bin/sh\n${script}\n`);
|
|
278
|
-
await chmod(join(root, 'node_modules/.bin/biome'), 0o755);
|
|
279
|
-
return root;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
it("is the repository's own, found above the file, before the one on PATH", async () => {
|
|
283
|
-
const root = await repoWithBiome('echo LOCAL');
|
|
284
|
-
try {
|
|
285
|
-
expect(formatJsonWithBiome(join(root, 'packages/app/package.json'), '{}\n')).toBe('LOCAL\n');
|
|
286
|
-
} finally {
|
|
287
|
-
await rm(root, { recursive: true, force: true });
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
it('is an error when it exits non-zero, with what it said', async () => {
|
|
292
|
-
const root = await repoWithBiome('echo broken config >&2; exit 3');
|
|
293
|
-
try {
|
|
294
|
-
expect(() => formatJsonWithBiome(join(root, 'a.json'), '{}\n')).toThrow(/exited 3[\s\S]*broken config/);
|
|
295
|
-
} finally {
|
|
296
|
-
await rm(root, { recursive: true, force: true });
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
it('is an error when it answers nothing to real input, never an empty file', async () => {
|
|
301
|
-
const root = await repoWithBiome('exit 0');
|
|
302
|
-
try {
|
|
303
|
-
expect(() => formatJsonWithBiome(join(root, 'a.json'), '{}\n')).toThrow(/returned no content/);
|
|
304
|
-
} finally {
|
|
305
|
-
await rm(root, { recursive: true, force: true });
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
});
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir, userInfo } from 'node:os';
|
|
5
|
-
import { dirname, join } from 'node:path';
|
|
6
|
-
import { managedAssetsRoot } from '../managed-assets.js';
|
|
7
|
-
|
|
8
|
-
interface RepoPathFixture {
|
|
9
|
-
readonly root: string;
|
|
10
|
-
readonly helper: string;
|
|
11
|
-
readonly home: string;
|
|
12
|
-
readonly venv: string;
|
|
13
|
-
readonly installed: string;
|
|
14
|
-
readonly tools: string;
|
|
15
|
-
readonly entries: string[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function executable(path: string, marker: string): Promise<void> {
|
|
19
|
-
await mkdir(dirname(path), { recursive: true });
|
|
20
|
-
await writeFile(path, `#!/bin/sh\nprintf '%s\\n' '${marker}'\n`, { mode: 0o755 });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function withRepoPath(run: (fixture: RepoPathFixture) => Promise<void>): Promise<void> {
|
|
24
|
-
const root = await mkdtemp(join(tmpdir(), 'smoo-repo-path-'));
|
|
25
|
-
try {
|
|
26
|
-
const helper = join(root, 'tooling/direnv/repo-path');
|
|
27
|
-
await mkdir(dirname(helper), { recursive: true });
|
|
28
|
-
await writeFile(helper, await readFile(join(managedAssetsRoot, 'raw/tooling/direnv/repo-path')), { mode: 0o755 });
|
|
29
|
-
const tools = join(root, 'system-bin');
|
|
30
|
-
await mkdir(tools);
|
|
31
|
-
// Resolve the script's tools before scrubbing PATH; /usr/bin:/bin is not
|
|
32
|
-
// a coreutils installation on NixOS.
|
|
33
|
-
for (const tool of ['bash', 'dirname']) {
|
|
34
|
-
const resolved = Bun.which(tool);
|
|
35
|
-
if (resolved === null) throw new Error(`${tool} must be on PATH`);
|
|
36
|
-
await symlink(resolved, join(tools, tool));
|
|
37
|
-
}
|
|
38
|
-
const home = join(root, 'private home');
|
|
39
|
-
const venv = join(root, 'active venv');
|
|
40
|
-
const installed = join(home, 'Library/Application Support/dev.cowshed/bin');
|
|
41
|
-
const entries = [
|
|
42
|
-
join(root, 'tooling/direnv/.devenv/profile/bin'),
|
|
43
|
-
join(root, 'tooling/git-hooks'),
|
|
44
|
-
join(root, 'tooling'),
|
|
45
|
-
join(root, 'tooling/node_modules/.bin'),
|
|
46
|
-
join(root, 'node_modules/.bin'),
|
|
47
|
-
];
|
|
48
|
-
await executable(join(entries[0], 'python3'), 'profile-python');
|
|
49
|
-
await executable(join(entries[0], 'cargo'), 'profile-cargo');
|
|
50
|
-
await executable(join(venv, 'bin/python3'), 'venv-python');
|
|
51
|
-
await executable(join(venv, 'bin/cargo'), 'venv-cargo');
|
|
52
|
-
await executable(join(installed, 'cargo'), 'installed-cargo');
|
|
53
|
-
await run({ root, helper, home, venv, installed, tools, entries });
|
|
54
|
-
} finally {
|
|
55
|
-
await rm(root, { recursive: true, force: true });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function helper(fixture: RepoPathFixture, args: readonly string[], virtualEnv?: string, path = fixture.tools) {
|
|
60
|
-
const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, ...args], {
|
|
61
|
-
encoding: 'utf8',
|
|
62
|
-
env: { HOME: fixture.home, PATH: path, ...(virtualEnv === undefined ? {} : { VIRTUAL_ENV: virtualEnv }) },
|
|
63
|
-
});
|
|
64
|
-
expect(result.status).toBe(0);
|
|
65
|
-
expect(result.stderr).toBe('');
|
|
66
|
-
return result.stdout;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function expectModes(fixture: RepoPathFixture, entries: string[], virtualEnv?: string): Promise<void> {
|
|
70
|
-
expect(helper(fixture, ['--print'], virtualEnv)).toBe(`${entries.join('\n')}\n`);
|
|
71
|
-
const githubPath = join(fixture.root, 'github-path');
|
|
72
|
-
await writeFile(githubPath, 'existing-entry\n');
|
|
73
|
-
const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, '--github-path'], {
|
|
74
|
-
encoding: 'utf8',
|
|
75
|
-
env: {
|
|
76
|
-
HOME: fixture.home,
|
|
77
|
-
PATH: fixture.tools,
|
|
78
|
-
GITHUB_PATH: githubPath,
|
|
79
|
-
...(virtualEnv === undefined ? {} : { VIRTUAL_ENV: virtualEnv }),
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
expect(result.status).toBe(0);
|
|
83
|
-
expect(result.stderr).toBe('');
|
|
84
|
-
expect(await readFile(githubPath, 'utf8')).toBe(`existing-entry\n${[...entries].reverse().join('\n')}\n`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
describe('managed repo-path', () => {
|
|
88
|
-
it.each([undefined, ''])('preserves the exact legacy ordering without an active venv (%p)', async (virtualEnv) => {
|
|
89
|
-
await withRepoPath(async (fixture) => {
|
|
90
|
-
await expectModes(fixture, fixture.entries, virtualEnv);
|
|
91
|
-
expect(helper(fixture, [], virtualEnv)).toBe(
|
|
92
|
-
`${[fixture.installed, ...fixture.entries].join(':')}:${fixture.tools}\n`,
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it.each([false, true])(
|
|
98
|
-
'keeps active Python ahead of the profile and installed Cargo first (served=%p)',
|
|
99
|
-
async (served) => {
|
|
100
|
-
await withRepoPath(async (fixture) => {
|
|
101
|
-
if (served) {
|
|
102
|
-
await mkdir(join(fixture.root, '.cowshed'), { recursive: true });
|
|
103
|
-
await writeFile(
|
|
104
|
-
join(fixture.root, '.cowshed/env'),
|
|
105
|
-
`export COWSHED_RUNTIME_LINK=fixture\nexport PATH=${JSON.stringify(fixture.installed)}:$PATH\n`,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
const entries = [join(fixture.venv, 'bin'), ...fixture.entries];
|
|
109
|
-
await expectModes(fixture, entries, fixture.venv);
|
|
110
|
-
const incoming = `${join(fixture.venv, 'bin')}:${fixture.tools}`;
|
|
111
|
-
const path = helper(fixture, [], fixture.venv, incoming).trimEnd();
|
|
112
|
-
expect(path).toBe(`${[fixture.installed, ...entries].join(':')}:${incoming}`);
|
|
113
|
-
const selected = spawnSync(
|
|
114
|
-
join(fixture.tools, 'bash'),
|
|
115
|
-
['-c', 'command -v python3; python3; command -v cargo; cargo'],
|
|
116
|
-
{
|
|
117
|
-
encoding: 'utf8',
|
|
118
|
-
env: { HOME: fixture.home, PATH: path },
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
expect(selected.status).toBe(0);
|
|
122
|
-
expect(selected.stderr).toBe('');
|
|
123
|
-
expect(selected.stdout).toBe(
|
|
124
|
-
`${join(fixture.venv, 'bin/python3')}\nvenv-python\n${join(fixture.installed, 'cargo')}\ninstalled-cargo\n`,
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
it("names this checkout's own shell's evaluated profile, never the checkout's re-pointable link", async () => {
|
|
131
|
-
await withRepoPath(async (fixture) => {
|
|
132
|
-
// The link is what any activation of the checkout last pointed it at; the shell evaluated another profile.
|
|
133
|
-
const evaluated = join(fixture.root, 'evaluated-profile');
|
|
134
|
-
await executable(join(evaluated, 'bin/bun'), 'evaluated-bun');
|
|
135
|
-
await executable(join(fixture.entries[0], 'bun'), 'link-bun');
|
|
136
|
-
const run = (args: readonly string[], devenvRoot: string) => {
|
|
137
|
-
const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper, ...args], {
|
|
138
|
-
encoding: 'utf8',
|
|
139
|
-
env: { HOME: fixture.home, PATH: fixture.tools, DEVENV_ROOT: devenvRoot, DEVENV_PROFILE: evaluated },
|
|
140
|
-
});
|
|
141
|
-
expect(result.stderr).toBe('');
|
|
142
|
-
expect(result.status).toBe(0);
|
|
143
|
-
return result.stdout;
|
|
144
|
-
};
|
|
145
|
-
const own = join(fixture.root, 'tooling/direnv');
|
|
146
|
-
expect(run(['--print'], own).split('\n')[0]).toBe(join(evaluated, 'bin'));
|
|
147
|
-
// Another checkout's shell, inherited by a hook run here, does not name this checkout's profile.
|
|
148
|
-
expect(run(['--print'], join(fixture.root, 'system-bin')).split('\n')[0]).toBe(fixture.entries[0]);
|
|
149
|
-
|
|
150
|
-
const selected = spawnSync(join(fixture.tools, 'bash'), ['-c', 'bun'], {
|
|
151
|
-
encoding: 'utf8',
|
|
152
|
-
env: { HOME: fixture.home, PATH: run([], own).trimEnd() },
|
|
153
|
-
});
|
|
154
|
-
expect(selected.stderr).toBe('');
|
|
155
|
-
expect(selected.stdout).toBe('evaluated-bun\n');
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("reaches the installed cowshed through the real uid's passwd home when the caller passes only PATH", async () => {
|
|
160
|
-
await withRepoPath(async (fixture) => {
|
|
161
|
-
// A formatter or hook that passes { PATH } alone leaves HOME unset; it is not the helper's to require.
|
|
162
|
-
const result = spawnSync(join(fixture.tools, 'bash'), [fixture.helper], {
|
|
163
|
-
encoding: 'utf8',
|
|
164
|
-
env: { PATH: fixture.tools },
|
|
165
|
-
});
|
|
166
|
-
expect(result.stderr).toBe('');
|
|
167
|
-
expect(result.status).toBe(0);
|
|
168
|
-
const installed = join(userInfo().homedir, 'Library/Application Support/dev.cowshed/bin');
|
|
169
|
-
expect(result.stdout).toBe(`${[installed, ...fixture.entries].join(':')}:${fixture.tools}\n`);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|