Open sookinoby opened 6 years ago
jsdom
: I think this doc is not actual, I should modify (remove) it.Regarding 2 const chrome = require('sinon-chrome'); // or const chrome = require('sinon-chrome/extensions'); // This does work, what is the difference using sinon-chrome and the extensions? Also, can you provide an example to over ride browser.extension.onConnect.addListener in background.js.
By test code : describe('background page', function () {
beforeEach(function () { global.browser = browser; let back = fs.readFileSync(path.join(__dirname, '../../app/scripts/background.js'), 'utf-8');
const dom = new JSDOM(`<body><script$back</script></body>`, {runScripts: "dangerously", includeNodeLocations: true });
})
afterEach(function () { browser.reset(); window.close(); });
it('should attach listeners on startup', function () { const options = { resources: 'usable', runScripts: 'dangerously', }; console.log("here") this_is_candice = " My name is candice"; console.log(this_is_candice) console.log(browser.extension.onConnect); assert.ok(browser.extension.onConnect, 'browser.extension.onConnect'); }).timeout(5000); });
Hi, I am unable to understand run the examples in wiki page at it uses jsdom.env function, which is not supported by jsdom any more. Also, the wiki page example looks different from usage example, in readme. Also how to test a plugin developed using https://github.com/HaNdTriX/webextension-toolbox ? Can you please provide some suggestion ?