You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
What you did:
Updated a dependency and tried to run unit tests with default jest configuration. Subdependency ipfs-http-client@40.1.0 updated to ipfs-http-client@46.0.0 and was imported require('ipfs-http-client') but not instantiated in tests.
jest --env=node works as a workaround, if you don't need DOM
What happened:
Tests crash on initialization. Global XMLHttpRequest is defined (so it uses ipfs-utils/src/http/fetch-browser.js), but global Request isn't (throws ReferenceError).
What you expected to happen
Expected ipfs-http-client to continue working with jest/jsdom
Steps to reproduce the error:
newfolder
npm init -y
npm i ipfs-http-client@46.0.0
npm i jest
echo"require('ipfs-http-client'); test('a', () => {});"> a.test.js
npx jest # [--env=jsdom] #> ReferenceError: Request is not defined# ipfs-utils/src/http/fetch-browser.js:95
npx jest --env=node
#> Success
ipfs-http-client@46.0.0
Severity:
Medium
Description:
What you did:
Updated a dependency and tried to run unit tests with default jest configuration. Subdependency ipfs-http-client@40.1.0 updated to ipfs-http-client@46.0.0 and was imported
require('ipfs-http-client')but not instantiated in tests.jest --env=nodeworks as a workaround, if you don't need DOMWhat happened:
Tests crash on initialization. Global
XMLHttpRequestis defined (so it usesipfs-utils/src/http/fetch-browser.js), but globalRequestisn't (throwsReferenceError).What you expected to happen
Expected ipfs-http-client to continue working with jest/jsdom
Steps to reproduce the error: