diff --git a/README.md b/README.md index 540a850..c79bc39 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/package.json b/package.json index 6e4ddd1..e61b184 100644 --- a/package.json +++ b/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 (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 (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" + } } diff --git a/test/functional/lib/utils.js b/test/functional/lib/utils.js index 6186a5e..f112100 100644 --- a/test/functional/lib/utils.js +++ b/test/functional/lib/utils.js @@ -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);