Regexp is not defined in Jest test

Viewed 10272

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?

1 Answers
Related