Closed kabeleced77 closed 3 years ago
Mockzilla itself does not mock browser by default. In the example you linked, the top-section does a jest.mock
for webextension-polyfill-ts.
Mockzilla (this repository) does not by itself do anything for webextensions. If you have not seen it yet, mockzilla-webextension is a fully-functioning solution for testing webextensions.
If you don't want mockzilla-webextension (for example if you are not using the webextension-polyfill), you can use mockzilla, but need to mock the browser instance yourself.
Hi, thanks for answering (and understaning) my question.
I think I got it now. In fact I started with mockzilla-webextension
as I am also using webextension-polyfill-ts
. My "problem" was my own misunderstanding of mocking and I wanted to start with just mockzilla
.
Now I am using mockzilla-webextension
based on your example . For my purpose I "only" needed a mock of browser.storage.local
, e.g. mockBrowser.storage.local.set.expect({ key: value }).andResolve()
.
Now I can also test my code using mockzilla-webextension
.
Thanks for your work :).
Hi, I really like to get mockzilla running for testing my web-extension. First of all I tried the given example here. I followed the instruction here.
But I get
Could you please help? I don't know what to do else.
Thank you!