I am using semantic-ui-react and I am trying to create snapshot tests using jest. However, I keep getting this message. Could someone shed some light on this? I am using semantic with nextjs.
console.error node_modules/fbjs/lib/warning.js:36
Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.
console.error node_modules/semantic-ui-react/dist/commonjs/lib/debug.js:30
Semantic-UI-React could not enable debug.
console.error node_modules/semantic-ui-react/dist/commonjs/lib/debug.js:31
TypeError: Cannot read property 'debug' of undefined
This warning is produced when debug can't deal with localStorage, but it shouldn't be called for tests. Make sure that the ENV vars are set correctly, you need to have NODE_ENV=test.
For those who can't solve the problem with setting NODE_ENV=test. Anotherr option is to use or extend some test setup script (ie mocha -r setup.js):
// if you run Enzyme tests then you probably already have this import which creates global.window object
import 'jsdom-global/register'
global.window.localStorage = {};
For me both options work. I am running my tests on Linux.
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