I have a module ./main.js
that I am trying to test using ./__tests__/main-test.js
. ./main.js
uses new Regexp(REGEX, 'g')
in one of its exported functions.
Running jest
produces this error:
ReferenceError: Regexp is not defined
I thought it may be a mocking problem and added jest.unmock('Regexp')
to main-test.js
(even though it's not a required module), but got the same result.
What isn't Regexp
defined?
Cause it should be RegExp
, case sensitive, remember? otherwise the interpreter is searching for an object called Regexp
which is not the desired RegExp constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With