@@ -16,6 +16,11 @@ import { tmpdir } from "node:os";
1616import { join } from "node:path" ;
1717import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
1818
19+ const errorsBesideProgress = ( ) =>
20+ vi
21+ . mocked ( console . error )
22+ . mock . calls . filter ( ( [ line ] ) => ! String ( line ) . startsWith ( "[hyperframes] snapshot:" ) ) ;
23+
1924const capture = vi . hoisted ( ( ) => ( {
2025 evaluate : vi . fn ( ) ,
2126 screenshot : vi . fn ( async ( ) => Buffer . from ( "captured PNG" ) ) ,
@@ -123,7 +128,7 @@ describe("snapshot contact sheet failures", () => {
123128 } ) ,
124129 ) . resolves . toBeDefined ( ) ;
125130
126- expect ( console . error ) . not . toHaveBeenCalled ( ) ;
131+ expect ( errorsBesideProgress ( ) ) . toEqual ( [ ] ) ;
127132 for ( const [ index , time ] of [ "0.5" , "1" ] . entries ( ) ) {
128133 const frame = join ( project , "snapshots" , `frame-0${ index } -at-${ time } s.png` ) ;
129134 expect ( readFileSync ( frame ) ) . toEqual ( Buffer . from ( "captured PNG" ) ) ;
@@ -161,7 +166,7 @@ describe("snapshot contact sheet failures", () => {
161166 ) ;
162167 expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( "contact-sheet.jpg" ) ) ;
163168 expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
164- expect ( console . error ) . not . toHaveBeenCalled ( ) ;
169+ expect ( errorsBesideProgress ( ) ) . toEqual ( [ ] ) ;
165170 } ) ;
166171
167172 it ( "builds the sheet from this run's frames, not another frame-*.png in the folder" , async ( ) => {
@@ -262,7 +267,7 @@ describe("snapshot contact sheet failures", () => {
262267 }
263268 expect ( readdirSync ( out ) . filter ( ( name ) => name . startsWith ( "pair-" ) ) ) . toEqual ( [ ] ) ;
264269 expect ( pairSheet ) . toHaveBeenCalledOnce ( ) ;
265- expect ( console . error ) . toHaveBeenCalledOnce ( ) ;
270+ expect ( errorsBesideProgress ( ) ) . toHaveLength ( 1 ) ;
266271 expect ( console . error ) . toHaveBeenCalledWith (
267272 expect . stringContaining ( "Reference pair sheets skipped: Windows App Control" ) ,
268273 ) ;
@@ -325,7 +330,7 @@ describe("snapshot contact sheet failures", () => {
325330 join ( project , "snapshots" , `frame-0${ index } -at-${ time } s.png` ) ,
326331 ) ,
327332 ) ;
328- expect ( console . error ) . not . toHaveBeenCalled ( ) ;
333+ expect ( errorsBesideProgress ( ) ) . toEqual ( [ ] ) ;
329334 expect ( console . warn ) . not . toHaveBeenCalledWith ( expect . stringContaining ( "not recorded" ) ) ;
330335 } finally {
331336 historyDeps . ownerWaitMs = previousWait ;
0 commit comments