Skip to content

Instantly share code, notes, and snippets.

@arantius arantius/README.md
Last active Jan 8, 2018

Embed
What would you like to do?

Check out this repository/download this ZIP. Run:

$ npm i --save-dev
$ npm test

> sinon-chrome-webext-test@0.0.1 test /.../sinon-chrome-webext-test
> karma start karma.conf.js

Firefox 57.0.0 (Ubuntu 0.0.0) ERROR
  ReferenceError: browser is not defined
  at test.js:1


npm ERR! Test failed.  See above for more details.

I expect this to run without error.

module.exports = function(config) {
config.set({
files: [
'./test.js',
],
frameworks: ['sinon-chrome'],
port: 7328,
colors: true,
logLevel: config.LOG_WARN,
autoWatch: true,
browsers: ['FirefoxHeadless'],
// https://github.com/karma-runner/karma-firefox-launcher/issues/76
customLaunchers: {
FirefoxHeadless: {
base: 'Firefox',
flags: [ '-headless' ],
},
},
singleRun: true,
concurrency: Infinity
})
}
{
"name": "sinon-chrome-webext-test",
"version": "0.0.1",
"scripts": {
"test": "karma start karma.conf.js"
},
"devDependencies": {
"chai": "^4.1.2",
"karma": "^1.3.0",
"karma-firefox-launcher": "^1.0.0",
"karma-chai": "^0.1.0",
"karma-sinon-chrome": "git+https://github.com/arantius/karma-sinon-chrome.git#02ac98c75f795e62d9168d9cc8cefcc76b310116",
"sinon-chrome": "^2.1.2"
}
}
browser.runtime.getManifest.returns({'version': 1});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.