@smoothbricks/nx-plugin 0.4.25 → 0.4.27
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 +1078 -98
- package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-bound-failures.js +31 -0
- package/dist/bin/smoo-nx-cargo-hash.js +28 -3
- package/dist/bin/smoo-nx-exec.js +16 -85
- package/dist/bin/smoo-nx-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-failures.js +3 -0
- package/dist/bin/smoo-nx-nextest-extract.js +3 -2
- package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-walks.js +34 -0
- package/dist/bounded-test-policy.d.ts +7 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +101 -40
- package/dist/build-state-output-policy.d.ts +25 -0
- package/dist/build-state-output-policy.d.ts.map +1 -0
- package/dist/build-state-output-policy.js +64 -0
- package/dist/cargo-closure-input.d.ts +16 -17
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +37 -44
- package/dist/cargo-dev-profile.d.ts +37 -0
- package/dist/cargo-dev-profile.d.ts.map +1 -0
- package/dist/cargo-dev-profile.js +108 -0
- package/dist/cargo-source-hash.d.ts +50 -8
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +691 -71
- package/dist/cargo-toolchain-policy.d.ts +4 -0
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +5 -0
- package/dist/cargo-workspace.d.ts +108 -12
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +299 -18
- package/dist/cross-check-policy.d.ts +21 -3
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +24 -6
- package/dist/disk-command-policy.d.ts +7 -0
- package/dist/disk-command-policy.d.ts.map +1 -0
- package/dist/disk-command-policy.js +98 -0
- package/dist/ensure-built-receipt.d.ts +25 -0
- package/dist/ensure-built-receipt.d.ts.map +1 -0
- package/dist/ensure-built-receipt.js +261 -0
- package/dist/ensure-built-witness.d.ts +57 -0
- package/dist/ensure-built-witness.d.ts.map +1 -0
- package/dist/ensure-built-witness.js +412 -0
- package/dist/ensure-built.d.ts +213 -12
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +624 -177
- package/dist/eslint-file-set.d.ts +7 -0
- package/dist/eslint-file-set.d.ts.map +1 -0
- package/dist/eslint-file-set.js +12 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool.js +379 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/disk-lease.js +91 -0
- package/dist/executors/bounded-exec/executor.d.ts +45 -2
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +447 -52
- package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/gateway-lease.js +143 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
- package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
- package/dist/executors/bounded-exec/progress.d.ts +35 -0
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress.js +79 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp.js +1528 -0
- package/dist/executors/bounded-exec/schema.d.ts +29 -11
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +162 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
- package/dist/executors/bounded-exec/verdict.js +318 -0
- package/dist/executors/shard-timings/executor.d.ts +14 -0
- package/dist/executors/shard-timings/executor.d.ts.map +1 -0
- package/dist/executors/shard-timings/executor.js +25 -0
- package/dist/executors/shard-timings/schema.d.ts +4 -0
- package/dist/executors/shard-timings/schema.d.ts.map +1 -0
- package/dist/executors/shard-timings/schema.js +1 -0
- package/dist/failure-summary.d.ts +5 -0
- package/dist/failure-summary.d.ts.map +1 -0
- package/dist/failure-summary.js +118 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +6 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +435 -230
- package/dist/managed-assets.d.ts +6 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.d.ts +13 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +44 -13
- package/dist/managed-files/files.d.ts +7 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +62 -8
- package/dist/managed-files/json-edit.d.ts +21 -0
- package/dist/managed-files/json-edit.d.ts.map +1 -0
- package/dist/managed-files/json-edit.js +295 -0
- package/dist/managed-files/managed-format.d.ts +33 -1
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +82 -2
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
- package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +231 -48
- package/dist/managed-files/tree.d.ts +5 -0
- package/dist/managed-files/tree.d.ts.map +1 -1
- package/dist/managed-files/tree.js +5 -3
- package/dist/manifest-hash.js +3 -2
- package/dist/nextest-code-bound.d.ts +62 -0
- package/dist/nextest-code-bound.d.ts.map +1 -0
- package/dist/nextest-code-bound.js +154 -0
- package/dist/nextest-extraction.d.ts +24 -8
- package/dist/nextest-extraction.d.ts.map +1 -1
- package/dist/nextest-extraction.js +42 -7
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +3 -5
- package/dist/release-config-policy.d.ts.map +1 -1
- package/dist/release-config-policy.js +3 -5
- package/dist/runtime-input.d.ts +14 -0
- package/dist/runtime-input.d.ts.map +1 -0
- package/dist/runtime-input.js +15 -0
- package/dist/rust-tokens.d.ts +11 -0
- package/dist/rust-tokens.d.ts.map +1 -0
- package/dist/rust-tokens.js +81 -0
- package/dist/task-results.d.ts +6 -0
- package/dist/task-results.d.ts.map +1 -0
- package/dist/task-results.js +61 -0
- package/dist/test-program.d.ts +54 -0
- package/dist/test-program.d.ts.map +1 -0
- package/dist/test-program.js +292 -0
- package/dist/test-timings.d.ts +71 -0
- package/dist/test-timings.d.ts.map +1 -0
- package/dist/test-timings.js +393 -0
- package/dist/test-walk-policy.d.ts +103 -0
- package/dist/test-walk-policy.d.ts.map +1 -0
- package/dist/test-walk-policy.js +657 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +824 -0
- package/dist/type-guards.d.ts +3 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +4 -0
- package/dist/typecheck-test-policy.d.ts +8 -5
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +113 -100
- package/dist/workspace-config-policy.d.ts +8 -0
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +175 -63
- package/dist/workspace-index.d.ts +12 -0
- package/dist/workspace-index.d.ts.map +1 -0
- package/dist/workspace-index.js +17 -0
- package/dist/workspace-manifest.d.ts +37 -1
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +5 -0
- package/loader.js +13 -11
- package/managed/raw/envrc +33 -62
- package/managed/raw/git-format-staged.yml +30 -35
- package/managed/raw/patches/nx@23.2.1.patch +3484 -0
- package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
- package/managed/raw/tooling/direnv/developer-links.ts +607 -17
- package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -92
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
- package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
- package/managed/raw/tooling/direnv/repo-path +14 -2
- package/managed/raw/tooling/direnv/setup-environment.ts +1009 -118
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
- package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
- package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
- package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
- package/managed/templates/github/actions/cache-nx/action.yml +1 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
- package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
- package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
- package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
- package/managed/templates/github/workflows/managed-files.yml +1 -2
- package/nextest.toml +8 -75
- package/package.json +75 -13
- package/runtime-input.sh +81 -0
- package/src/__tests__/counted-cargo-process.ts +286 -0
- package/src/__tests__/counted-cargo.ts +730 -0
- package/src/__tests__/fixture-cargo-home.ts +36 -0
- package/src/__tests__/fixture-nx-env.ts +157 -2
- package/src/__tests__/progress-clock.ts +43 -0
- package/src/__tests__/runtime-input.ts +23 -0
- package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
- package/src/bin/smoo-nx-bound-failures.ts +33 -0
- package/src/bin/smoo-nx-cargo-hash.ts +28 -3
- package/src/bin/smoo-nx-exec.ts +17 -86
- package/src/bin/smoo-nx-failures.ts +4 -0
- package/src/bin/smoo-nx-nextest-extract.ts +3 -2
- package/src/bin/smoo-nx-test-walks.ts +42 -0
- package/src/bounded-test-policy.test.ts +268 -22
- package/src/bounded-test-policy.ts +114 -42
- package/src/build-state-output-policy.test.ts +115 -0
- package/src/build-state-output-policy.ts +90 -0
- package/src/bun-bootstrap.test.ts +57 -3
- package/src/bun-file-packages.test.ts +47 -0
- package/src/cargo-closure-input.test.ts +432 -62
- package/src/cargo-closure-input.ts +51 -57
- package/src/cargo-dev-profile.ts +137 -0
- package/src/cargo-resolve-cache.test.ts +1044 -0
- package/src/cargo-source-hash.test.ts +203 -93
- package/src/cargo-source-hash.ts +762 -75
- package/src/cargo-toolchain-policy.ts +6 -0
- package/src/cargo-workspace.test.ts +320 -0
- package/src/cargo-workspace.ts +344 -18
- package/src/cross-check-policy.test.ts +59 -1
- package/src/cross-check-policy.ts +25 -6
- package/src/disk-command-policy.test.ts +61 -0
- package/src/disk-command-policy.ts +107 -0
- package/src/ensure-built-receipt.test.ts +184 -0
- package/src/ensure-built-receipt.ts +263 -0
- package/src/ensure-built-witness.test.ts +344 -0
- package/src/ensure-built-witness.ts +252 -0
- package/src/ensure-built.test.ts +1043 -483
- package/src/ensure-built.ts +870 -197
- package/src/eslint-file-set.ts +9 -0
- package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
- package/src/executors/bounded-exec/cpu-pool.ts +417 -0
- package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
- package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
- package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
- package/src/executors/bounded-exec/disk-lease.ts +139 -0
- package/src/executors/bounded-exec/executor-host.test.ts +778 -0
- package/src/executors/bounded-exec/executor.test.ts +1116 -63
- package/src/executors/bounded-exec/executor.ts +565 -67
- package/src/executors/bounded-exec/gateway-lease.ts +176 -0
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
- package/src/executors/bounded-exec/progress.test.ts +79 -0
- package/src/executors/bounded-exec/progress.ts +118 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
- package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
- package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
- package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
- package/src/executors/bounded-exec/ram-temp.ts +1918 -0
- package/src/executors/bounded-exec/schema.json +11 -5
- package/src/executors/bounded-exec/schema.ts +27 -11
- package/src/executors/bounded-exec/verdict.test.ts +440 -0
- package/src/executors/bounded-exec/verdict.ts +433 -0
- package/src/executors/shard-timings/executor.ts +36 -0
- package/src/executors/shard-timings/schema.json +21 -0
- package/src/executors/shard-timings/schema.ts +4 -0
- package/src/failure-summary.ts +119 -0
- package/src/generators/bounded-test-targets/generator.test.ts +4 -4
- package/src/generators/bun-test-tracing/generator.test.ts +2 -2
- package/src/generators/create-package/generator.test.ts +6 -0
- package/src/generators/create-package/generator.ts +6 -2
- package/src/host-controller-wiring.test.ts +31 -0
- package/src/index.test.ts +1070 -360
- package/src/index.ts +524 -255
- package/src/linked-snapshots.nx.test.ts +172 -0
- package/src/managed-assets.ts +12 -0
- package/src/managed-files/ci-workflow.ts +54 -13
- package/src/managed-files/files.ts +65 -9
- package/src/managed-files/forgejo-artifact.test.ts +395 -0
- package/src/managed-files/generator.test.ts +60 -1
- package/src/managed-files/json-edit.test.ts +216 -0
- package/src/managed-files/json-edit.ts +290 -0
- package/src/managed-files/managed-format-json.test.ts +308 -0
- package/src/managed-files/managed-format.ts +90 -2
- package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
- package/src/managed-files/publish-workflow.ts +285 -67
- package/src/managed-files/repo-path.test.ts +129 -0
- package/src/managed-files/trace-db-artifact.test.ts +7 -0
- package/src/managed-files/tree.ts +11 -3
- package/src/manifest-hash.ts +3 -2
- package/src/nextest-code-bound.test.ts +155 -0
- package/src/nextest-code-bound.ts +195 -0
- package/src/nextest-extraction.test.ts +37 -5
- package/src/nextest-extraction.ts +51 -9
- package/src/nextest-partitions.test.ts +495 -0
- package/src/nx-cache-bound.test.ts +109 -0
- package/src/nx-cache-restore-mtime.test.ts +170 -0
- package/src/nx-daemon-claim.test.ts +277 -0
- package/src/nx-daemon-idle-cpu.test.ts +81 -0
- package/src/nx-daemon-idle-policy.test.ts +51 -0
- package/src/nx-daemon-ignore-files.test.ts +210 -0
- package/src/nx-daemon-root-normalization.test.ts +105 -0
- package/src/nx-daemon-validity.test.ts +925 -0
- package/src/nx-dot-input-policy.test.ts +353 -0
- package/src/nx-failure-life-cycles.test.ts +207 -0
- package/src/nx-files-archive-racy.test.ts +97 -0
- package/src/nx-foreign-workspace-env.test.ts +329 -0
- package/src/nx-incomplete-run-summary.test.ts +70 -0
- package/src/nx-plugin-load-errors.test.ts +120 -0
- package/src/nx-project-resolution-cache.test.ts +176 -0
- package/src/nx-raw-inputs.test.ts +166 -0
- package/src/nx-resident-graph-workers.test.ts +112 -0
- package/src/nx-run-information.test.ts +118 -0
- package/src/nx-skipped-task-exit.test.ts +180 -0
- package/src/nx-state-location.test.ts +63 -0
- package/src/nx-store-resolution.test.ts +99 -0
- package/src/nx-task-graph-cycles.test.ts +148 -0
- package/src/nx-task-output-lease.test.ts +414 -0
- package/src/nx-use-local.test.ts +103 -0
- package/src/package-target-policy.ts +3 -6
- package/src/release-config-policy.ts +3 -6
- package/src/runtime-input.test.ts +215 -0
- package/src/runtime-input.ts +17 -0
- package/src/rust-tokens.ts +78 -0
- package/src/serial-group-wiring.test.ts +326 -0
- package/src/task-history-namespace.test.ts +181 -0
- package/src/task-results.test.ts +226 -0
- package/src/task-results.ts +75 -0
- package/src/test-program.test.ts +303 -0
- package/src/test-program.ts +341 -0
- package/src/test-timings.test.ts +240 -0
- package/src/test-timings.ts +311 -0
- package/src/test-walk-policy.test.ts +585 -0
- package/src/test-walk-policy.ts +731 -0
- package/src/testing.test.ts +509 -0
- package/src/testing.ts +922 -0
- package/src/type-guards.ts +4 -0
- package/src/typecheck-test-policy.test.ts +496 -11
- package/src/typecheck-test-policy.ts +137 -103
- package/src/workspace-config-policy.test.ts +212 -13
- package/src/workspace-config-policy.ts +101 -73
- package/src/workspace-index.ts +18 -0
- package/src/workspace-manifest.ts +41 -1
- package/test-timings.json +85 -28
- package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -615
- package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
- package/src/__tests__/in-process-nx-index.ts +0 -9
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/** One process as `ps` lists it. */
|
|
2
|
+
export interface ProcessEntry {
|
|
3
|
+
readonly pid: number;
|
|
4
|
+
readonly ppid: number;
|
|
5
|
+
/** `ps` state; a leading `Z` is a zombie, which has exited. */
|
|
6
|
+
readonly stat: string;
|
|
7
|
+
readonly command: string;
|
|
8
|
+
}
|
|
9
|
+
/** Every process on the host, as `ps` lists it on macOS and Linux alike. */
|
|
10
|
+
export declare function processTable(): Promise<ProcessEntry[]>;
|
|
11
|
+
/**
|
|
12
|
+
* The listed processes among `pids`, and every process descending from one, each once: a pid that
|
|
13
|
+
* descends from another in `pids` is not listed twice.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withDescendants(table: readonly ProcessEntry[], pids: readonly number[]): ProcessEntry[];
|
|
16
|
+
/** Whether `pid` names a process, this user's or not. A zombie still answers. */
|
|
17
|
+
export declare function isRunning(pid: number): boolean;
|
|
18
|
+
/** Signal `pid`; one that has already exited is not an error. */
|
|
19
|
+
export declare function terminate(pid: number, signal?: NodeJS.Signals): void;
|
|
20
|
+
/**
|
|
21
|
+
* Wait until every one of `processes` has exited. One still running
|
|
22
|
+
* `timeoutMs` later is an error naming it and `owner`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function awaitExit(processes: readonly ProcessEntry[], owner: string, timeoutMs?: number): Promise<void>;
|
|
25
|
+
/** Every process of this user whose working directory is `root` or lies beneath it, deleted or not. */
|
|
26
|
+
export declare function pidsWorkingIn(root: string): Promise<number[]>;
|
|
27
|
+
/**
|
|
28
|
+
* The Nx daemon `workspace` runs, the daemon first, then every process it
|
|
29
|
+
* started. Empty when the workspace records no daemon or the recorded one is
|
|
30
|
+
* gone. The record is `d/server-process.json` under the workspace's own
|
|
31
|
+
* `.nx/workspace-data`, where every fixture keeps its Nx state.
|
|
32
|
+
*/
|
|
33
|
+
export declare function nxDaemonProcesses(workspace: string): Promise<ProcessEntry[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Release the Nx daemon `workspace` started and wait until the daemon and
|
|
36
|
+
* every process it ran have exited. `stop` runs `nx daemon --stop` against
|
|
37
|
+
* the workspace, in the environment that started it. Nx deletes the daemon's
|
|
38
|
+
* record before the daemon exits, so the record cannot say when the workspace
|
|
39
|
+
* is free to delete; the processes can. The daemon also leaves what it
|
|
40
|
+
* spawned to end on its own: plugin workers once they see it gone, the editor
|
|
41
|
+
* extension probe it starts at launch never. Those get SIGTERM with it, the
|
|
42
|
+
* ones it started while it was stopping included. A child that outlives the
|
|
43
|
+
* daemon is reparented to init and leaves the daemon's process tree, but it
|
|
44
|
+
* still works in the workspace, so the workspace census ends what is left.
|
|
45
|
+
* A missing record can mean startup has not published it yet: skip the
|
|
46
|
+
* daemon-stop command, but never skip the working-directory census.
|
|
47
|
+
*/
|
|
48
|
+
export declare function stopNxDaemon(workspace: string, stop: () => Promise<void>): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* A fresh fixture root for `suite`, owned by this process: a `prefix`-named
|
|
51
|
+
* directory (mode 0700) in this process's run directory under
|
|
52
|
+
* `parentDirectory`, `<parent>/smoothbricks-fixtures/<suite>/run-<pid>`. The
|
|
53
|
+
* caller always names the parent: the temp directory, or the directory of the
|
|
54
|
+
* volume the fixture has to lie on. The parent is resolved through every link,
|
|
55
|
+
* so the root is canonical (macOS puts the temp directory behind a /private
|
|
56
|
+
* symlink, and a daemon never sees an edit made under a root named through
|
|
57
|
+
* one) and a parent spelled two ways is one run. A process holds one run for
|
|
58
|
+
* each parent and suite, and the first root of a suite under a parent reclaims
|
|
59
|
+
* that suite's dead runs there first. Once a signal has this process
|
|
60
|
+
* reclaiming its runs, no root is made.
|
|
61
|
+
*/
|
|
62
|
+
export declare function ownedFixtureRoot(parentDirectory: string, suite: string, prefix: string): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Stop every process working in a run of `suite` under `parentDirectory` whose
|
|
65
|
+
* owner is gone, then delete the run, and return the suite's directory there.
|
|
66
|
+
* The first fixture root of a suite under a parent in a process does this; a
|
|
67
|
+
* test that just watched a fixture-owning process die may too. An owner's pid
|
|
68
|
+
* reused by an unrelated process makes its run look alive; it is reclaimed once
|
|
69
|
+
* that process is gone too, never early.
|
|
70
|
+
*/
|
|
71
|
+
export declare function reclaimDeadFixtureRuns(parentDirectory: string, suite: string): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* The longest socket Nx binds in a configured socket directory: an isolated
|
|
74
|
+
* plugin worker's `p<pid>-<counter>-<8 hex>.sock` (`getPluginSocketFileName`;
|
|
75
|
+
* with a configured directory `getPluginSocketDir` is the daemon's own), which
|
|
76
|
+
* outgrows the daemon's `d.sock` and a forked task's `fp<pid>-<n>.sock`. macOS
|
|
77
|
+
* pids stop at 99999, Linux's have seven digits; two base-36 digits count 1295
|
|
78
|
+
* workers.
|
|
79
|
+
*/
|
|
80
|
+
export declare const NX_LONGEST_SOCKET_NAME: string;
|
|
81
|
+
/** Where a fixture's sockets are made, and the candidates passed over on the way there. */
|
|
82
|
+
export interface SocketNamespace {
|
|
83
|
+
readonly directory: string;
|
|
84
|
+
/** Each environment root not used, and why: carried into every refusal made in this namespace. */
|
|
85
|
+
readonly passedOver: readonly string[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The directory a fixture's sockets are made in: a short root this process's
|
|
89
|
+
* own environment supplies for the checkout it runs in. In order: the parent
|
|
90
|
+
* of `NX_SOCKET_DIR`, which for a Cowshed job is the workspace's short runtime
|
|
91
|
+
* link (its Nx socket directory is `nx` below it); `COWSHED_RUNTIME_LINK`,
|
|
92
|
+
* that link; else the temp directory. Never `NX_SOCKET_DIR` itself: Nx deletes
|
|
93
|
+
* that directory, recursively and whatever else is in it, whenever its daemon
|
|
94
|
+
* stops, so a fixture's sockets live beside it. The sandbox admits Unix sockets
|
|
95
|
+
* under the link by its literal path, and under the temp directory only for a
|
|
96
|
+
* job's own `TMPDIR`. Spelled as the environment gives it and never resolved,
|
|
97
|
+
* since the physical path is too long for a socket.
|
|
98
|
+
*
|
|
99
|
+
* As `nx-socket-dir.sh` does, a shell's variable is trusted only when it is
|
|
100
|
+
* this checkout's. The public finder names the checkout from the working
|
|
101
|
+
* directory; an `NX_SOCKET_DIR` also needs a matching `NX_WORKSPACE_ROOT_PATH`.
|
|
102
|
+
* The link must resolve to that checkout's `.cowshed/run`, even when a test
|
|
103
|
+
* preload has removed the inherited Nx variables. Unproven candidates are
|
|
104
|
+
* passed over with their resolution or permission failure, so the fallback
|
|
105
|
+
* directory, or the length refusal it leads to, names what it fell from. One
|
|
106
|
+
* that is this checkout's but is not an existing directory of this user is an
|
|
107
|
+
* error naming it.
|
|
108
|
+
*/
|
|
109
|
+
export declare function socketNamespace(): SocketNamespace;
|
|
110
|
+
/**
|
|
111
|
+
* `path`, or an error naming it, its length and the namespace it was made in
|
|
112
|
+
* (with what that namespace passed over) when Nx and the kernel would refuse
|
|
113
|
+
* to bind a socket there.
|
|
114
|
+
*/
|
|
115
|
+
export declare function assertSocketPath(path: string, namespace: SocketNamespace): string;
|
|
116
|
+
/**
|
|
117
|
+
* A fresh directory, mode 0700 and named `prefix` plus six random characters,
|
|
118
|
+
* in {@link socketNamespace}: the one owner of the sockets a fixture makes
|
|
119
|
+
* there, so the fixture removes the directory and nothing else. `longestSocketName`
|
|
120
|
+
* is the longest socket it will hold, and the call fails before creating
|
|
121
|
+
* anything when that socket's path would be too long to bind.
|
|
122
|
+
*/
|
|
123
|
+
export declare function ownedSocketDirectory(prefix: string, longestSocketName: string): Promise<string>;
|
|
124
|
+
/**
|
|
125
|
+
* The fixture's `NX_SOCKET_DIR`, named and nothing more: the real `nx` leaf
|
|
126
|
+
* below the short parent alias {@link publishFixtureSocketDirectory} makes in
|
|
127
|
+
* the job's admitted namespace. `workspace` is the physical path that
|
|
128
|
+
* publication was given; the alias is named for a hash of it, so every client,
|
|
129
|
+
* daemon stop and retirement of the workspace names the same leaf, and no two
|
|
130
|
+
* fixtures share one. A long private `TMPDIR` affects neither the bind path nor
|
|
131
|
+
* workspace ownership. A namespace too small for Nx's longest socket name is
|
|
132
|
+
* refused here, so before any publication.
|
|
133
|
+
*/
|
|
134
|
+
export declare function fixtureSocketDirectory(workspace: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Publish the fixture's short socket alias and return its
|
|
137
|
+
* {@link fixtureSocketDirectory}. The workspace must be a physical directory in
|
|
138
|
+
* a fixture run this process holds ({@link ownedFixtureRoot}): then the run's
|
|
139
|
+
* sweep reclaims the alias even if this process dies before its
|
|
140
|
+
* {@link retireFixtureSocketDirectory}. The alias points at the workspace's own
|
|
141
|
+
* `.nx/sockets`, made mode 0700; a symlinked `.nx` or `.nx/sockets` is refused
|
|
142
|
+
* before anything is written through it. Nx makes the `nx` leaf itself.
|
|
143
|
+
*/
|
|
144
|
+
export declare function publishFixtureSocketDirectory(workspace: string): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* A second real leaf, `slot`, beside the `nx` one below the workspace's
|
|
147
|
+
* published alias, for tests whose subject is two daemon socket directories.
|
|
148
|
+
* A slot name is shorter than `nx`, so it fits wherever the published leaf
|
|
149
|
+
* does. An existing slot is an error. Its caller stops the daemon bound in it
|
|
150
|
+
* before removing it.
|
|
151
|
+
*/
|
|
152
|
+
export declare function ownedWorkspaceSocketDirectory(workspace: string, slot: 'a' | 'b'): Promise<string>;
|
|
153
|
+
/**
|
|
154
|
+
* After the daemon exits, unlink only this workspace's verified parent alias,
|
|
155
|
+
* not its target. Named from the workspace's path alone, so a workspace already
|
|
156
|
+
* deleted retires too. No alias is not an error; any other entry under its name
|
|
157
|
+
* is refused and left in place.
|
|
158
|
+
*/
|
|
159
|
+
export declare function retireFixtureSocketDirectory(workspace: string): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Bind a real listener where a Cowshed job's other processes can connect to
|
|
162
|
+
* it. In a block, `bind` is called with each candidate `base+1 … base+size-1`,
|
|
163
|
+
* lowest first (a long-lived test listener scans from the bottom), and the
|
|
164
|
+
* first that binds is kept: only a real bind claims a port, so nothing probes
|
|
165
|
+
* and closes. Only `EADDRINUSE` (by `code`) moves on to the next candidate;
|
|
166
|
+
* any other failure is that bind's own and surfaces as is, and so does the
|
|
167
|
+
* last candidate's, so an exhausted block reports `EADDRINUSE`, never a silent
|
|
168
|
+
* port 0. Outside a block `bind` is called with 0, and the kernel picks.
|
|
169
|
+
*
|
|
170
|
+
* `bind` creates and binds one listener per call and returns it, and a failed
|
|
171
|
+
* bind leaves nothing behind. It may throw (`Bun.serve` does) or reject (a
|
|
172
|
+
* Node `net` server reports a failed `listen` as an `error` event, which the
|
|
173
|
+
* caller turns into a rejection). The listener the winning call returns is the
|
|
174
|
+
* caller's to keep and close.
|
|
175
|
+
*/
|
|
176
|
+
export declare function bindListener<T>(bind: (port: number) => T | Promise<T>): Promise<T>;
|
|
177
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"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"}
|