Skip to content

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

@davestewart

Description

@davestewart

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions