diff --git a/package.json b/package.json index 07a74119..58a68cf1 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "collect:deps": "node scripts/collect_deps.js", "collect:tests": "node scripts/collect_tests.js --file $npm_config_file --dir $npm_config_dir", "increment": "node scripts/increment_version.js", - "karma": "karma start scripts/karma.conf.js --single-run", - "karma:watch": "karma start scripts/karma.conf.js --auto-watch --browsers Chrome", + "karma": "karma start scripts/karma.conf.js --single-run --grep $npm_config_grep", + "karma:watch": "karma start scripts/karma.conf.js --auto-watch --browsers OnlineChrome --grep $npm_config_grep", "lint:fix": "eslint Tone/*/*.ts --fix", "scratch": "webpack -w --env.scratch --mode=development", - "test": "npm run collect:tests && npm run karma", + "test": "npm run karma", "test:watch": "npm run collect:tests && npm run karma:watch", "test:browser": "npm run collect:tests && concurrently \"webpack -w --mode=development --env.test\" \"http-server -p 9090 -c-1\" \"open http://localhost:9090/build/test.html\"", "test:travis": "npm run build && npm run lint && npm run test", @@ -30,8 +30,10 @@ "test:node": "node ./test/html/node_test.js", "tsd": "node ./scripts/generate_docs.js", "lint": "tslint --project tslint.json", + "lint:fix": "tslint --project tslint.json --fix", "tsc:watch": "tsc --watch", - "watch": "npm run increment && npm run collect:deps && webpack -w --env.production --mode=development" + "watch:old": "npm run increment && npm run collect:deps && webpack -w --env.production --mode=development", + "watch": "tsc --watch" }, "repository": { "type": "git", diff --git a/scripts/karma.conf.js b/scripts/karma.conf.js index fcd7976f..dd205cd2 100644 --- a/scripts/karma.conf.js +++ b/scripts/karma.conf.js @@ -1,5 +1,10 @@ // Karma configuration const path = require("path"); +const argv = require("yargs") + .option("grep", { + default: "", + }) + .argv; let BROWSERS = ["HeadlessChrome", "HeadlessFirefox", "Safari"]; @@ -47,7 +52,7 @@ module.exports = function(config) { }, }, coverageOptions : { - exclude: /test\/.*\.ts$/i, + exclude: /.*\.test\.ts$/i, }, reports: { html: path.resolve(__dirname, "../coverage"), @@ -91,9 +96,9 @@ module.exports = function(config) { client : { mocha : { - grep: "Gain", - timeout : 30000, - reporter : "html", // change Karma's debug.html to the mocha web reporter + grep: argv.grep, + reporter : "html", + timeout : 10000, ui : "bdd", }, }, @@ -143,6 +148,11 @@ module.exports = function(config) { "media.navigator.permission.disabled" : true, }, }, + OnlineChrome: { + base: "Chrome", + flags: ["--no-sandbox", "--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", + "--autoplay-policy=no-user-gesture-required"], + }, }, }; diff --git a/tsconfig.json b/tsconfig.json index 0e90c361..f871f215 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "outFile": "./build/Tone.js", "outDir": "./build", "sourceMap": true, - "moduleResolution": "classic", + "moduleResolution": "node", "strictPropertyInitialization" : true, "lib": ["es6", "dom"], "baseUrl": "./",