11import { HttpResponse , http } from 'msw' ;
22import { setupServer } from 'msw/node' ;
33import request from 'supertest' ;
4- import { afterEach , beforeEach , describe , expect , it } from 'vitest' ;
4+ import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest' ;
55
66import { createApp , createProxyMiddleware } from './test-kit.js' ;
77
@@ -27,6 +27,8 @@ describe('E2E msw', () => {
2727 } ) ;
2828
2929 it ( 'proxies GET requests to a msw mocked target' , async ( ) => {
30+ await using consoleInfoSpy = await vi . spyOn ( console , 'info' ) ;
31+
3032 server . use (
3133 http . get ( `${ target } /api/hello` , ( ) => {
3234 return new HttpResponse ( 'hello from msw' , { status : 200 } ) ;
@@ -40,13 +42,17 @@ describe('E2E msw', () => {
4042 pathFilter : '/api' ,
4143 // Keep msw-based e2e stable and aligned with nock e2e transport path.
4244 followRedirects : true ,
45+ logger : console ,
4346 } ) ,
4447 ) ,
4548 ) ;
4649
4750 const response = await agent . get ( '/api/hello' ) . expect ( 200 ) ;
4851
4952 expect ( response . text ) . toBe ( 'hello from msw' ) ;
53+ expect ( consoleInfoSpy ) . toHaveBeenCalledWith (
54+ '[HPM] GET /api/hello -> http://localhost:45678/api/hello [200]' ,
55+ ) ;
5056 } ) ;
5157
5258 it ( 'forwards query string to the msw mocked target' , async ( ) => {
0 commit comments