Mocha + React: navigator is not defined
问题 I'm trying to write the first test for React components and keep getting error: ReferenceError: navigator is not defined I have component and one of it's children use codemirror for displaying editable textareas. The thing is that in codemirror there is a check for type of navigator. And since I run this code not in browser, but in terminal with node.js it's not defined. Some folks on SO advised to set global variable, but it didn't work for me. Here is code of the test: global.navigator = {