Skip to content

Commit 7a7496f

Browse files
committed
feat: set up trycmd tests
1 parent 8bf6ce9 commit 7a7496f

File tree

6 files changed

+33
-0
lines changed

6 files changed

+33
-0
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ assert_cmd = "2.0.17"
3737
assert_fs = "1.1.3"
3838
insta = "1.43.1"
3939
predicates = "3.1.3"
40+
snapbox = "0.6.21"
4041
tempfile = "3.20.0"
4142
trycmd = "0.15.10"
4243

tests/cli.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use trycmd::TestCases;
2+
3+
#[test]
4+
fn cli_coverage() {
5+
let cases = TestCases::new();
6+
// Ensure cigen resolves to compiled bin
7+
cases.register_bin("cigen", std::path::Path::new(env!("CARGO_BIN_EXE_cigen")));
8+
// Stable env
9+
cases.env("CIGEN_SKIP_CIRCLECI_CLI", "1");
10+
11+
// Note: paths in outputs will be absolute to the CI runner; acceptable for snapshots.
12+
13+
cases.case("tests/cmd/**/*.trycmd");
14+
}

tests/cmd/generate_inline.trycmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$ cd integration_tests/circleci_node_simple_inline
2+
$ cigen generate
3+
? status = 0
4+
Generating CI configuration from:
5+
Generating all workflows
6+
Skipping CircleCI CLI validation due to CIGEN_SKIP_CIRCLECI_CLI environment variable
7+
✅ Generated circleci configuration for all workflows to

tests/cmd/help.trycmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$ cigen --help
2+
? status = 0
3+
A CLI tool that generates CI pipeline configurations from templates
4+
Usage: cigen [OPTIONS] [COMMAND]

tests/cmd/invalid_config.trycmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$ cigen generate --config does-not-exist
2+
? status = 1
3+
Generating CI configuration from:
4+
DEBUG: No .cigen directory found, using current directory as config_dir
5+
DEBUG: validate_all called with base_path:
6+
Error: Failed to load configuration

0 commit comments

Comments
 (0)