Description
I decided to try using jest-electron
environment in our jest test setup because jsdom
environment has some missing browser functionality that we were using.
- "@testing-library/jest-dom": "^5.11.9",
- "@testing-library/react": "^11.2.3",
- "@testing-library/user-event": "^12.6.3",
node
version: v15.10npm
version: v7
Relevant code or config:
pasting only necessary changes here of my jest.config.js
{
.
.
runner: 'jest-electron/runner',
testEnvironment: 'jest-electron/environment',
.
.
.
}
What you did:
ran npm run test
What happened:
i think helpers file inside RTL /dom is calling jest.useFakeTimers()..
which is not available in jest-electron environment.
The error that i'm getting is shown in the following SS.
Reproduction:
Small repro can be created on local machine on following these steps.
clone : https://github.com/tmtsoftware/esw-ocs-eng-ui
git checkout jest-branch
npm i & npm t
Problem description:
RTL/jest-dom helpers are calling jest.timers functionality without checking jest-environment.
Suggested solution:
there could be some kind of check related to which environment jest is currently running before this line.
@Testing-Library/dom/dist/helpers.js:38
.