mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
Adopt uv's testing pattern: a shared `fabro-test` crate with TestContext and fabro_snapshot! macro, plus one test file per subcommand under tests/it/cmd/. This replaces the trycmd-based tests which were hard to read and didn't compose well with programmatic assertions. - Create lib/crates/fabro-test with TestContext, run_and_format, apply_filters, INSTA_FILTERS, and test_context!/fabro_snapshot! macros - Add 42 snapshot tests across 16 subcommand files - Delete trycmd.rs and all tests/cmd/ trycmd files - Remove trycmd dependency, add fabro-test dev-dependency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
1.3 KiB
Rust
32 lines
1.3 KiB
Rust
use fabro_test::{fabro_snapshot, test_context};
|
|
|
|
#[test]
|
|
fn help() {
|
|
let context = test_context!();
|
|
let mut cmd = context.preview();
|
|
cmd.arg("--help");
|
|
fabro_snapshot!(context.filters(), cmd, @"
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
Get a preview URL for a port on a run's sandbox
|
|
|
|
Usage: fabro preview [OPTIONS] <RUN> <PORT>
|
|
|
|
Arguments:
|
|
<RUN> Run ID or prefix
|
|
<PORT> Port number
|
|
|
|
Options:
|
|
--debug Enable DEBUG-level logging (default is INFO) [env: FABRO_DEBUG=]
|
|
--signed Generate a signed URL (embeds auth token, no headers needed)
|
|
--no-upgrade-check Disable automatic upgrade check [env: FABRO_NO_UPGRADE_CHECK=true]
|
|
--ttl <TTL> Signed URL expiry in seconds (default 3600, requires --signed) [default: 3600]
|
|
--open Open URL in browser (implies --signed)
|
|
--quiet Suppress non-essential output [env: FABRO_QUIET=]
|
|
--verbose Enable verbose output [env: FABRO_VERBOSE=]
|
|
--storage-dir <STORAGE_DIR> Storage directory (default: ~/.fabro) [env: FABRO_STORAGE_DIR=[STORAGE_DIR]]
|
|
-h, --help Print help
|
|
----- stderr -----
|
|
");
|
|
}
|