URLSearchParams not detected error when running tests with a joke

How can I use URLSearchParams when running tests using Jest?

When I do this, I get

ReferenceError: URLSearchParams is not defined

+4
source share
2 answers

You just need to update the version react-scriptsthat uses the latest version of Jest, which contains the ability to use URLSearchParams.

You can read more about this here: https://facebook.imtqy.com/jest/blog/2017/12/18/jest-22.html#good-bye-node-4-welcome-jsdom-11 .

0
source

jest - ? jest- jsdom, JavaScript

jest --env=jsdom

. Jest

-1

Source: https://habr.com/ru/post/1690817/


All Articles