@@ -180,6 +180,7 @@ export function createRunner(...paths: string[]) {
180180 let withEnv : Record < string , string | undefined > = { } ;
181181 let withSentryServer = false ;
182182 let ensureNoErrorOutput = false ;
183+ let autoFlush = true ;
183184 // When set, the test using this runner expects `completed()` to reject (e.g. `test.fails` variants
184185 // created via `createEsmAndCjsTests` with `failsOnEsm`/`failsOnCjs`). We suppress the captured-log
185186 // dump in that case, since the failure is expected and the output would just be noise.
@@ -330,6 +331,11 @@ export function createRunner(...paths: string[]) {
330331 unordered = true ;
331332 return this ;
332333 } ,
334+ /** Skip the injected `beforeExit` flush, so the test sees only what the SDK sends on its own. */
335+ withoutAutoFlush : function ( ) {
336+ autoFlush = false ;
337+ return this ;
338+ } ,
333339 ensureNoErrorOutput : function ( ) {
334340 if ( expectedEnvelopes . length > 0 ) {
335341 throw new Error ( 'You should not use `ensureNoErrorOutput` when using `expect`!' ) ;
@@ -630,7 +636,7 @@ export function createRunner(...paths: string[]) {
630636 // `should-exit`, `ensureNoErrorOutput`) verify the child exits
631637 // naturally and auto-flush would delay that with retrying HTTP
632638 // requests to the fake DSN.
633- const wantsAutoFlush = ! ensureNoErrorOutput && hasExpectations ;
639+ const wantsAutoFlush = autoFlush && ! ensureNoErrorOutput && hasExpectations ;
634640 const runtime = getRuntime ( ) ;
635641 const childFlags = wantsAutoFlush ? [ ...buildAutoFlushFlags ( flags , testPath , runtime ) , ...flags ] : flags ;
636642 const entryPath = buildScenario ( runtime , testPath ) ;
0 commit comments