sinon-chrome icon indicating copy to clipboard operation
sinon-chrome copied to clipboard

Updating Chrome schemas

Open Josmithr opened this issue 3 years ago • 4 comments

I'm attempting to write some tests for a Chrome Manifest V3 extension, but the current Chrome schemas exported by sinon-chrome are missing a number of newer APIs used by V3 extensions (e.g. chrome.action).

Are there any plans to update the schemas?

Josmithr avatar Nov 18 '22 00:11 Josmithr

facing the same issue for chrome.action and others

jvelezpo avatar Feb 21 '23 21:02 jvelezpo

Facing the same issue, any plans for this? Or can we submit a PR at least?

iron2414mw avatar Aug 14 '23 09:08 iron2414mw

facing the same issue for chrome.action and others

You can use something like this in your global test setup file:

import chrome from 'sinon-chrome';

globalThis.chrome = chrome;

chrome.action = chrome.browserAction;

fregante avatar Jan 21 '25 22:01 fregante

I think I wasn't able to do that and get typescript to compile still.

In the end, I had to do something more rote: https://github.com/melink14/rikaikun/blob/main/extension/test/chrome_stubs.ts

Sometimes I forget to import the correct 'fixed' stubbed chrome depending on how long between commits I am... :)

melink14 avatar Jan 21 '25 22:01 melink14