Solved here
Add the package (via npm or yarn) jest-fixed-jsdom
Then in jest.config.js
module.exports = {
...
testEnvironment: 'jest-fixed-jsdom',
...
}
Reason (fullly explained here) jest-environment-jsdom
pollyfills many core function that broke node compatibility
Thanks to @EstusFlask