mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.98k stars 520 forks source link

quiet: true should supress RESPONSE LISTENER logs #2098

Closed pot-code closed 8 months ago

pot-code commented 8 months ago

Scope

Improves an existing behavior

Compatibility

Feature description

msw intercept all my XHR requests including non-api calls, so the logs flooded my console like this:

RESPONSE LISTENER {requestId: 'babc8a40-9c4f-4267-be5d-cc1cf4d36422', isMockedResponse: false, type: 'basic', status: 200, statusText: 'OK', …} Map(10) createResponseListener.ts:24 
RESPONSE LISTENER {requestId: '2f25bee3-94bd-47f8-8a3f-7280e687ab80', isMockedResponse: false, type: 'basic', status: 200, statusText: 'OK', …} Map(9) createResponseListener.ts:24 
RESPONSE LISTENER {requestId: 'f1ce1f5e-43cd-423f-befe-7acad2e0dcca', isMockedResponse: false, type: 'basic', status: 200, statusText: 'OK', …} Map(8) createResponseListener.ts:24 
RESPONSE LISTENER {requestId: '616c9f5c-eda4-4966-b6c6-4a5a2df5d910', isMockedResponse: false, type: 'basic', status: 200, statusText: 'OK', …} Map(7) createResponseListener.ts:24 
RESPONSE LISTENER {requestId: '6c2e8742-9adb-4510-ad05-ce73ea1bb7d2', isMockedResponse: false, type: 'basic', status: 200, statusText: 'OK', …} Map(6) 
...and more

after digging through the source code, i found it is hardcoded:

console.log('RESPONSE LISTENER', responseJson, context.requests)

is there anyway to turn off it? because i only want to see my debug logs

piotr-cz commented 8 months ago

I believe this code was added by mistake in v2.2.6 here: https://github.com/mswjs/msw/pull/2094#issuecomment-2002730036

pot-code commented 8 months ago

I believe this code was added by mistake in v2.2.6 here: https://github.com/mswjs/msw/pull/2094#issuecomment-2002730036

Thank you😇

kettanaito commented 8 months ago

Thanks for reporting this! Fixed in https://github.com/mswjs/msw/pull/2099.

kettanaito commented 8 months ago

Released: v2.2.8 🎉

This has been released in v2.2.8!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.