Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with mozilla/webextension-polyfill ? #103

Open
davestewart opened this issue Aug 29, 2020 · 1 comment
Open

How to use with mozilla/webextension-polyfill ? #103

davestewart opened this issue Aug 29, 2020 · 1 comment

Comments

@davestewart
Copy link

davestewart commented Aug 29, 2020

Hi,

Background: I'm a "fair weather" tester, but looks like I am going to have to up my game to start testing browser extensions.

Question: is it possible to use mozilla/webextension-polyfill with this library?

My extension is completely written with it, and I thought I would just be able to import the lib before importing my code, but this is not working.

When I attempt to use the polyfill in Jest, it fails with “This script should only be loaded in a browser extension.” because it can’t find chrome in the current context.

I’ve tried various ways to fix this (Jest globals, Jest setupFiles), but no luck so far.

My apologies that my testing skills are poor and this may even be off-topic!

I think Sinon Chrome is what I need, I just need a little help getting out of the starting blocks.

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants