@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
package/src/task-results.test.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { afterAll, expect, it } from 'bun:test';
|
|
2
|
-
import { mkdir, readdir, readFile, realpath, stat, symlink, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { fixtureNxEnv, withNxFixture } from './__tests__/fixture-nx-env.js';
|
|
5
|
-
import { testFileInstallation } from './__tests__/owned-installation.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The plugin's `preTasksExecution`/`postTasksExecution` hooks, run by a real Nx subprocess in a
|
|
9
|
-
* fixture workspace that registers the compiled `@smoothbricks/nx-plugin`. The hooks write a hint
|
|
10
|
-
* only under a controller-selected receipt id: an ordinary run and an invalid id leave no namespace,
|
|
11
|
-
* and a failed task is recorded as a failure, never as a success. The receipt variable is spelled
|
|
12
|
-
* here rather than imported, so the test loads only the compiled plugin through Nx.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const RECEIPT_ENV = 'COWSHED_NX_TASK_RECEIPT_ID';
|
|
16
|
-
const RECEIPT = '0123456789abcdef0123456789abcdef';
|
|
17
|
-
const CHANGED_RECEIPT = 'fedcba9876543210fedcba9876543210';
|
|
18
|
-
/** The Nx CLI of a fixture workspace's own installation. */
|
|
19
|
-
const nxEntry = (workspace: string) => join(workspace, 'node_modules', '.bin', 'nx');
|
|
20
|
-
const HINTS = join('.nx', 'cache', '.cowshed-task-results');
|
|
21
|
-
|
|
22
|
-
/** The Nx and the plugin under test, one copy this file's fixtures share; none may write into it. */
|
|
23
|
-
const installation = testFileInstallation('task-results-installation');
|
|
24
|
-
afterAll(() => installation.retire());
|
|
25
|
-
|
|
26
|
-
/** A fixture workspace: `app:build` caches its copy of `source.txt`; `app:fail` always exits 3. */
|
|
27
|
-
async function writeWorkspace(workspace: string): Promise<void> {
|
|
28
|
-
await mkdir(join(workspace, 'app'), { recursive: true });
|
|
29
|
-
const git = Bun.spawnSync(['git', 'init', '--quiet', workspace]);
|
|
30
|
-
expect(git.exitCode, git.stderr.toString()).toBe(0);
|
|
31
|
-
await symlink(await installation.nodeModules(), join(workspace, 'node_modules'), 'dir');
|
|
32
|
-
await writeFile(
|
|
33
|
-
join(workspace, 'nx.json'),
|
|
34
|
-
JSON.stringify({ cacheDirectory: '.nx/cache', plugins: ['@smoothbricks/nx-plugin'] }),
|
|
35
|
-
);
|
|
36
|
-
await writeFile(
|
|
37
|
-
join(workspace, 'app', 'project.json'),
|
|
38
|
-
JSON.stringify({
|
|
39
|
-
name: 'app',
|
|
40
|
-
targets: {
|
|
41
|
-
build: {
|
|
42
|
-
executor: 'nx:run-commands',
|
|
43
|
-
cache: true,
|
|
44
|
-
inputs: ['{projectRoot}/source.txt'],
|
|
45
|
-
outputs: ['{projectRoot}/result.txt'],
|
|
46
|
-
// runs.txt is an undeclared execution marker: it counts real executions, not cache hits.
|
|
47
|
-
options: { cwd: 'app', command: 'cp source.txt result.txt && echo run >> runs.txt' },
|
|
48
|
-
},
|
|
49
|
-
fail: { executor: 'nx:run-commands', cache: false, options: { cwd: 'app', command: 'exit 3' } },
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
await writeFile(join(workspace, 'app', 'source.txt'), 'one');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Runs one target with `nx run` under `env`, returning its exit code, output and argv. */
|
|
57
|
-
async function nx(workspace: string, env: Record<string, string>, target: string) {
|
|
58
|
-
const argv = [process.execPath, nxEntry(workspace), 'run', target, '--outputStyle=static'];
|
|
59
|
-
const child = Bun.spawn(argv, { cwd: workspace, env, stdout: 'pipe', stderr: 'pipe' });
|
|
60
|
-
const [exitCode, stdout, stderr] = await Promise.all([
|
|
61
|
-
child.exited,
|
|
62
|
-
new Response(child.stdout).text(),
|
|
63
|
-
new Response(child.stderr).text(),
|
|
64
|
-
]);
|
|
65
|
-
return { exitCode, log: `${stdout}${stderr}`, argv };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function exists(path: string): Promise<boolean> {
|
|
69
|
-
try {
|
|
70
|
-
await stat(path);
|
|
71
|
-
return true;
|
|
72
|
-
} catch (error) {
|
|
73
|
-
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return false;
|
|
74
|
-
throw error;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Executions of `app:build`, one `run` line per real execution. */
|
|
79
|
-
async function runCount(workspace: string): Promise<number> {
|
|
80
|
-
const lines = (await readFile(join(workspace, 'app', 'runs.txt'), 'utf8')).split('\n');
|
|
81
|
-
return lines.filter((line) => line === 'run').length;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** The single hint in a receipt's namespace, parsed. */
|
|
85
|
-
async function readHint(namespace: string): Promise<unknown> {
|
|
86
|
-
const files = await readdir(namespace);
|
|
87
|
-
expect(files).toHaveLength(1);
|
|
88
|
-
const [file] = files;
|
|
89
|
-
if (file === undefined) throw new Error(`no hint in ${namespace}`);
|
|
90
|
-
return JSON.parse(await readFile(join(namespace, file), 'utf8'));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
it('records a task hint only under a controller receipt, and never on an ordinary run', async () => {
|
|
94
|
-
await withNxFixture(
|
|
95
|
-
'task-results',
|
|
96
|
-
async ({ workspace, socketDirectory }) => {
|
|
97
|
-
await writeWorkspace(workspace);
|
|
98
|
-
// The inherited receipt is dropped: only this test's runs choose one.
|
|
99
|
-
const { [RECEIPT_ENV]: _inherited, ...ordinary } = fixtureNxEnv(workspace, socketDirectory);
|
|
100
|
-
const hints = join(workspace, HINTS);
|
|
101
|
-
const source = join(workspace, 'app', 'source.txt');
|
|
102
|
-
|
|
103
|
-
const first = await nx(workspace, ordinary, 'app:build');
|
|
104
|
-
expect(first.exitCode, first.log).toBe(0);
|
|
105
|
-
expect(await runCount(workspace)).toBe(1);
|
|
106
|
-
expect(await exists(hints)).toBe(false);
|
|
107
|
-
|
|
108
|
-
const hit = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: RECEIPT }, 'app:build');
|
|
109
|
-
expect(hit.exitCode, hit.log).toBe(0);
|
|
110
|
-
expect(hit.log).toContain('local cache');
|
|
111
|
-
expect(await runCount(workspace)).toBe(1);
|
|
112
|
-
expect(await readdir(hints)).toEqual([RECEIPT]);
|
|
113
|
-
expect(await readHint(join(hints, RECEIPT))).toMatchObject({
|
|
114
|
-
version: 1,
|
|
115
|
-
requestId: RECEIPT,
|
|
116
|
-
workspaceRoot: workspace,
|
|
117
|
-
run: { argv: [process.execPath, await realpath(nxEntry(workspace)), ...hit.argv.slice(2)] },
|
|
118
|
-
tasks: [{ task: { id: 'app:build', hash: expect.stringMatching(/^\d+$/) }, status: 'local-cache', code: 0 }],
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
const invalid = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: 'NOT-A-REQUEST-ID' }, 'app:build');
|
|
122
|
-
expect(invalid.exitCode, invalid.log).toBe(0);
|
|
123
|
-
expect(invalid.log).toContain('is not a controller-selected 32-hex request id');
|
|
124
|
-
expect(await readdir(hints)).toEqual([RECEIPT]);
|
|
125
|
-
|
|
126
|
-
await writeFile(source, 'two');
|
|
127
|
-
const changed = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: CHANGED_RECEIPT }, 'app:build');
|
|
128
|
-
expect(changed.exitCode, changed.log).toBe(0);
|
|
129
|
-
expect(await runCount(workspace)).toBe(2);
|
|
130
|
-
expect((await readdir(hints)).sort()).toEqual([RECEIPT, CHANGED_RECEIPT].sort());
|
|
131
|
-
expect(await readHint(join(hints, CHANGED_RECEIPT))).toMatchObject({
|
|
132
|
-
version: 1,
|
|
133
|
-
requestId: CHANGED_RECEIPT,
|
|
134
|
-
run: { argv: [process.execPath, await realpath(nxEntry(workspace)), ...changed.argv.slice(2)] },
|
|
135
|
-
tasks: [{ task: { id: 'app:build', hash: expect.stringMatching(/^\d+$/) }, status: 'success', code: 0 }],
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
'.',
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('records a failed task as a failure under a receipt, never as a success', async () => {
|
|
143
|
-
await withNxFixture(
|
|
144
|
-
'task-results-failure',
|
|
145
|
-
async ({ workspace, socketDirectory }) => {
|
|
146
|
-
await writeWorkspace(workspace);
|
|
147
|
-
const { [RECEIPT_ENV]: _inherited, ...ordinary } = fixtureNxEnv(workspace, socketDirectory);
|
|
148
|
-
|
|
149
|
-
const failed = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: RECEIPT }, 'app:fail');
|
|
150
|
-
expect(failed.exitCode).not.toBe(0);
|
|
151
|
-
expect(await readHint(join(workspace, HINTS, RECEIPT))).toMatchObject({
|
|
152
|
-
requestId: RECEIPT,
|
|
153
|
-
tasks: [{ task: { id: 'app:fail' }, status: 'failure', code: 1 }],
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
'.',
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('records hints through a daemon-backed Nx only under a checked receipt', async () => {
|
|
161
|
-
await withNxFixture(
|
|
162
|
-
'task-results-daemon',
|
|
163
|
-
async ({ workspace, socketDirectory }) => {
|
|
164
|
-
await writeWorkspace(workspace);
|
|
165
|
-
// The daemon is on, as in normal use: the hooks run in the daemon, which receives the client's env.
|
|
166
|
-
const daemon: Record<string, string> = { ...fixtureNxEnv(workspace, socketDirectory), NX_DAEMON: 'true' };
|
|
167
|
-
const { [RECEIPT_ENV]: _inherited, ...ordinary } = daemon;
|
|
168
|
-
const hints = join(workspace, HINTS);
|
|
169
|
-
const namespaceA = join(hints, RECEIPT);
|
|
170
|
-
|
|
171
|
-
const first = await nx(workspace, ordinary, 'app:build');
|
|
172
|
-
expect(first.exitCode, first.log).toBe(0);
|
|
173
|
-
expect(await runCount(workspace)).toBe(1);
|
|
174
|
-
expect(await exists(hints)).toBe(false);
|
|
175
|
-
|
|
176
|
-
const checkedA = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: RECEIPT }, 'app:build');
|
|
177
|
-
expect(checkedA.exitCode, checkedA.log).toBe(0);
|
|
178
|
-
expect(checkedA.log).toContain('[existing outputs match the cache, left as is]');
|
|
179
|
-
expect(await runCount(workspace)).toBe(1);
|
|
180
|
-
expect(await readHint(namespaceA)).toMatchObject({
|
|
181
|
-
version: 1,
|
|
182
|
-
requestId: RECEIPT,
|
|
183
|
-
workspaceRoot: workspace,
|
|
184
|
-
run: { argv: [checkedA.argv[0] ?? '', await realpath(nxEntry(workspace)), ...checkedA.argv.slice(2)] },
|
|
185
|
-
tasks: [
|
|
186
|
-
{
|
|
187
|
-
task: { id: 'app:build', hash: expect.stringMatching(/^\d+$/) },
|
|
188
|
-
status: 'local-cache-kept-existing',
|
|
189
|
-
code: 0,
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// An ordinary run without a key must neither add a hint nor rewrite checked hint A.
|
|
195
|
-
const [fileA] = await readdir(namespaceA);
|
|
196
|
-
if (fileA === undefined) throw new Error(`no hint in ${namespaceA}`);
|
|
197
|
-
const hintA = join(namespaceA, fileA);
|
|
198
|
-
const bytesA = await readFile(hintA, 'utf8');
|
|
199
|
-
const mtimeA = (await stat(hintA, { bigint: true })).mtimeNs;
|
|
200
|
-
const ordinaryAgain = await nx(workspace, ordinary, 'app:build');
|
|
201
|
-
expect(ordinaryAgain.exitCode, ordinaryAgain.log).toBe(0);
|
|
202
|
-
expect(await readdir(hints)).toEqual([RECEIPT]);
|
|
203
|
-
expect(await readdir(namespaceA)).toEqual([fileA]);
|
|
204
|
-
expect(await readFile(hintA, 'utf8')).toBe(bytesA);
|
|
205
|
-
expect((await stat(hintA, { bigint: true })).mtimeNs).toBe(mtimeA);
|
|
206
|
-
|
|
207
|
-
// A new valid receipt records its own namespace, and the unchanged task is still not executed.
|
|
208
|
-
const checkedB = await nx(workspace, { ...ordinary, [RECEIPT_ENV]: CHANGED_RECEIPT }, 'app:build');
|
|
209
|
-
expect(checkedB.exitCode, checkedB.log).toBe(0);
|
|
210
|
-
expect(await runCount(workspace)).toBe(1);
|
|
211
|
-
expect((await readdir(hints)).sort()).toEqual([RECEIPT, CHANGED_RECEIPT].sort());
|
|
212
|
-
expect(await readHint(join(hints, CHANGED_RECEIPT))).toMatchObject({
|
|
213
|
-
version: 1,
|
|
214
|
-
requestId: CHANGED_RECEIPT,
|
|
215
|
-
workspaceRoot: workspace,
|
|
216
|
-
run: { argv: [checkedB.argv[0] ?? '', await realpath(nxEntry(workspace)), ...checkedB.argv.slice(2)] },
|
|
217
|
-
tasks: [
|
|
218
|
-
{
|
|
219
|
-
task: { id: 'app:build', hash: expect.stringMatching(/^\d+$/) },
|
|
220
|
-
status: 'local-cache-kept-existing',
|
|
221
|
-
code: 0,
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
'.',
|
|
227
|
-
);
|
|
228
|
-
});
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { dirname, join } from 'node:path';
|
|
6
|
-
import { type ClockOracleKind, findClockOracles, formatClockOracle, TEST_CLOCK_ORACLE } from './test-clock-policy.js';
|
|
7
|
-
import { diffScope } from './test-walk-policy.js';
|
|
8
|
-
|
|
9
|
-
const lines = (...source: string[]): string => `${source.join('\n')}\n`;
|
|
10
|
-
// Assembled so this file's own cases carry no runner flag a scan of it would read as a bound.
|
|
11
|
-
const flag = ['--time', 'out'].join('');
|
|
12
|
-
|
|
13
|
-
describe('test-clock-policy', () => {
|
|
14
|
-
// One walk: each planted site and each control is a step over one fixture directory, then the diff scope.
|
|
15
|
-
it('refuses runner and test-owned deadlines, elapsed-time asserts and clocked bounds, passes the controls, and scopes to changed cases', () => {
|
|
16
|
-
const root = mkdtempSync(join(tmpdir(), 'test-clock-policy-'));
|
|
17
|
-
const write = (file: string, source: string): void => {
|
|
18
|
-
mkdirSync(dirname(join(root, file)), { recursive: true });
|
|
19
|
-
writeFileSync(join(root, file), source);
|
|
20
|
-
};
|
|
21
|
-
const kinds = (file: string) => findClockOracles(root, [file]).map((oracle) => oracle.kind);
|
|
22
|
-
const git = (...args: string[]): string => {
|
|
23
|
-
const result = spawnSync(
|
|
24
|
-
'git',
|
|
25
|
-
['-c', 'user.name=Fixture', '-c', 'user.email=fixture@example.invalid', ...args],
|
|
26
|
-
{
|
|
27
|
-
cwd: root,
|
|
28
|
-
encoding: 'utf8',
|
|
29
|
-
env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' },
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
|
-
if (result.status !== 0) throw new Error(`git ${args.join(' ')}: ${result.stderr}`);
|
|
33
|
-
return result.stdout;
|
|
34
|
-
};
|
|
35
|
-
try {
|
|
36
|
-
const planted: readonly [ClockOracleKind, string, string][] = [
|
|
37
|
-
['runner-deadline', 'tests/a.test.ts', "test('slow', async () => { await child.exited; }, 60_000);"],
|
|
38
|
-
[
|
|
39
|
-
'runner-deadline',
|
|
40
|
-
'tests/a.test.ts',
|
|
41
|
-
"test('slow', async () => { await child.exited; }, { timeout: 60_000 });",
|
|
42
|
-
],
|
|
43
|
-
['runner-deadline', 'tests/a.test.ts', "test.each([1])('n %d', async (n) => { await run(n); }, 30_000);"],
|
|
44
|
-
['runner-deadline', 'tests/a.test.ts', 'setDefaultTimeout(60_000);'],
|
|
45
|
-
[
|
|
46
|
-
'clock-delta',
|
|
47
|
-
'tests/a.test.ts',
|
|
48
|
-
"test('fast', async () => { const started = Date.now(); await run(); expect(Date.now() - started).toBeLessThan(5_000); });",
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
'clock-delta',
|
|
52
|
-
'tests/a.test.ts',
|
|
53
|
-
"test('fast', () => { const t = performance.now(); work(); const elapsedMs = performance.now() - t; expect(elapsedMs < 1_000).toBe(true); });",
|
|
54
|
-
],
|
|
55
|
-
[
|
|
56
|
-
'clock-delta',
|
|
57
|
-
'tests/a.test.ts',
|
|
58
|
-
"test('deadline', () => { const deadline = Date.now() + 1_000; work(); expect(Date.now()).toBeLessThanOrEqual(deadline); });",
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
'clock-delta',
|
|
62
|
-
'tests/a.test.ts',
|
|
63
|
-
"test('close', () => { expect(Math.abs(stamp() - Date.now())).not.toBeGreaterThan(1); });",
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
'clock-delta',
|
|
67
|
-
'tests/quick.rs',
|
|
68
|
-
lines(
|
|
69
|
-
'#[test]',
|
|
70
|
-
'fn quick() {',
|
|
71
|
-
' let started = Instant::now();',
|
|
72
|
-
' work();',
|
|
73
|
-
' assert!(started.elapsed() < Duration::from_secs(10), "slow");',
|
|
74
|
-
'}',
|
|
75
|
-
),
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
'clock-delta',
|
|
79
|
-
'src/quick.rs',
|
|
80
|
-
lines(
|
|
81
|
-
'fn work() {}',
|
|
82
|
-
'#[cfg(test)]',
|
|
83
|
-
'mod tests {',
|
|
84
|
-
' #[test]',
|
|
85
|
-
' fn quick() {',
|
|
86
|
-
' let started = Instant::now();',
|
|
87
|
-
' let elapsed = started.elapsed();',
|
|
88
|
-
' assert!(Duration::from_millis(500) > elapsed);',
|
|
89
|
-
' }',
|
|
90
|
-
'}',
|
|
91
|
-
),
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
'clocked-bound',
|
|
95
|
-
'tests/a.test.ts',
|
|
96
|
-
`test('times out', async () => { const result = await runBoundedExec({ command: 'node -e "setTimeout(() => {}, 5000)"', timeoutMs: 50 }); expect(result.success).toBe(false); });`,
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
'clocked-bound',
|
|
100
|
-
'tests/a.test.ts',
|
|
101
|
-
lines(
|
|
102
|
-
"const SLOW = `test('slow', async () => { await new Promise((r) => setTimeout(r, 5000)); });`;",
|
|
103
|
-
`test('per-test bound', async () => { expect(await verdictOf('bun test ${flag}=100 ./slow.test.ts', { 'slow.test.ts': SLOW })).toEqual({ outcome: 'bound' }); });`,
|
|
104
|
-
),
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
'clocked-bound',
|
|
108
|
-
'tests/a.test.ts',
|
|
109
|
-
"test('idle', async () => { await run({ argv: ['sleep', '5'], idleTimeoutSeconds: 1 }); });",
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
'clocked-bound',
|
|
113
|
-
'tests/a.test.ts',
|
|
114
|
-
"test('short stand-in', async () => { const path = await fakeChild('exec sleep 30'); await openService({ path, lspQueryTimeoutMs: 1_000 }); });",
|
|
115
|
-
],
|
|
116
|
-
[
|
|
117
|
-
'clocked-bound',
|
|
118
|
-
'tests/a.test.ts',
|
|
119
|
-
`test('talking child under a progress bound', async () => { await verdictOf('node -e "setInterval(() => console.log(1), 10)"', { idleTimeoutMs: 100 }); });`,
|
|
120
|
-
],
|
|
121
|
-
[
|
|
122
|
-
'clocked-bound',
|
|
123
|
-
'tests/bound.rs',
|
|
124
|
-
lines(
|
|
125
|
-
'#[test]',
|
|
126
|
-
'fn bound() {',
|
|
127
|
-
' let outcome = run(Command::new("sleep").arg("5"), Options { timeout_ms: 50 });',
|
|
128
|
-
' assert!(outcome.timed_out);',
|
|
129
|
-
'}',
|
|
130
|
-
),
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
'test-deadline',
|
|
134
|
-
'tests/deadline.rs',
|
|
135
|
-
lines(
|
|
136
|
-
'#[test]',
|
|
137
|
-
'fn event() {',
|
|
138
|
-
' let (tx, rx) = channel();',
|
|
139
|
-
' spawn(tx);',
|
|
140
|
-
' rx.recv_timeout(Duration::from_secs(10)).expect("the event");',
|
|
141
|
-
'}',
|
|
142
|
-
),
|
|
143
|
-
],
|
|
144
|
-
[
|
|
145
|
-
'test-deadline',
|
|
146
|
-
'tests/deadline.rs',
|
|
147
|
-
lines(
|
|
148
|
-
'#[tokio::test]',
|
|
149
|
-
'async fn event() {',
|
|
150
|
-
' tokio::time::timeout(Duration::from_millis(500), served()).await.expect("served");',
|
|
151
|
-
'}',
|
|
152
|
-
),
|
|
153
|
-
],
|
|
154
|
-
];
|
|
155
|
-
for (const [kind, file, source] of planted) {
|
|
156
|
-
write(file, source);
|
|
157
|
-
expect([file, source, kinds(file)]).toEqual([file, source, [kind]]);
|
|
158
|
-
rmSync(join(root, file));
|
|
159
|
-
}
|
|
160
|
-
write('tests/a.test.ts', planted[4]?.[2] ?? '');
|
|
161
|
-
const diagnostic = findClockOracles(root, ['tests/a.test.ts']).map(formatClockOracle)[0] ?? '';
|
|
162
|
-
for (const part of [
|
|
163
|
-
`error[${TEST_CLOCK_ORACLE.id}]: ${TEST_CLOCK_ORACLE.message['clock-delta']}`,
|
|
164
|
-
' --> tests/a.test.ts:1:',
|
|
165
|
-
' = help: Elapsed time on a loaded host',
|
|
166
|
-
])
|
|
167
|
-
expect(diagnostic).toContain(part);
|
|
168
|
-
rmSync(join(root, 'tests/a.test.ts'));
|
|
169
|
-
|
|
170
|
-
const controls: readonly [string, string][] = [
|
|
171
|
-
[
|
|
172
|
-
'tests/c.test.ts',
|
|
173
|
-
"test('injected clock', () => { const timer = new MemoryTimer(); const started = timer.now(); timer.advance(30); expect(timer.now() - started).toBeLessThan(31); });",
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
'tests/c.test.ts',
|
|
177
|
-
`test('exit decides', async () => { const run = await onProgressClock(() => false, 0, () => verdictOf('node -e ""', { timeoutMs: 5_000 })); expect(run.result).toEqual({ outcome: 'passed' }); });`,
|
|
178
|
-
],
|
|
179
|
-
[
|
|
180
|
-
'tests/c.test.ts',
|
|
181
|
-
`test('subject held off by construction', async () => { const result = await runBoundedExec({ command: 'node -e "process.stdin.resume()"', timeoutMs: 50 }); expect(result.terminalOutput).toContain('timeoutMs=50'); });`,
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
'tests/c.test.ts',
|
|
185
|
-
`test('bounds that cannot decide', async () => { await runBoundedExec({ command: 'node -e "setTimeout(() => {}, 400)"', idleTimeoutMs: 0, timeoutMs: 180_000 }); });`,
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
'tests/c.test.ts',
|
|
189
|
-
"test('waited at least', async () => { const started = performance.now(); await lock.acquired; expect(performance.now() - started).toBeGreaterThanOrEqual(100); });",
|
|
190
|
-
],
|
|
191
|
-
[
|
|
192
|
-
'tests/c.test.ts',
|
|
193
|
-
"test('stamped after', () => { const before = Date.now(); const record = make(); expect(record.at).toBeGreaterThanOrEqual(before); expect(before).toBeLessThanOrEqual(record.at); });",
|
|
194
|
-
],
|
|
195
|
-
['tests/c.test.ts', "test('cpu time', () => { expect(cpuTime.total).toBeLessThanOrEqual(100_000); });"],
|
|
196
|
-
[
|
|
197
|
-
'tests/c.test.ts',
|
|
198
|
-
"test('stand-in outlasts the leg', async () => { const path = await fakeChild('exec sleep 3600'); await openService({ path, lspQueryTimeoutMs: 1_000 }); });",
|
|
199
|
-
],
|
|
200
|
-
[
|
|
201
|
-
'tests/c.test.ts',
|
|
202
|
-
`test('silent child held past the backstop', async () => { await runBoundedExec({ command: 'node -e "setInterval(() => {}, 1 << 30)"', timeoutMs: 50, killAfterMs: 10 }); });`,
|
|
203
|
-
],
|
|
204
|
-
[
|
|
205
|
-
'tests/c.test.ts',
|
|
206
|
-
`test('a ceiling and a progress bound', async () => { await verdictOf('node -e "setInterval(() => console.log(1), 10)"', { timeoutMs: 200 }); await verdictOf('node -e "setInterval(() => {}, 1 << 30)"', { idleTimeoutMs: 100 }); });`,
|
|
207
|
-
],
|
|
208
|
-
[
|
|
209
|
-
'tests/c.test.ts',
|
|
210
|
-
`test('virtual progress clock', async () => { const script = "setInterval(() => console.error('SLOW'), 50);"; await onProgressClock((chunk) => chunk.includes('SLOW'), 400, () => runBoundedExec({ command: 'node runner.js', idleTimeoutMs: 400 })); expect(verdict).toMatchObject({ outcome: 'wedged', idleMs: 400 }); });`,
|
|
211
|
-
],
|
|
212
|
-
[
|
|
213
|
-
'tests/c.rs',
|
|
214
|
-
lines(
|
|
215
|
-
'#[tokio::test]',
|
|
216
|
-
'async fn parked() {',
|
|
217
|
-
' let child = Command::new("sleep").arg("1");',
|
|
218
|
-
' assert!(tokio::time::timeout(Duration::from_millis(500), &mut parked).await.is_err());',
|
|
219
|
-
'}',
|
|
220
|
-
),
|
|
221
|
-
],
|
|
222
|
-
[
|
|
223
|
-
'tests/c.test.ts',
|
|
224
|
-
lines(
|
|
225
|
-
'const elapsed = Date.now() - t0;',
|
|
226
|
-
"test('shadowed', () => { const elapsed = timer.elapsed(); expect(elapsed).toBeLessThan(5); });",
|
|
227
|
-
),
|
|
228
|
-
],
|
|
229
|
-
[
|
|
230
|
-
'tests/c.rs',
|
|
231
|
-
lines(
|
|
232
|
-
'#[test]',
|
|
233
|
-
'fn waited() {',
|
|
234
|
-
' let started = Instant::now();',
|
|
235
|
-
' acquire();',
|
|
236
|
-
' assert!(started.elapsed() >= Duration::from_millis(100));',
|
|
237
|
-
' let clock = ManualClock::new();',
|
|
238
|
-
' clock.advance(Duration::from_millis(30));',
|
|
239
|
-
' assert!(clock.elapsed() < Duration::from_millis(31));',
|
|
240
|
-
'}',
|
|
241
|
-
),
|
|
242
|
-
],
|
|
243
|
-
[
|
|
244
|
-
'tests/c.rs',
|
|
245
|
-
lines(
|
|
246
|
-
'#[test]',
|
|
247
|
-
'fn stamped() {',
|
|
248
|
-
' let wall_before = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_micros();',
|
|
249
|
-
' let since_us = start();',
|
|
250
|
-
' assert!(since_us >= wall_before);',
|
|
251
|
-
' let config = format!(r#"timeoutMs = 1; cmd = "sleep 5""#);',
|
|
252
|
-
'}',
|
|
253
|
-
),
|
|
254
|
-
],
|
|
255
|
-
[
|
|
256
|
-
'tests/c.rs',
|
|
257
|
-
lines(
|
|
258
|
-
'#[tokio::test]',
|
|
259
|
-
'async fn quiet() {',
|
|
260
|
-
' assert!(timeout(Duration::from_millis(50), rx.recv()).await.is_err());',
|
|
261
|
-
' timeout(NO_PROGRESS, served()).await.expect("served");',
|
|
262
|
-
'}',
|
|
263
|
-
),
|
|
264
|
-
],
|
|
265
|
-
[
|
|
266
|
-
'tests/c.rs',
|
|
267
|
-
lines(
|
|
268
|
-
'#[tokio::test(start_paused = true)]',
|
|
269
|
-
'async fn virtual_time() {',
|
|
270
|
-
' let deadline = Instant::now() + Duration::from_secs(5);',
|
|
271
|
-
' advance().await;',
|
|
272
|
-
' assert!(Instant::now() < deadline);',
|
|
273
|
-
' timeout(Duration::from_millis(500), served()).await.expect("served");',
|
|
274
|
-
'}',
|
|
275
|
-
),
|
|
276
|
-
],
|
|
277
|
-
];
|
|
278
|
-
for (const [file, source] of controls) {
|
|
279
|
-
write(file, source);
|
|
280
|
-
expect([source, kinds(file)]).toEqual([source, []]);
|
|
281
|
-
rmSync(join(root, file));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// Diff scope: an existing elapsed bound in the upstream refuses nothing until its own case is edited, and then the
|
|
285
|
-
// whole case is examined; the bin judges the same changes.
|
|
286
|
-
const legacy = [
|
|
287
|
-
"test('old elapsed bound', async () => {",
|
|
288
|
-
' const started = Date.now();',
|
|
289
|
-
' await run();',
|
|
290
|
-
' expect(Date.now() - started).toBeLessThan(5_000);',
|
|
291
|
-
'});',
|
|
292
|
-
"test('event case', async () => {",
|
|
293
|
-
' await child.exited;',
|
|
294
|
-
'});',
|
|
295
|
-
];
|
|
296
|
-
write('tests/legacy.test.ts', lines(...legacy));
|
|
297
|
-
git('init', '--quiet', '-b', 'main');
|
|
298
|
-
git('add', '.');
|
|
299
|
-
git('commit', '--quiet', '-m', 'base');
|
|
300
|
-
git('checkout', '--quiet', '-b', 'topic');
|
|
301
|
-
const base = git('rev-parse', 'HEAD').trim();
|
|
302
|
-
const judged = () => {
|
|
303
|
-
const scope = diffScope(root, base);
|
|
304
|
-
if (!scope.ok) throw new Error(scope.reason);
|
|
305
|
-
return findClockOracles(root, scope.value.files, scope.value.changes).map((oracle) => [
|
|
306
|
-
oracle.kind,
|
|
307
|
-
oracle.line,
|
|
308
|
-
]);
|
|
309
|
-
};
|
|
310
|
-
expect(judged()).toEqual([]);
|
|
311
|
-
write('tests/legacy.test.ts', lines(...legacy.slice(0, 6), ' await child.closed;', ...legacy.slice(7)));
|
|
312
|
-
expect(judged()).toEqual([]);
|
|
313
|
-
write(
|
|
314
|
-
'tests/legacy.test.ts',
|
|
315
|
-
lines(...legacy.slice(0, 2), ' await run({ verbose: true });', ...legacy.slice(3)),
|
|
316
|
-
);
|
|
317
|
-
expect(judged()).toEqual([['clock-delta', 4]]);
|
|
318
|
-
const scope = diffScope(root, base);
|
|
319
|
-
expect(
|
|
320
|
-
(scope.ok ? findClockOracles(root, scope.value.files, scope.value.changes) : [])
|
|
321
|
-
.map(formatClockOracle)
|
|
322
|
-
.map((each) => each.split('\n').slice(0, 2)),
|
|
323
|
-
).toEqual([
|
|
324
|
-
[
|
|
325
|
-
`error[${TEST_CLOCK_ORACLE.id}]: ${TEST_CLOCK_ORACLE.message['clock-delta']}: expect(Date.now() - started).toBeLessThan(5_000)`,
|
|
326
|
-
' --> tests/legacy.test.ts:4:3',
|
|
327
|
-
],
|
|
328
|
-
]);
|
|
329
|
-
write('tests/new.test.ts', planted[0]?.[2] ?? '');
|
|
330
|
-
expect(judged()).toEqual([
|
|
331
|
-
['clock-delta', 4],
|
|
332
|
-
['runner-deadline', 1],
|
|
333
|
-
]);
|
|
334
|
-
} finally {
|
|
335
|
-
rmSync(root, { recursive: true, force: true });
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
});
|