1- import { describe , it , expect , mock , beforeEach , afterEach } from "bun:test" ;
1+ import { describe , it , expect , mock , beforeEach , afterEach , test } from "bun:test" ;
2+
3+ // Skip network-dependent tests in CI environments to avoid flakiness
4+ const isCI = process . env . CI === "true" ;
5+ const describeNetwork = isCI ? describe . skip : describe ;
26import {
37 fetchWithTimeout ,
48 fetchWithRetry ,
@@ -135,7 +139,7 @@ describe("fetch utilities", () => {
135139 } ) ;
136140 } ) ;
137141
138- describe ( "fetchWithTimeout" , ( ) => {
142+ describeNetwork ( "fetchWithTimeout" , ( ) => {
139143 it ( "successfully fetches when request completes before timeout" , async ( ) => {
140144 // Use a real endpoint that responds quickly
141145 const response = await fetchWithTimeout ( "https://httpbin.org/get" , {
@@ -156,13 +160,15 @@ describe("fetch utilities", () => {
156160 expect ( ( error as FetchTimeoutError ) . message ) . toContain ( "timed out after 100ms" ) ;
157161 }
158162 } ) ;
163+ } ) ;
159164
165+ describe ( "fetchWithTimeout constants" , ( ) => {
160166 it ( "uses default timeout when not specified" , ( ) => {
161167 expect ( DEFAULT_TIMEOUT_MS ) . toBe ( 10000 ) ;
162168 } ) ;
163169 } ) ;
164170
165- describe ( "fetchWithRetry" , ( ) => {
171+ describeNetwork ( "fetchWithRetry" , ( ) => {
166172 it ( "succeeds on first attempt for successful requests" , async ( ) => {
167173 const response = await fetchWithRetry ( "https://httpbin.org/get" , {
168174 retry : { maxRetries : 3 } ,
@@ -183,7 +189,9 @@ describe("fetch utilities", () => {
183189 } ) ;
184190 expect ( response . ok ) . toBe ( true ) ;
185191 } ) ;
192+ } ) ;
186193
194+ describe ( "fetchWithRetry constants" , ( ) => {
187195 it ( "uses default retry config when not specified" , ( ) => {
188196 expect ( DEFAULT_RETRY_CONFIG . maxRetries ) . toBe ( 3 ) ;
189197 expect ( DEFAULT_RETRY_CONFIG . initialDelayMs ) . toBe ( 1000 ) ;
@@ -192,7 +200,7 @@ describe("fetch utilities", () => {
192200 } ) ;
193201 } ) ;
194202
195- describe ( "resilientFetch" , ( ) => {
203+ describeNetwork ( "resilientFetch" , ( ) => {
196204 it ( "successfully fetches with both timeout and retry protection" , async ( ) => {
197205 const response = await resilientFetch ( "https://httpbin.org/get" , {
198206 timeoutMs : 10000 ,
@@ -254,7 +262,7 @@ describe("fetch utilities", () => {
254262 } ) ;
255263 } ) ;
256264
257- describe ( "integration with markdown-agent use cases" , ( ) => {
265+ describeNetwork ( "integration with markdown-agent use cases" , ( ) => {
258266 it ( "fetches GitHub raw content" , async ( ) => {
259267 // Test fetching a well-known, stable GitHub file
260268 const response = await resilientFetch (
0 commit comments