I\'m trying to write tests for my web components projects in jest. I already use babel with es2015 preset. I\'m facing an issue while loading the js file. I have followed a
If you need to define test values for properties, there is a slightly more granular approach. Each property needs to be defined individually, and it's also necessary to make the properties writeable
:
Object.defineProperty(window.document, 'URL', {
writable: true,
value: 'someurl'
});
See: https://github.com/facebook/jest/issues/890
This worked for me using Jest 21.2.1
and Node v8.11.1