@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.
- package/README.md +1095 -360
- package/dist/.build-inputs.json +138 -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 +13 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +126 -47
- 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/all-verdicts/executor.d.ts +35 -0
- package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
- package/dist/executors/all-verdicts/executor.js +133 -0
- package/dist/executors/all-verdicts/schema.d.ts +10 -0
- package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
- package/dist/executors/all-verdicts/schema.js +2 -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.d.ts +33 -36
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +54 -119
- 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 +371 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +81 -28
- 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 +43 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +68 -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/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 +4 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
- 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 +40 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +88 -19
- 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/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +164 -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 +676 -215
- 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/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 +75 -48
- 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 +21 -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 +77 -13
- 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 +132 -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/all-verdicts/executor.ts +164 -0
- package/src/executors/all-verdicts/schema.json +22 -0
- package/src/executors/all-verdicts/schema.ts +10 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool.ts +51 -117
- package/src/executors/bounded-exec/executor.ts +423 -259
- package/src/executors/bounded-exec/gateway-lease.ts +82 -33
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +89 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -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 +22 -30
- 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 +137 -34
- 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/executor.ts +205 -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 +792 -225
- 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/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 +68 -45
- 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 +123 -98
- 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/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 -3319
- 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,161 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { chmodSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { codeTime, describeCodeTime, parseWaitRecord, type WaitEdge } from './nextest-code-bound.js';
|
|
8
|
-
|
|
9
|
-
const WRAPPER = fileURLToPath(new URL('./nextest-code-bound.ts', import.meta.url));
|
|
10
|
-
|
|
11
|
-
const start = (pid: number, seq: number, atUs: number): WaitEdge => ({
|
|
12
|
-
kind: 'start',
|
|
13
|
-
pid,
|
|
14
|
-
seq,
|
|
15
|
-
atUs,
|
|
16
|
-
diskClass: 'storage',
|
|
17
|
-
});
|
|
18
|
-
const end = (pid: number, seq: number, atUs: number): WaitEdge => ({ kind: 'end', pid, seq, atUs });
|
|
19
|
-
|
|
20
|
-
describe('lease-wait record', () => {
|
|
21
|
-
it('reads both edge shapes as clients write them and refuses anything else', () => {
|
|
22
|
-
expect(parseWaitRecord('start 7 0 100 storage\nend 7 0 250\n')).toEqual({
|
|
23
|
-
ok: true,
|
|
24
|
-
edges: [start(7, 0, 100), end(7, 0, 250)],
|
|
25
|
-
});
|
|
26
|
-
expect(parseWaitRecord('')).toEqual({ ok: true, edges: [] });
|
|
27
|
-
for (const bad of [
|
|
28
|
-
'start 7 0 100',
|
|
29
|
-
'end 7 0',
|
|
30
|
-
'end 7 0 1 x',
|
|
31
|
-
'begin 7 0 1',
|
|
32
|
-
'end 7 -1 5',
|
|
33
|
-
'start 7 0 1.5 storage',
|
|
34
|
-
]) {
|
|
35
|
-
expect(parseWaitRecord(`${bad}\n`).ok).toBe(false);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe('code time', () => {
|
|
41
|
-
it('is the wall time less every wait', () => {
|
|
42
|
-
const time = codeTime([start(1, 0, 1_000), end(1, 0, 3_000), start(1, 1, 5_000), end(1, 1, 6_000)], 0, 10_000);
|
|
43
|
-
expect(time).toEqual({ wallUs: 10_000, waitUs: 3_000, codeUs: 7_000, waits: 2, open: [], strayEnds: 0 });
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('counts concurrent waits of several processes once, as their union', () => {
|
|
47
|
-
const edges = [
|
|
48
|
-
start(1, 0, 1_000),
|
|
49
|
-
start(2, 0, 2_000),
|
|
50
|
-
end(1, 0, 4_000),
|
|
51
|
-
end(2, 0, 5_000),
|
|
52
|
-
start(1, 1, 4_500),
|
|
53
|
-
end(1, 1, 4_800),
|
|
54
|
-
];
|
|
55
|
-
expect(codeTime(edges, 0, 10_000)).toMatchObject({ waitUs: 4_000, codeUs: 6_000, waits: 3 });
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('clips waits to the test run', () => {
|
|
59
|
-
expect(codeTime([start(1, 0, 0), end(1, 0, 3_000)], 1_000, 5_000)).toMatchObject({ waitUs: 2_000, codeUs: 2_000 });
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('counts a wait that never ended to the end of the test and names it', () => {
|
|
63
|
-
const time = codeTime([start(1, 0, 1_000), end(1, 0, 2_000), start(9, 3, 8_000)], 0, 10_000);
|
|
64
|
-
expect(time).toMatchObject({ waitUs: 3_000, codeUs: 7_000, open: [{ pid: 9, seq: 3, startedUs: 8_000 }] });
|
|
65
|
-
expect(describeCodeTime(time, 30_000_000)).toContain("pid 9's wait 3 never ended");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('counts an end without a start as code time', () => {
|
|
69
|
-
expect(codeTime([end(1, 0, 2_000)], 0, 10_000)).toMatchObject({ waitUs: 0, codeUs: 10_000, strayEnds: 1 });
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('says whether the code time is within its class', () => {
|
|
73
|
-
const time = codeTime([start(1, 0, 0), end(1, 0, 20_000_000)], 0, 45_000_000);
|
|
74
|
-
expect(describeCodeTime(time, 30_000_000)).toBe(
|
|
75
|
-
'nextest-code-bound: code 25.0s of 30.0s, within its class (wall 45.0s less 20.0s waiting for the host disk lease over 1 waits)',
|
|
76
|
-
);
|
|
77
|
-
expect(describeCodeTime(time, 20_000_000)).toStartWith(
|
|
78
|
-
'nextest-code-bound: code 25.0s of 20.0s, OVER its class (a warning)',
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('nextest-code-bound wrapper', () => {
|
|
84
|
-
/**
|
|
85
|
-
* A stand-in test binary: when `wait` is a number, a child process, as a disk-lease client in the
|
|
86
|
-
* test's tree would, records one wait in the record its wrapper names, sleeps `wait` seconds and
|
|
87
|
-
* ends it; then the binary works `work` seconds and exits `status`. The recorded wait starts at
|
|
88
|
-
* the epoch and ends at the largest safe integer, so the wrapper's clipping to the run makes it
|
|
89
|
-
* cover the whole run: the code time is exactly zero however long process startup takes on a
|
|
90
|
-
* busy host. A `null` wait records nothing, so the code time is the whole wall time.
|
|
91
|
-
*/
|
|
92
|
-
const runWrapped = (bound: string, wait: number | null, work: number, status: number) => {
|
|
93
|
-
const root = mkdtempSync(join(tmpdir(), 'nextest-code-bound-'));
|
|
94
|
-
try {
|
|
95
|
-
const binary = join(root, 'fake-test');
|
|
96
|
-
const lease =
|
|
97
|
-
wait === null
|
|
98
|
-
? []
|
|
99
|
-
: [
|
|
100
|
-
'sh -c \'echo "start $$ 0 0 namespace" >> "$COWSHED_LEASE_WAIT_RECORD"; ' +
|
|
101
|
-
`sleep ${wait}; ` +
|
|
102
|
-
`echo "end $$ 0 ${Number.MAX_SAFE_INTEGER}" >> "$COWSHED_LEASE_WAIT_RECORD"'`,
|
|
103
|
-
];
|
|
104
|
-
writeFileSync(
|
|
105
|
-
binary,
|
|
106
|
-
['#!/bin/sh', ...lease, `sleep ${work}`, 'echo "argument $1"', `exit ${status}`].join('\n'),
|
|
107
|
-
);
|
|
108
|
-
chmodSync(binary, 0o755);
|
|
109
|
-
// The wrapper makes its record in its TMPDIR: this case's own root, so the count below is this run's alone.
|
|
110
|
-
const run = spawnSync(WRAPPER, [bound, binary, '--exact'], {
|
|
111
|
-
encoding: 'utf8',
|
|
112
|
-
env: { ...process.env, TMPDIR: root },
|
|
113
|
-
});
|
|
114
|
-
const recordsLeft = readdirSync(root).filter((name) => name.startsWith('cowshed-lease-waits-')).length;
|
|
115
|
-
return { status: run.status, stdout: run.stdout, stderr: run.stderr, recordsLeft };
|
|
116
|
-
} finally {
|
|
117
|
-
rmSync(root, { recursive: true, force: true });
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// Real processes and real time, so the cases sleep as little as proves each verdict: 0.75s in all. No verdict
|
|
122
|
-
// depends on how fast the host starts a process: a covered run's code time is zero, and an uncovered one only grows.
|
|
123
|
-
it('passes a test whose wall time is over its class only by its lease waits', () => {
|
|
124
|
-
const run = runWrapped('0.3', 0.4, 0, 0);
|
|
125
|
-
expect(run.stdout).toContain('argument --exact');
|
|
126
|
-
expect(run.stderr).toMatch(
|
|
127
|
-
/nextest-code-bound: code 0\.0s of 0\.3s, within its class \(wall (?:0\.[4-9]|[1-9]\d*\.\d)s less \d+\.\ds waiting/,
|
|
128
|
-
);
|
|
129
|
-
expect(run.status).toBe(0);
|
|
130
|
-
expect(run.recordsLeft).toBe(0);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('reports code-time verdicts without changing the test exit status', () => {
|
|
134
|
-
for (const { label, bound, wait, work, status, verdict } of [
|
|
135
|
-
{
|
|
136
|
-
label: 'warns of a passing test whose code time is over its class, and still passes it',
|
|
137
|
-
bound: '0.3',
|
|
138
|
-
wait: null,
|
|
139
|
-
work: 0.35,
|
|
140
|
-
status: 0,
|
|
141
|
-
verdict: 'OVER its class (a warning)',
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
label: "keeps a failing test's own exit status and still reports its split",
|
|
145
|
-
bound: '30',
|
|
146
|
-
wait: 0,
|
|
147
|
-
work: 0,
|
|
148
|
-
status: 3,
|
|
149
|
-
verdict: 'within its class',
|
|
150
|
-
},
|
|
151
|
-
]) {
|
|
152
|
-
const run = runWrapped(bound, wait, work, status);
|
|
153
|
-
expect(run.stderr, label).toContain(verdict);
|
|
154
|
-
expect(run.status, label).toBe(status);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('refuses to run without a class', () => {
|
|
159
|
-
expect(spawnSync(WRAPPER, ['soon', '/bin/true'], { encoding: 'utf8' }).status).toBe(2);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, jest } from 'bun:test';
|
|
2
|
-
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
-
import { once } from 'node:events';
|
|
4
|
-
import { mkdir, mkdtemp, readdir, realpath, rm, stat, utimes, writeFile } from 'node:fs/promises';
|
|
5
|
-
import { tmpdir } from 'node:os';
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from './bounded-test-policy.js';
|
|
8
|
-
import {
|
|
9
|
-
EXTRACTED_BINARIES_METADATA,
|
|
10
|
-
EXTRACTED_CARGO_METADATA,
|
|
11
|
-
EXTRACTED_TARGET_DIR,
|
|
12
|
-
ensureNextestArchiveExtracted,
|
|
13
|
-
NEXTEST_EXTRACTION_DIRECTORY,
|
|
14
|
-
type NextestArchiveExtractor,
|
|
15
|
-
type NextestExtractionEvent,
|
|
16
|
-
nextestArchiveKey,
|
|
17
|
-
nextestExtractionPaths,
|
|
18
|
-
nextestExtractionRoot,
|
|
19
|
-
} from './nextest-extraction.js';
|
|
20
|
-
|
|
21
|
-
/** What nextest leaves behind: the two metadata files a reuse run reads. */
|
|
22
|
-
const unpack: NextestArchiveExtractor = async (_archive, destination) => {
|
|
23
|
-
await mkdir(join(destination, 'target/nextest'), { recursive: true });
|
|
24
|
-
await writeFile(join(destination, EXTRACTED_BINARIES_METADATA), '{}');
|
|
25
|
-
await writeFile(join(destination, EXTRACTED_CARGO_METADATA), '{}');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The lock's timing. `staleAfterMs` is the bound the first case is about; `heartbeatMs` and `pollMs` are intervals, not
|
|
30
|
-
* bounds. The heartbeat must stay below `staleAfterMs` for a live holder, and neither case reaches the poll.
|
|
31
|
-
*/
|
|
32
|
-
const FAST = { heartbeatMs: 20, staleAfterMs: 400, pollMs: 10 };
|
|
33
|
-
|
|
34
|
-
describe('ensureNextestArchiveExtracted', () => {
|
|
35
|
-
afterEach(() => jest.useRealTimers());
|
|
36
|
-
|
|
37
|
-
it('takes over a lock its holder stopped refreshing instead of waiting on it forever', async () => {
|
|
38
|
-
const root = await mkdtemp(join(tmpdir(), 'nextest-extraction-'));
|
|
39
|
-
try {
|
|
40
|
-
const archive = join(root, 'archive.tar.zst');
|
|
41
|
-
await writeFile(archive, 'archive bytes');
|
|
42
|
-
const paths = nextestExtractionPaths(join(root, 'extractions'), await nextestArchiveKey(archive));
|
|
43
|
-
// A holder killed mid-extraction (a bounded run's SIGKILL) leaves its
|
|
44
|
-
// lock behind, and a pid in it that may since belong to anyone.
|
|
45
|
-
await mkdir(paths.root, { recursive: true });
|
|
46
|
-
await writeFile(paths.lock, `${process.pid} abandoned\n`);
|
|
47
|
-
// Dated on the fake clock, which moves only when advanced: the lock's age the product reads is exactly this minute.
|
|
48
|
-
// No holder refreshes it, so it is stale at any host speed and the case never reaches the poll.
|
|
49
|
-
jest.useFakeTimers();
|
|
50
|
-
const minuteAgo = new Date(Date.now() - 60_000);
|
|
51
|
-
await utimes(paths.lock, minuteAgo, minuteAgo);
|
|
52
|
-
|
|
53
|
-
const events: NextestExtractionEvent[] = [];
|
|
54
|
-
const extraction = await ensureNextestArchiveExtracted(
|
|
55
|
-
archive,
|
|
56
|
-
paths.root,
|
|
57
|
-
unpack,
|
|
58
|
-
(event) => events.push(event),
|
|
59
|
-
FAST,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
expect(extraction).toMatchObject({ kind: 'extracted', directory: paths.directory });
|
|
63
|
-
expect(events).toEqual([{ kind: 'stale-lock', holder: `pid ${process.pid}`, ageMs: 60_000 }]);
|
|
64
|
-
expect(await readdir(paths.root)).toEqual([paths.directory.slice(paths.root.length + 1)]);
|
|
65
|
-
} finally {
|
|
66
|
-
await rm(root, { recursive: true, force: true });
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('publishes nothing when the archive changes while it is being extracted', async () => {
|
|
71
|
-
const root = await mkdtemp(join(tmpdir(), 'nextest-extraction-'));
|
|
72
|
-
try {
|
|
73
|
-
const archive = join(root, 'archive.tar.zst');
|
|
74
|
-
await writeFile(archive, 'archive bytes');
|
|
75
|
-
const paths = nextestExtractionPaths(join(root, 'extractions'), await nextestArchiveKey(archive));
|
|
76
|
-
// Unpacked from the old bytes, but the directory would be named for
|
|
77
|
-
// them while the path now holds others: a later run hashing the new
|
|
78
|
-
// bytes would never find it, and one hashing the old bytes again — the
|
|
79
|
-
// archive restored from cache — must not find a mixture.
|
|
80
|
-
const rebuiltMidway: NextestArchiveExtractor = async (source, destination) => {
|
|
81
|
-
await unpack(source, destination);
|
|
82
|
-
await writeFile(archive, 'rebuilt archive bytes');
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Nothing else holds the lock, so no staleness bound can decide this case: it takes the leg's backstop.
|
|
86
|
-
const timing = { ...FAST, staleAfterMs: BOUNDED_TEST_IDLE_TIMEOUT_MS };
|
|
87
|
-
await expect(ensureNextestArchiveExtracted(archive, paths.root, rebuiltMidway, () => {}, timing)).rejects.toThrow(
|
|
88
|
-
/changed while it was being extracted/,
|
|
89
|
-
);
|
|
90
|
-
// No directory under the old key, no staging left over, no lock held.
|
|
91
|
-
expect(await readdir(paths.root)).toEqual([]);
|
|
92
|
-
await expect(stat(paths.directory)).rejects.toMatchObject({ code: 'ENOENT' });
|
|
93
|
-
} finally {
|
|
94
|
-
await rm(root, { recursive: true, force: true });
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe('nextestExtractionRoot', () => {
|
|
100
|
-
it("extracts under the target directory Cargo reports, never beside the archive's Nx output", async () => {
|
|
101
|
-
const root = await realpath(await mkdtemp(join(tmpdir(), 'nextest-extraction-root-')));
|
|
102
|
-
try {
|
|
103
|
-
await writeFile(
|
|
104
|
-
join(root, 'Cargo.toml'),
|
|
105
|
-
'[package]\nname = "extraction-root-probe"\nversion = "0.1.0"\nedition = "2021"\n',
|
|
106
|
-
);
|
|
107
|
-
await mkdir(join(root, 'src'));
|
|
108
|
-
await writeFile(join(root, 'src/lib.rs'), '');
|
|
109
|
-
expect(spawnSync('cargo', ['generate-lockfile', '--offline'], { cwd: root }).status).toBe(0);
|
|
110
|
-
expect(await nextestExtractionRoot(root)).toBe(join(root, 'target', NEXTEST_EXTRACTION_DIRECTORY));
|
|
111
|
-
|
|
112
|
-
// A repository that moves Cargo's build tree moves its extractions with it.
|
|
113
|
-
await mkdir(join(root, '.cargo'));
|
|
114
|
-
await writeFile(join(root, '.cargo/config.toml'), '[build]\ntarget-dir = "out/cargo"\n');
|
|
115
|
-
expect(await nextestExtractionRoot(root)).toBe(join(root, 'out/cargo', NEXTEST_EXTRACTION_DIRECTORY));
|
|
116
|
-
} finally {
|
|
117
|
-
await rm(root, { recursive: true, force: true });
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('smoo-nx-nextest-extract', () => {
|
|
123
|
-
/** One shard's run of the real helper, as a runner's `$(...)` makes it: own TMPDIR, the archive in the checkout. */
|
|
124
|
-
async function shard(root: string, n: number) {
|
|
125
|
-
const tmp = join(root, `tmp-${n}`);
|
|
126
|
-
await mkdir(tmp);
|
|
127
|
-
const child = spawn(
|
|
128
|
-
process.execPath,
|
|
129
|
-
[join(import.meta.dir, 'bin/smoo-nx-nextest-extract.ts'), 'archive.tar.zst'],
|
|
130
|
-
{
|
|
131
|
-
cwd: root,
|
|
132
|
-
env: { ...process.env, TMPDIR: tmp },
|
|
133
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
134
|
-
},
|
|
135
|
-
);
|
|
136
|
-
let stdout = '';
|
|
137
|
-
let stderr = '';
|
|
138
|
-
child.stdout.on('data', (chunk: Buffer) => {
|
|
139
|
-
stdout += chunk.toString();
|
|
140
|
-
});
|
|
141
|
-
child.stderr.on('data', (chunk: Buffer) => {
|
|
142
|
-
stderr += chunk.toString();
|
|
143
|
-
});
|
|
144
|
-
const [code]: unknown[] = await once(child, 'close');
|
|
145
|
-
return { code, stdout, stderr, tmp };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
it('unpacks an archive once for four concurrent shards, in the build tree and in none of their temp directories', async () => {
|
|
149
|
-
// A downstream land gate: shards that each ran `nextest run --archive-file` unpacked the whole 1.97 GiB archive into
|
|
150
|
-
// their own TMPDIR, a lease on one 8 GiB RAM volume, and four of them filled it.
|
|
151
|
-
const root = await realpath(await mkdtemp(join(tmpdir(), 'nextest-extract-shards-')));
|
|
152
|
-
try {
|
|
153
|
-
await writeFile(
|
|
154
|
-
join(root, 'Cargo.toml'),
|
|
155
|
-
'[package]\nname = "shard-probe"\nversion = "0.1.0"\nedition = "2021"\n',
|
|
156
|
-
);
|
|
157
|
-
await mkdir(join(root, 'src'));
|
|
158
|
-
await writeFile(join(root, 'src/lib.rs'), '#[test]\nfn adds() {\n assert_eq!(1 + 1, 2);\n}\n');
|
|
159
|
-
expect(spawnSync('cargo', ['generate-lockfile', '--offline'], { cwd: root }).status).toBe(0);
|
|
160
|
-
const archived = spawnSync(
|
|
161
|
-
'cargo',
|
|
162
|
-
['--frozen', 'nextest', 'archive', '--archive-file', 'archive.tar.zst', '--user-config-file', 'none'],
|
|
163
|
-
{ cwd: root, encoding: 'utf8' },
|
|
164
|
-
);
|
|
165
|
-
expect({ status: archived.status, stderr: archived.status === 0 ? '' : archived.stderr }).toEqual({
|
|
166
|
-
status: 0,
|
|
167
|
-
stderr: '',
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
const shards = await Promise.all([1, 2, 3, 4].map((n) => shard(root, n)));
|
|
171
|
-
|
|
172
|
-
const extractions = join(root, 'target', NEXTEST_EXTRACTION_DIRECTORY);
|
|
173
|
-
const key = await nextestArchiveKey(join(root, 'archive.tar.zst'));
|
|
174
|
-
const directory = join(extractions, key);
|
|
175
|
-
expect(shards.map(({ code, stdout }) => ({ code, stdout }))).toEqual(
|
|
176
|
-
Array.from({ length: 4 }, () => ({ code: 0, stdout: `${directory}\n` })),
|
|
177
|
-
);
|
|
178
|
-
// One shard unpacked it; the others waited on it or found it done.
|
|
179
|
-
expect(shards.filter(({ stderr }) => stderr.includes(': extracted archive.tar.zst ')).length).toBe(1);
|
|
180
|
-
// One extraction under the archive's hash, nothing staged or locked beside it, and no shard's TMPDIR touched.
|
|
181
|
-
expect(await readdir(extractions)).toEqual([key]);
|
|
182
|
-
for (const { tmp } of shards) {
|
|
183
|
-
expect({ tmp, entries: await readdir(tmp) }).toEqual({ tmp, entries: [] });
|
|
184
|
-
}
|
|
185
|
-
// A shard runs its tests from that one extraction.
|
|
186
|
-
const ran = spawnSync(
|
|
187
|
-
'cargo',
|
|
188
|
-
[
|
|
189
|
-
'--frozen',
|
|
190
|
-
'nextest',
|
|
191
|
-
'run',
|
|
192
|
-
'--binaries-metadata',
|
|
193
|
-
join(directory, EXTRACTED_BINARIES_METADATA),
|
|
194
|
-
'--cargo-metadata',
|
|
195
|
-
join(directory, EXTRACTED_CARGO_METADATA),
|
|
196
|
-
'--target-dir-remap',
|
|
197
|
-
join(directory, EXTRACTED_TARGET_DIR),
|
|
198
|
-
'--workspace-remap',
|
|
199
|
-
'.',
|
|
200
|
-
'--user-config-file',
|
|
201
|
-
'none',
|
|
202
|
-
// A gate forces colour (FORCE_COLOR, CARGO_TERM_COLOR), which puts escape codes inside the summary line.
|
|
203
|
-
'--color',
|
|
204
|
-
'never',
|
|
205
|
-
],
|
|
206
|
-
{ cwd: root, encoding: 'utf8' },
|
|
207
|
-
);
|
|
208
|
-
expect({ status: ran.status, passed: ran.stderr.includes('1 test run: 1 passed') }).toEqual({
|
|
209
|
-
status: 0,
|
|
210
|
-
passed: true,
|
|
211
|
-
});
|
|
212
|
-
} finally {
|
|
213
|
-
await rm(root, { recursive: true, force: true });
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|