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
|
vim test.config.js
|
||||||
|
|
||||||
# Run the test suite
|
# 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",
|
"name": "web-api-manager",
|
||||||
"version": "0.9.4",
|
"version": "0.9.4",
|
||||||
"description": "Tools to generate Web API managing browser extensions for Firefox and Chrome.",
|
"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/)",
|
"author": "Peter Snyder <psnyde2@uic.edu> (https://www.cs.uic.edu/~psnyder/)",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"homepage": "https://github.com/snyderp/web-api-manager",
|
"homepage": "https://github.com/snyderp/web-api-manager",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/snyderp/web-api-manager/issues",
|
"url": "https://github.com/snyderp/web-api-manager/issues",
|
||||||
"email": "psnyde2@uic.edu"
|
"email": "psnyde2@uic.edu"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/snyderp/web-api-manager.git"
|
"url": "https://github.com/snyderp/web-api-manager.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"browser extension",
|
"browser extension",
|
||||||
"privacy",
|
"privacy",
|
||||||
"security"
|
"security"
|
||||||
],
|
],
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -Rf dist/",
|
"clean": "rm -Rf dist/",
|
||||||
"bundle": "gulp && web-ext -s add-on -a dist build --overwrite-dest",
|
"bundle": "gulp && web-ext -s add-on -a dist build --overwrite-dest",
|
||||||
"firefox": "web-ext -s add-on run",
|
"firefox": "web-ext -s add-on run",
|
||||||
"test:lint": "node_modules/eslint/bin/eslint.js .",
|
"lint": "node_modules/eslint/bin/eslint.js .",
|
||||||
"test:lint:fix": "node_modules/eslint/bin/eslint.js --fix .",
|
"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": "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:watch": "npm test --watch"
|
||||||
"test": "npm run test:lint && npm run test:func"
|
},
|
||||||
},
|
"pre-push": {
|
||||||
"devDependencies": {
|
"run": [
|
||||||
"assert": "^1.4.1",
|
"lint",
|
||||||
"eslint": "^4.9.0",
|
"test"
|
||||||
"geckodriver": "^1.9.0",
|
]
|
||||||
"gulp": "^3.9.1",
|
},
|
||||||
"mocha": "^4.0.1",
|
"devDependencies": {
|
||||||
"selenium-webdriver": "^3.6.0",
|
"assert": "^1.4.1",
|
||||||
"web-ext": "^2.2.2"
|
"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 () {
|
module.exports.promiseGetDriver = function () {
|
||||||
|
|
||||||
|
const binary = new firefox.Binary();
|
||||||
|
|
||||||
|
if (process.argv.indexOf("--watch") === -1) {
|
||||||
|
binary.addArguments("--headless");
|
||||||
|
}
|
||||||
|
|
||||||
const driver = new webdriver.Builder()
|
const driver = new webdriver.Builder()
|
||||||
.forBrowser("firefox")
|
.forBrowser("firefox")
|
||||||
|
.setFirefoxOptions(new firefox.Options().setBinary(binary))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
driver.setContext(Context.CHROME);
|
driver.setContext(Context.CHROME);
|
||||||
|
|
Loading…
Reference in a new issue