2023-07-16 The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string. Consider using the "jsdom" test environment. jest.config.jsでtestEnvironment: 'jsdom',にして、 yarn add -D jest-environment-jsdomすれば良い。