add ability to run tests in headless mode, generally clean up all the npm scripts
This commit is contained in:
parent
8a45bc6ff6
commit
d8f6f653ba
3 changed files with 56 additions and 41 deletions
|
@ -110,7 +110,10 @@ cp test.config.example.js test.config.js
|
|||
vim test.config.js
|
||||
|
||||
# Run the test suite
|
||||
npm run test
|
||||
npm test
|
||||
|
||||
# Or, if you want to watch the tests run...
|
||||
npm run test:watch
|
||||
```
|
||||
|
||||
|
||||
|
|
85
package.json
85
package.json
|
@ -1,42 +1,47 @@
|
|||
{
|
||||
"name": "web-api-manager",
|
||||
"version": "0.9.4",
|
||||
"description": "Tools to generate Web API managing browser extensions for Firefox and Chrome.",
|
||||
"author": "Peter Snyder <psnyde2@uic.edu> (https://www.cs.uic.edu/~psnyder/)",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {},
|
||||
"homepage": "https://github.com/snyderp/web-api-manager",
|
||||
"bugs": {
|
||||
"url": "https://github.com/snyderp/web-api-manager/issues",
|
||||
"email": "psnyde2@uic.edu"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/snyderp/web-api-manager.git"
|
||||
},
|
||||
"keywords": [
|
||||
"browser extension",
|
||||
"privacy",
|
||||
"security"
|
||||
],
|
||||
"contributors": [],
|
||||
"scripts": {
|
||||
"clean": "rm -Rf dist/",
|
||||
"bundle": "gulp && web-ext -s add-on -a dist build --overwrite-dest",
|
||||
"firefox": "web-ext -s add-on run",
|
||||
"test:lint": "node_modules/eslint/bin/eslint.js .",
|
||||
"test:lint:fix": "node_modules/eslint/bin/eslint.js --fix .",
|
||||
"test:func": "npm run clean; npm run bundle && ln -s `ls dist/` dist/webapi_manager.zip && node_modules/mocha/bin/mocha test/functional/*.js",
|
||||
"test:func:block": "npm run clean; npm run bundle && ln -s `ls dist/` dist/webapi_manager.zip && node_modules/mocha/bin/mocha test/functional/block.js",
|
||||
"test": "npm run test:lint && npm run test:func"
|
||||
},
|
||||
"devDependencies": {
|
||||
"assert": "^1.4.1",
|
||||
"eslint": "^4.9.0",
|
||||
"geckodriver": "^1.9.0",
|
||||
"gulp": "^3.9.1",
|
||||
"mocha": "^4.0.1",
|
||||
"selenium-webdriver": "^3.6.0",
|
||||
"web-ext": "^2.2.2"
|
||||
}
|
||||
"name": "web-api-manager",
|
||||
"version": "0.9.4",
|
||||
"description": "Tools to generate Web API managing browser extensions for Firefox and Chrome.",
|
||||
"author": "Peter Snyder <psnyde2@uic.edu> (https://www.cs.uic.edu/~psnyder/)",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {},
|
||||
"homepage": "https://github.com/snyderp/web-api-manager",
|
||||
"bugs": {
|
||||
"url": "https://github.com/snyderp/web-api-manager/issues",
|
||||
"email": "psnyde2@uic.edu"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/snyderp/web-api-manager.git"
|
||||
},
|
||||
"keywords": [
|
||||
"browser extension",
|
||||
"privacy",
|
||||
"security"
|
||||
],
|
||||
"contributors": [],
|
||||
"scripts": {
|
||||
"clean": "rm -Rf dist/",
|
||||
"bundle": "gulp && web-ext -s add-on -a dist build --overwrite-dest",
|
||||
"firefox": "web-ext -s add-on run",
|
||||
"lint": "node_modules/eslint/bin/eslint.js .",
|
||||
"lint:fix": "node_modules/eslint/bin/eslint.js --fix .",
|
||||
"test": "npm run clean; npm run bundle && ln -s `ls dist/` dist/webapi_manager.zip && node_modules/mocha/bin/mocha test/functional/*.js",
|
||||
"test:watch": "npm test --watch"
|
||||
},
|
||||
"pre-push": {
|
||||
"run": [
|
||||
"lint",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"assert": "^1.4.1",
|
||||
"eslint": "^4.9.0",
|
||||
"geckodriver": "^1.9.0",
|
||||
"gulp": "^3.9.1",
|
||||
"mocha": "^4.0.1",
|
||||
"selenium-webdriver": "^3.6.0",
|
||||
"web-ext": "^2.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,8 +80,15 @@ module.exports.promiseSetBlockingRules = function (driver, standardsToBlock) {
|
|||
|
||||
module.exports.promiseGetDriver = function () {
|
||||
|
||||
const binary = new firefox.Binary();
|
||||
|
||||
if (process.argv.indexOf("--watch") === -1) {
|
||||
binary.addArguments("--headless");
|
||||
}
|
||||
|
||||
const driver = new webdriver.Builder()
|
||||
.forBrowser("firefox")
|
||||
.setFirefoxOptions(new firefox.Options().setBinary(binary))
|
||||
.build();
|
||||
|
||||
driver.setContext(Context.CHROME);
|
||||
|
|
Loading…
Reference in a new issue