Skip to content

Commit caffe69

Browse files
committed
cli: Add Nix entrypoint for config-precedence integration tests
Add flake app to run compiled-binary config precedence tests via nix run .#cli-config-precedence-integration-tests.
1 parent 0f8b127 commit caffe69

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

cli/flake.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@
111111
};
112112
};
113113

114+
apps.config-precedence-integration-tests = {
115+
type = "app";
116+
program = toString (
117+
pkgs.writeShellScript "sce-config-precedence-integration-tests" ''
118+
exec ${rustToolchain}/bin/cargo test --manifest-path cli/Cargo.toml --test config_precedence_integration "$@"
119+
''
120+
);
121+
meta = {
122+
description = "Run config-precedence integration tests for the sce CLI crate";
123+
};
124+
};
125+
114126
checks.cli-setup-command-surface = mkCheck "sce-cli-setup-command-surface-check" ''
115127
runHook preCheck
116128

context/plans/cli-config-precedence-nix-e2e.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,41 @@
142142
'';
143143
};
144144

145+
cliConfigPrecedenceIntegrationTestsApp = pkgs.writeShellApplication {
146+
name = "cli-config-precedence-integration-tests";
147+
runtimeInputs = [
148+
pkgs.git
149+
pkgs.nix
150+
];
151+
text = ''
152+
set -euo pipefail
153+
154+
usage() {
155+
cat <<'EOF'
156+
Usage: nix run .#cli-config-precedence-integration-tests [-- --help]
157+
158+
Deterministic flake entrypoint for opt-in config-precedence integration tests.
159+
Runs the compiled-binary config precedence suite from cli/tests/config_precedence_integration.rs.
160+
This test slice is intentionally excluded from default nix flake check.
161+
EOF
162+
}
163+
164+
case "''${1:-}" in
165+
-h|--help)
166+
usage
167+
exit 0
168+
;;
169+
esac
170+
171+
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
172+
if [ -z "''${repo_root}" ]; then
173+
repo_root="$(pwd)"
174+
fi
175+
176+
exec nix develop "''${repo_root}" -c cargo test --manifest-path cli/Cargo.toml --test config_precedence_integration -- --nocapture
177+
'';
178+
};
179+
145180
agnixLspShim = pkgs.writeShellScriptBin "agnix-lsp" ''
146181
set -euo pipefail
147182
@@ -205,6 +240,14 @@
205240
};
206241
};
207242

243+
apps.cli-config-precedence-integration-tests = {
244+
type = "app";
245+
program = "${cliConfigPrecedenceIntegrationTestsApp}/bin/cli-config-precedence-integration-tests";
246+
meta = {
247+
description = "Run opt-in config-precedence integration tests via Rust harness";
248+
};
249+
};
250+
208251
devShells.default = pkgs.mkShell {
209252
packages =
210253
with pkgs;
@@ -240,6 +283,7 @@
240283
echo "- sync-opencode-config help: nix run .#sync-opencode-config -- --help"
241284
echo "- pkl-check-generated: nix run .#pkl-check-generated"
242285
echo "- cli-integration-tests: nix run .#cli-integration-tests"
286+
echo "- cli-config-precedence-integration-tests: nix run .#cli-config-precedence-integration-tests"
243287
'';
244288
};
245289
}

0 commit comments

Comments
 (0)