1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Integration tests for `opencode_rs`.
//!
//! These tests verify typed deserialization against a live opencode server.
//!
//! # Running the tests
//!
//! With `server` feature (recommended - auto-spawns server):
//! The parent `integration.rs` module starts a `ManagedServer`. These tests
//! call `super::start_server()` directly to ensure the server is initialized
//! before obtaining the URL.
//!
//! Without `server` feature (manual server):
//! 1. Start the opencode server: `opencode serve --port 4096 --hostname 127.0.0.1`
//! 2. Set the environment variable: `OPENCODE_INTEGRATION=1`
//! 3. Optionally set `OPENCODE_BASE_URL` (defaults to `http://127.0.0.1:4096`)
//! 4. Run the tests: `cargo test --test integration -- --ignored`
// Integration tests are allowed to use unwrap/expect for test assertions
/// Check if integration tests should run.
// ============================================================================
// Server feature enabled: Get URL from managed server directly
// ============================================================================
/// Create a test client connected to the managed test server.
///
/// This calls `super::start_server()` to ensure the managed server is started,
/// then uses its URL directly. This removes the dependency on test execution
/// order that previously existed when relying on `OPENCODE_BASE_URL` being
/// pre-populated by a parent test.
pub async
// ============================================================================
// Server feature disabled: Connect to pre-running server via env var
// ============================================================================
/// Get the test server URL from environment.
/// Create a test client connected to a pre-running test server.
pub async