We are using gRPC-Web client in our project, but when we try to run unit tests on code that imports generated gRPC classes we get an error
TypeError: cannot read property 'navigator' of undefined.
I guess the problem is somehow related to the way generated modules are exposed, however I cannot figure out how to make it work with Jest.
I tried to mock global.navigator
object manually using setupTests.js
file, but it didn't help. It looks like the gRPC code is being executed before Jest.
Our web project is created using Create React App library with TypeScript without ejecting and we use default Jest configuration to run unit tests.
Please advise.