@@ -9,7 +9,13 @@ import {tmpdir} from 'node:os';
99import { join } from 'node:path' ;
1010import { describe , it } from 'node:test' ;
1111
12- import { getMockRequest , getMockResponse , html , withBrowser } from './utils.js' ;
12+ import {
13+ getMockRequest ,
14+ getMockResponse ,
15+ html ,
16+ stabilizeResponseOutput ,
17+ withBrowser ,
18+ } from './utils.js' ;
1319
1420describe ( 'McpResponse' , ( ) => {
1521 it ( 'list pages' , async ( ) => {
@@ -100,7 +106,7 @@ Testing 2`,
100106 } ) ;
101107 } ) ;
102108
103- it ( 'saves snapshot to file' , async t => {
109+ it . only ( 'saves snapshot to file' , async t => {
104110 const filePath = join ( tmpdir ( ) , 'test-screenshot.png' ) ;
105111 try {
106112 await withBrowser ( async ( response , context ) => {
@@ -112,10 +118,11 @@ Testing 2`,
112118 } ) ;
113119 const result = await response . handle ( 'test' , context ) ;
114120 assert . equal ( result [ 0 ] . type , 'text' ) ;
115- t . assert . snapshot ?.( result [ 0 ] . text ) ;
121+ console . log ( result [ 0 ] . text ) ;
122+ t . assert . snapshot ?.( stabilizeResponseOutput ( result [ 0 ] . text ) ) ;
116123 } ) ;
117124 const content = await readFile ( filePath , 'utf-8' ) ;
118- t . assert . snapshot ?.( content ) ;
125+ t . assert . snapshot ?.( stabilizeResponseOutput ( content ) ) ;
119126 } finally {
120127 await rm ( filePath , { force : true } ) ;
121128 }
0 commit comments