Closed Standard8 closed 7 years ago
@Standard8 great point!
One way that would allow this library to keep up with new APIs and API changes (which are probably a bit rare) is to parse schema files. Had you considered that?
Here is an example of the bookmarks API:
All of Firefox's extension schemas:
Parsing schema files would also make the behavior of the mocks very exact.
@Standard8 hi.
Why you can not use sinon-chrome
for FF web-extensions testing?
global.browser = require('sinon-chrome');
before(function() {
browser.tabs.query.yields([]);
// or
browser.tabs.query.returns(Promise.resolve([]));
});
@acvetkov Whilst that is possible, the browser namespace has different APIs to the chrome namespace, so simply duplicating the chrome one isn't likely to be correct - and could lead to code that runs tests fine still being wrong as the API isn't there.
@Standard8 Ok. I'll implement schema files for chrome and FF webextensions
sinon-chrome
has supported webextensions api since 2.1.0
version.
Firefox is currently implementing web extensions - these are pretty much the same as the
chrome.*
, although there are a few differences.Firefox has created the
browser.*
namespace which is virtually the same as thechrome.*
space. There are two differences:browser.*
will gain Firefox specific extensions.browser.*
uses promises rather the callbacks.More information: