jest-chrome
jest-chrome copied to clipboard
Type definitions not working with chrome.tabs.query
TS linter is throwing an error when trying to mock chrome.tabs.query
I think this is happening because chrome is overloading the query function name in their type definition:
But the jest definition only has one definition for the mocked function:
+1 when using chrome.tabs.get
in a test
For anyone with this problem, you can trick typescript by casting the api method to jest.Mock
like this:
(chrome.tabs.get as jest.Mock).mockImplementation( ... )