2022-01-27から1日間の記事一覧
JestとMSWでReactコンポーネントのfetch部分をmock化しようとしたらエラーになった ReferenceError: fetch is not defined whatwgのfetchはブラウザでしか使えないのでJest(node)で使うにはpolyfillが必要 jest.config.js const fetchPolyfill = require('…
JestとMSWでReactコンポーネントのfetch部分をmock化しようとしたらエラーになった ReferenceError: fetch is not defined whatwgのfetchはブラウザでしか使えないのでJest(node)で使うにはpolyfillが必要 jest.config.js const fetchPolyfill = require('…