Closed reccanti closed 4 years ago
Hi,
if you want to test webextensions, I'd recommend to use https://lusito.github.io/mockzilla-webextension/.
Still, it should work with mockzilla itself as well. Check the following:
import { browser } from "webextension-polyfill-ts";
in your DataManager file and not something else?Thanks for getting back to me so quickly! I figured out the issue, I had an existing, incomplete jest mock for the "browser" that was interfering with the mock creation 😅. Deleting it seemed to fix the issue.
mockzilla-webextenion
is just what I need, so I've switched over to that. Thanks for your help!
Hello! Right now, I'm trying to get Mockzilla working with my extension's unit tests. I have a class with a constructor function like this:
I'm currently trying to set up my unit tests and mocks like this:
However, I get the following error:
When I try to log
browser
, all I see is an empty object. Any idea why this might be happening? Is it something to do with thedoMock
call, my class, or is it something else entirely?Thanks!