fabro/lib/crates/fabro-cli/tests/it/cmd/test_panic.rs
Bryan Helmkamp 63bb494e96 test: speed up slow default-profile tests and tighten nextest thresholds
Remove redundant config_change_after_submission test (1.67s avg) from
fabro-server — already covered by start_run_persists_full_settings_snapshot
and architectural guarantees. Defer reqwest::Client init past validation
in web_search tool so missing-key/missing-query tests skip macOS proxy
discovery (1.56s → 9ms). Move telemetry panic event tests to a CLI IT
via a new cfg(debug_assertions) __test_panic subcommand. Lower default
nextest SLOW threshold from 3s to 1.5s with 2x headroom over the new
worst-case (0.84s).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 13:15:59 -04:00

33 lines
1 KiB
Rust

use fabro_test::test_context;
#[test]
fn builds_event_and_roundtrips_through_json() {
let context = test_context!();
let mut cmd = context.command();
cmd.args(["__test_panic", "test panic message"]);
let output = cmd.output().expect("command should execute");
assert!(output.status.success(), "command failed: {output:?}");
let stdout = String::from_utf8(output.stdout).unwrap();
let event: serde_json::Value = serde_json::from_str(&stdout).unwrap();
assert_eq!(event["level"], "fatal");
let exception = &event["exception"]["values"][0];
assert_eq!(exception["type"], "panic");
assert_eq!(exception["value"], "test panic message");
let mechanism = &exception["mechanism"];
assert_eq!(mechanism["type"], "panic");
assert_eq!(mechanism["handled"], false);
assert!(
exception["stacktrace"].is_object(),
"stacktrace should be present"
);
assert!(
event["contexts"]["os"].is_object(),
"OS context should be present"
);
}