@smoothbricks/nx-plugin 0.4.26 → 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 +994 -117
- 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 +15 -73
- 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 +3 -2
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +16 -15
- 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 +43 -6
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +309 -73
- 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 +101 -5
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +291 -10
- 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 +207 -12
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +576 -202
- 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 +370 -138
- 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.d.ts.map +1 -1
- package/dist/manifest-hash.js +2 -5
- 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 -0
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +5 -0
- package/loader.js +13 -11
- package/managed/raw/envrc +33 -67
- 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 +569 -11
- package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -93
- 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 +962 -148
- 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 -41
- package/package.json +74 -12
- package/runtime-input.sh +81 -0
- package/src/__tests__/counted-cargo.ts +33 -14
- package/src/__tests__/fixture-nx-env.ts +111 -46
- 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 +16 -74
- 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 -21
- 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 +138 -66
- package/src/cargo-closure-input.ts +17 -15
- package/src/cargo-dev-profile.ts +137 -0
- package/src/cargo-resolve-cache.test.ts +70 -1
- package/src/cargo-source-hash.test.ts +193 -97
- package/src/cargo-source-hash.ts +345 -68
- package/src/cargo-toolchain-policy.ts +6 -0
- package/src/cargo-workspace.test.ts +320 -0
- package/src/cargo-workspace.ts +336 -10
- 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 +1036 -578
- package/src/ensure-built.ts +820 -224
- 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 +909 -295
- package/src/index.ts +441 -143
- package/src/linked-snapshots.nx.test.ts +172 -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 +2 -6
- 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 +427 -82
- package/src/nx-cache-bound.test.ts +5 -10
- 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 +7 -16
- 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 +26 -25
- 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 +87 -89
- 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 -0
- package/test-timings.json +85 -30
- package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -665
- package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runtimeInput, shellWord } from './runtime-input.js';
|
|
1
2
|
/**
|
|
2
3
|
* The toolchain half of a cargo task's identity, shared by the two things that
|
|
3
4
|
* must agree about it: target inference, which attaches it, and the monorepo
|
|
@@ -56,6 +57,11 @@ export const CARGO_TOOLCHAIN_PIN_INPUTS: readonly string[] = [
|
|
|
56
57
|
*/
|
|
57
58
|
export const CARGO_TOOLCHAIN_NAMED_INPUT = 'cargoToolchain';
|
|
58
59
|
|
|
60
|
+
/** The toolchain versions `command` prints, from the directory whose rust-toolchain selects them. */
|
|
61
|
+
export function cargoRuntimeInput(projectRoot: string, command: string): { runtime: string } {
|
|
62
|
+
return runtimeInput(`sh -c ${shellWord(`cd "$0" && ${command}`)} ${shellWord(projectRoot)}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
/**
|
|
60
66
|
* Does one resolved input string carry the toolchain identity?
|
|
61
67
|
*
|
|
@@ -7,7 +7,13 @@ import { Glob } from 'bun';
|
|
|
7
7
|
import {
|
|
8
8
|
attributeCargoWorkspacePackages,
|
|
9
9
|
cargoPackageTestInputs,
|
|
10
|
+
cargoTestGroupTargetName,
|
|
11
|
+
cargoTestPackageTargetName,
|
|
12
|
+
filterScope,
|
|
10
13
|
listCargoWorkspacePackages,
|
|
14
|
+
packageNameFromCargoTestTarget,
|
|
15
|
+
SERIAL_TEST_GROUP_PLATFORM,
|
|
16
|
+
serialTestGroups,
|
|
11
17
|
} from './cargo-workspace.js';
|
|
12
18
|
|
|
13
19
|
describe('Cargo workspace layouts', () => {
|
|
@@ -121,6 +127,49 @@ describe('Cargo workspace layouts', () => {
|
|
|
121
127
|
}
|
|
122
128
|
});
|
|
123
129
|
|
|
130
|
+
// rustc compiles an `include_str!`/`include_bytes!` file into the unit and Cargo rebuilds when it changes, but the
|
|
131
|
+
// package fileset stops at the package directory: a shipped skill or corpus beside the crates changed nothing in
|
|
132
|
+
// the archive's key, and the runner replayed a verdict about the old bytes.
|
|
133
|
+
it("hashes the files a package's sources compile in from outside its directory", async () => {
|
|
134
|
+
const root = await mkdtemp(join(tmpdir(), 'nx-cargo-compiled-in-'));
|
|
135
|
+
try {
|
|
136
|
+
await write(root, 'Cargo.toml', '[workspace]\nmembers=["crates/app"]\n');
|
|
137
|
+
await write(root, 'crates/app/Cargo.toml', '[package]\nname="app"\n');
|
|
138
|
+
await write(
|
|
139
|
+
root,
|
|
140
|
+
'crates/app/src/lib.rs',
|
|
141
|
+
[
|
|
142
|
+
'pub const SKILL: &str = include_str!("../../../skills/SKILL.md");',
|
|
143
|
+
'#[cfg(test)] const CORPUS: &[u8] = include_bytes! ( "../../../corpus.json" );',
|
|
144
|
+
'const INSIDE: &str = include_str!("data/inside.txt");',
|
|
145
|
+
'// Not compiled: include_str!("../../../missing.txt")',
|
|
146
|
+
'const COMPUTED: &str = include_str!(env!("DATA"));',
|
|
147
|
+
].join('\n'),
|
|
148
|
+
);
|
|
149
|
+
await write(root, 'crates/app/src/data/inside.txt', 'inside');
|
|
150
|
+
await write(root, 'skills/SKILL.md', 'skill');
|
|
151
|
+
await write(root, 'skills/OTHER.md', 'unrelated');
|
|
152
|
+
await write(root, 'corpus.json', '[]');
|
|
153
|
+
await write(root, 'crates/app/nested/Cargo.toml', '[package]\nname="nested"\n');
|
|
154
|
+
await write(root, 'crates/app/nested/src/lib.rs', 'const N: &str = include_str!("../../../../nested.txt");');
|
|
155
|
+
await write(root, 'nested.txt', 'another package compiles this');
|
|
156
|
+
|
|
157
|
+
const inputs = await cargoPackageTestInputs({
|
|
158
|
+
workspaceRoot: root,
|
|
159
|
+
absoluteProjectRoot: root,
|
|
160
|
+
memberDir: 'crates/app',
|
|
161
|
+
});
|
|
162
|
+
for (const path of ['skills/SKILL.md', 'corpus.json', 'crates/app/src/data/inside.txt']) {
|
|
163
|
+
expect(matches(inputs, path)).toBe(true);
|
|
164
|
+
}
|
|
165
|
+
for (const path of ['skills/OTHER.md', 'missing.txt', 'nested.txt']) {
|
|
166
|
+
expect(matches(inputs, path)).toBe(false);
|
|
167
|
+
}
|
|
168
|
+
} finally {
|
|
169
|
+
await rm(root, { recursive: true, force: true });
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
124
173
|
it('keeps dependencies outside Cargo but inside Nx as ordinary files and includes ancestor config', async () => {
|
|
125
174
|
const root = await mkdtemp(join(tmpdir(), 'nx-cargo-nested-'));
|
|
126
175
|
try {
|
|
@@ -293,3 +342,274 @@ async function write(root: string, path: string, contents: string): Promise<void
|
|
|
293
342
|
await mkdir(dirname(absolutePath), { recursive: true });
|
|
294
343
|
await writeFile(absolutePath, contents);
|
|
295
344
|
}
|
|
345
|
+
|
|
346
|
+
describe('nextest serial test groups', () => {
|
|
347
|
+
it('derives one serial filter from the default-profile overrides that name a group capped at one thread', async () => {
|
|
348
|
+
const root = await mkdtemp(join(tmpdir(), 'nx-serial-groups-'));
|
|
349
|
+
try {
|
|
350
|
+
const config = join(root, 'nextest.toml');
|
|
351
|
+
await write(
|
|
352
|
+
root,
|
|
353
|
+
'nextest.toml',
|
|
354
|
+
[
|
|
355
|
+
'[test-groups.real-apfs]',
|
|
356
|
+
'max-threads = 1',
|
|
357
|
+
'',
|
|
358
|
+
'[test-groups.wide]',
|
|
359
|
+
'max-threads = 4',
|
|
360
|
+
'',
|
|
361
|
+
'[[profile.default.overrides]]',
|
|
362
|
+
"filter = 'test(/real_apfs_/)'",
|
|
363
|
+
`platform = '${SERIAL_TEST_GROUP_PLATFORM}'`,
|
|
364
|
+
"test-group = 'real-apfs'",
|
|
365
|
+
'',
|
|
366
|
+
'[[profile.default.overrides]]',
|
|
367
|
+
"filter = 'binary(apfs_native_macos)'",
|
|
368
|
+
`platform = '${SERIAL_TEST_GROUP_PLATFORM}'`,
|
|
369
|
+
"test-group = 'real-apfs'",
|
|
370
|
+
'',
|
|
371
|
+
'[[profile.default.overrides]]',
|
|
372
|
+
"filter = 'test(/wide_/)'",
|
|
373
|
+
"test-group = 'wide'",
|
|
374
|
+
'',
|
|
375
|
+
'[[profile.ci.overrides]]',
|
|
376
|
+
"filter = 'test(/ci_only/)'",
|
|
377
|
+
`platform = '${SERIAL_TEST_GROUP_PLATFORM}'`,
|
|
378
|
+
"test-group = 'real-apfs'",
|
|
379
|
+
'',
|
|
380
|
+
].join('\n'),
|
|
381
|
+
);
|
|
382
|
+
expect(serialTestGroups(config)).toEqual([
|
|
383
|
+
{
|
|
384
|
+
group: 'real-apfs',
|
|
385
|
+
filter: '(test(/real_apfs_/)) or (binary(apfs_native_macos))',
|
|
386
|
+
scope: { kind: 'workspace' },
|
|
387
|
+
},
|
|
388
|
+
]);
|
|
389
|
+
} finally {
|
|
390
|
+
await rm(root, { recursive: true, force: true });
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('scopes each group to the packages its overrides name, and to the workspace once any override names none', async () => {
|
|
395
|
+
const root = await mkdtemp(join(tmpdir(), 'nx-serial-scope-'));
|
|
396
|
+
const override = (filter: string, group: string): string[] => [
|
|
397
|
+
'[[profile.default.overrides]]',
|
|
398
|
+
`filter = '${filter}'`,
|
|
399
|
+
`platform = '${SERIAL_TEST_GROUP_PLATFORM}'`,
|
|
400
|
+
`test-group = '${group}'`,
|
|
401
|
+
'',
|
|
402
|
+
];
|
|
403
|
+
try {
|
|
404
|
+
await write(
|
|
405
|
+
root,
|
|
406
|
+
'nextest.toml',
|
|
407
|
+
[
|
|
408
|
+
'[test-groups.device]',
|
|
409
|
+
'max-threads = 1',
|
|
410
|
+
'',
|
|
411
|
+
'[test-groups.host]',
|
|
412
|
+
'max-threads = 1',
|
|
413
|
+
'',
|
|
414
|
+
'[test-groups.loose]',
|
|
415
|
+
'max-threads = 1',
|
|
416
|
+
'',
|
|
417
|
+
...override('package(apfs) and test(/real_/)', 'device'),
|
|
418
|
+
...override('package(core) and (test(/real_/) or binary(native))', 'host'),
|
|
419
|
+
...override('package(cli) and test(/real_/)', 'host'),
|
|
420
|
+
...override('package(apfs) and test(/loose_/)', 'loose'),
|
|
421
|
+
...override('test(/loose_/)', 'loose'),
|
|
422
|
+
].join('\n'),
|
|
423
|
+
);
|
|
424
|
+
expect(serialTestGroups(join(root, 'nextest.toml'))).toEqual([
|
|
425
|
+
{
|
|
426
|
+
group: 'device',
|
|
427
|
+
filter: '(package(apfs) and test(/real_/))',
|
|
428
|
+
scope: { kind: 'packages', packages: ['apfs'] },
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
// Several overrides of one group are one union, scoped to the packages of every clause.
|
|
432
|
+
group: 'host',
|
|
433
|
+
filter: '(package(core) and (test(/real_/) or binary(native))) or (package(cli) and test(/real_/))',
|
|
434
|
+
scope: { kind: 'packages', packages: ['cli', 'core'] },
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
// One override scoped to no package leaves the group's runner hashing every member.
|
|
438
|
+
group: 'loose',
|
|
439
|
+
filter: '(package(apfs) and test(/loose_/)) or (test(/loose_/))',
|
|
440
|
+
scope: { kind: 'workspace' },
|
|
441
|
+
},
|
|
442
|
+
]);
|
|
443
|
+
} finally {
|
|
444
|
+
await rm(root, { recursive: true, force: true });
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
it('declares no serial group when the config is absent or names no group capped at one thread', async () => {
|
|
449
|
+
const root = await mkdtemp(join(tmpdir(), 'nx-serial-none-'));
|
|
450
|
+
try {
|
|
451
|
+
expect(serialTestGroups(join(root, 'missing.toml'))).toEqual([]);
|
|
452
|
+
await write(root, 'nextest.toml', '[test-groups.wide]\nmax-threads = 4\n');
|
|
453
|
+
expect(serialTestGroups(join(root, 'nextest.toml'))).toEqual([]);
|
|
454
|
+
} finally {
|
|
455
|
+
await rm(root, { recursive: true, force: true });
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it('refuses a serial override that declares no macOS platform rather than guessing where the group applies', async () => {
|
|
460
|
+
const root = await mkdtemp(join(tmpdir(), 'nx-serial-platform-'));
|
|
461
|
+
try {
|
|
462
|
+
await write(
|
|
463
|
+
root,
|
|
464
|
+
'nextest.toml',
|
|
465
|
+
"[test-groups.real-apfs]\nmax-threads = 1\n\n[[profile.default.overrides]]\nfilter = 'test(/real_apfs_/)'\ntest-group = 'real-apfs'\n",
|
|
466
|
+
);
|
|
467
|
+
expect(() => serialTestGroups(join(root, 'nextest.toml'))).toThrow(/must declare platform/);
|
|
468
|
+
} finally {
|
|
469
|
+
await rm(root, { recursive: true, force: true });
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('never reads a serial group runner as a crate, and refuses a crate that would take its name', () => {
|
|
474
|
+
expect(packageNameFromCargoTestTarget(cargoTestGroupTargetName('real-apfs'))).toBeNull();
|
|
475
|
+
expect(packageNameFromCargoTestTarget(cargoTestPackageTargetName('big', 'shard1'))).toBe('big');
|
|
476
|
+
expect(() => cargoTestPackageTargetName('group-real-apfs')).toThrow(/reserved/);
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
describe('nextest filter scopes', () => {
|
|
481
|
+
it('bounds a filter by the packages it is scoped to, however its operators and blanks are spelled', () => {
|
|
482
|
+
const scoped: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
483
|
+
// A plain name, with or without nextest's equality prefix, bare or parenthesised.
|
|
484
|
+
['package(cowshed-apfs)', ['cowshed-apfs']],
|
|
485
|
+
['package(=cowshed_apfs)', ['cowshed_apfs']],
|
|
486
|
+
['(package(a))', ['a']],
|
|
487
|
+
['((package(a)))', ['a']],
|
|
488
|
+
// `and`, `&` and `-` keep the package of the side that names one, with or without blanks around them.
|
|
489
|
+
['package(a) and test(/x/)', ['a']],
|
|
490
|
+
['package(a) & test(/x/)', ['a']],
|
|
491
|
+
['package(a)&test(/x/)', ['a']],
|
|
492
|
+
['package(a) - test(/x/)', ['a']],
|
|
493
|
+
['package(a)-test(/x/)', ['a']],
|
|
494
|
+
['package(a) and not test(/x/)', ['a']],
|
|
495
|
+
['package(a) and !test(/x/)', ['a']],
|
|
496
|
+
['package(a) and not(test(/x/))', ['a']],
|
|
497
|
+
['test(/x/) and package(a)', ['a']],
|
|
498
|
+
['binary(b) & (package(a) or package(c))', ['a', 'c']],
|
|
499
|
+
// An intersection takes the narrower side.
|
|
500
|
+
['(package(a) or package(b)) and package(a)', ['a']],
|
|
501
|
+
['package(a) and (package(a) or package(b))', ['a']],
|
|
502
|
+
// A union is bounded by every clause, once each, in any spelling and order.
|
|
503
|
+
['package(b) or package(a)', ['a', 'b']],
|
|
504
|
+
['package(b) | package(a)', ['a', 'b']],
|
|
505
|
+
['package(b)+package(a)', ['a', 'b']],
|
|
506
|
+
['package(a) or package(a)', ['a']],
|
|
507
|
+
// `and` binds tighter than `or`, so each clause keeps its own package.
|
|
508
|
+
['package(a) and test(/x/) or package(b) and test(/y/)', ['a', 'b']],
|
|
509
|
+
['package(a) or package(b) and test(/y/)', ['a', 'b']],
|
|
510
|
+
['(package(a) and test(/x/)) or (package(b) and (test(/y/) or binary(z)))', ['a', 'b']],
|
|
511
|
+
// A difference is bounded by what it subtracts from, not by what it subtracts.
|
|
512
|
+
['(package(a) or package(b)) - package(a)', ['a', 'b']],
|
|
513
|
+
['package(a) - package(b)', ['a']],
|
|
514
|
+
// Operators and parentheses inside a matcher are its text, not the filter's syntax.
|
|
515
|
+
['package(a) and test(/x or y | z + w - v & u (/)', ['a']],
|
|
516
|
+
['package(a) and test(/(x|y)z/)', ['a']],
|
|
517
|
+
['package(a) and test(/[)] | package(b) | [x]/)', ['a']],
|
|
518
|
+
['package(a) and test(~one and two or three)', ['a']],
|
|
519
|
+
['package(a) and test(=m::t::f_or_g)', ['a']],
|
|
520
|
+
// nextest reads the line endings of a multi-line TOML string as blanks.
|
|
521
|
+
['package(a)\n and test(/x/)\n or package(b)', ['a', 'b']],
|
|
522
|
+
['package(a)\r\n and test(/x/)', ['a']],
|
|
523
|
+
];
|
|
524
|
+
for (const [filter, packages] of scoped) {
|
|
525
|
+
expect(filterScope(filter), JSON.stringify(filter)).toEqual({ kind: 'packages', packages });
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
it('is the whole workspace for whatever can select from every package, or cannot be read with certainty', () => {
|
|
530
|
+
const workspace: readonly string[] = [
|
|
531
|
+
// Scoped to no package at all.
|
|
532
|
+
'test(/real_apfs_/)',
|
|
533
|
+
'binary(apfs_native_macos)',
|
|
534
|
+
'all()',
|
|
535
|
+
'default()',
|
|
536
|
+
'none()',
|
|
537
|
+
// One unscoped clause leaves a union unscoped, whatever spells the union.
|
|
538
|
+
'package(a) or test(/x/)',
|
|
539
|
+
'package(a) | test(/x/)',
|
|
540
|
+
'package(a)+test(/x/)',
|
|
541
|
+
'test(/x/) or package(a)',
|
|
542
|
+
'(package(a) and test(/x/)) or binary(b)',
|
|
543
|
+
// `and`, `&` and `-` bind tighter than `or`, `|` and `+`, with or without blanks: the union is not under the package.
|
|
544
|
+
'package(a) and test(/x/) | test(/y/)',
|
|
545
|
+
'package(a) and test(/x/)|test(/y/)',
|
|
546
|
+
'package(a) & test(/x/) + test(/y/)',
|
|
547
|
+
'package(a)&test(/x/)+test(/y/)',
|
|
548
|
+
'package(a) and test(/x/) or test(/y/)',
|
|
549
|
+
'(package(a) and test(/x/))|test(/y/)',
|
|
550
|
+
// Negation selects from every other package.
|
|
551
|
+
'not package(a)',
|
|
552
|
+
'!package(a)',
|
|
553
|
+
'not (package(a))',
|
|
554
|
+
'!(package(a) or package(b))',
|
|
555
|
+
'package(a) or not package(b)',
|
|
556
|
+
'not not package(a)',
|
|
557
|
+
// A name that a glob, a substring or a regex can widen.
|
|
558
|
+
'package(cowshed-*)',
|
|
559
|
+
'package(cowshed-ap?s)',
|
|
560
|
+
'package(~apfs)',
|
|
561
|
+
'package(/apfs/)',
|
|
562
|
+
'package(#cowshed-apfs)',
|
|
563
|
+
'package(=a*)',
|
|
564
|
+
'package(a|b)',
|
|
565
|
+
'package(a b)',
|
|
566
|
+
'package( a)',
|
|
567
|
+
'package(a )',
|
|
568
|
+
'package()',
|
|
569
|
+
'package(=)',
|
|
570
|
+
// Predicates that reach past the package they name.
|
|
571
|
+
'deps(a)',
|
|
572
|
+
'rdeps(a)',
|
|
573
|
+
'binary_id(a)',
|
|
574
|
+
'kind(lib)',
|
|
575
|
+
'platform(host)',
|
|
576
|
+
'group(g)',
|
|
577
|
+
// An argument whose end depends on nextest's escapes, or a comma, which nextest refuses.
|
|
578
|
+
'package(a) and test(=x\\)) | test(y)',
|
|
579
|
+
'package(a) and test(/x\\/y/) | test(z)',
|
|
580
|
+
'package(a) and test(=x,y)',
|
|
581
|
+
'package(a,b)',
|
|
582
|
+
// A union that only an exact reading of the regexes finds.
|
|
583
|
+
'package(a) and test(/(/) | test(/)/)',
|
|
584
|
+
// Not a filterset nextest accepts.
|
|
585
|
+
'',
|
|
586
|
+
' ',
|
|
587
|
+
'package(a',
|
|
588
|
+
'package(a))',
|
|
589
|
+
'(package(a)',
|
|
590
|
+
'package(a) and',
|
|
591
|
+
'and package(a)',
|
|
592
|
+
'package(a) or',
|
|
593
|
+
'| package(a)',
|
|
594
|
+
'package(a) && test(/x/)',
|
|
595
|
+
'package(a) || test(/x/)',
|
|
596
|
+
'package(a) AND test(/x/)',
|
|
597
|
+
'package(a) OR package(b)',
|
|
598
|
+
'NOT package(a)',
|
|
599
|
+
'package(a) test(/x/)',
|
|
600
|
+
'package(a) and and test(/x/)',
|
|
601
|
+
'Package(a)',
|
|
602
|
+
'packages(a)',
|
|
603
|
+
'package a',
|
|
604
|
+
'package(a)\tand test(/x/)',
|
|
605
|
+
'test(/x/',
|
|
606
|
+
'test(/x/ y)',
|
|
607
|
+
'test(/a/b/)',
|
|
608
|
+
// Packages that exclude each other leave nothing to name.
|
|
609
|
+
'package(a) and package(b)',
|
|
610
|
+
];
|
|
611
|
+
for (const filter of workspace) {
|
|
612
|
+
expect(filterScope(filter), JSON.stringify(filter)).toEqual({ kind: 'workspace' });
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
});
|