setting up tests and config for typescript

This commit is contained in:
tambien 2019-05-23 13:59:08 -04:00
parent bd31558de6
commit 4aca4f81e6
3 changed files with 21 additions and 9 deletions

View file

@ -18,11 +18,11 @@
"collect:deps": "node scripts/collect_deps.js", "collect:deps": "node scripts/collect_deps.js",
"collect:tests": "node scripts/collect_tests.js --file $npm_config_file --dir $npm_config_dir", "collect:tests": "node scripts/collect_tests.js --file $npm_config_file --dir $npm_config_dir",
"increment": "node scripts/increment_version.js", "increment": "node scripts/increment_version.js",
"karma": "karma start scripts/karma.conf.js --single-run", "karma": "karma start scripts/karma.conf.js --single-run --grep $npm_config_grep",
"karma:watch": "karma start scripts/karma.conf.js --auto-watch --browsers Chrome", "karma:watch": "karma start scripts/karma.conf.js --auto-watch --browsers OnlineChrome --grep $npm_config_grep",
"lint:fix": "eslint Tone/*/*.ts --fix", "lint:fix": "eslint Tone/*/*.ts --fix",
"scratch": "webpack -w --env.scratch --mode=development", "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: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: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", "test:travis": "npm run build && npm run lint && npm run test",
@ -30,8 +30,10 @@
"test:node": "node ./test/html/node_test.js", "test:node": "node ./test/html/node_test.js",
"tsd": "node ./scripts/generate_docs.js", "tsd": "node ./scripts/generate_docs.js",
"lint": "tslint --project tslint.json", "lint": "tslint --project tslint.json",
"lint:fix": "tslint --project tslint.json --fix",
"tsc:watch": "tsc --watch", "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": { "repository": {
"type": "git", "type": "git",

View file

@ -1,5 +1,10 @@
// Karma configuration // Karma configuration
const path = require("path"); const path = require("path");
const argv = require("yargs")
.option("grep", {
default: "",
})
.argv;
let BROWSERS = ["HeadlessChrome", "HeadlessFirefox", "Safari"]; let BROWSERS = ["HeadlessChrome", "HeadlessFirefox", "Safari"];
@ -47,7 +52,7 @@ module.exports = function(config) {
}, },
}, },
coverageOptions : { coverageOptions : {
exclude: /test\/.*\.ts$/i, exclude: /.*\.test\.ts$/i,
}, },
reports: { reports: {
html: path.resolve(__dirname, "../coverage"), html: path.resolve(__dirname, "../coverage"),
@ -91,9 +96,9 @@ module.exports = function(config) {
client : { client : {
mocha : { mocha : {
grep: "Gain", grep: argv.grep,
timeout : 30000, reporter : "html",
reporter : "html", // change Karma's debug.html to the mocha web reporter timeout : 10000,
ui : "bdd", ui : "bdd",
}, },
}, },
@ -143,6 +148,11 @@ module.exports = function(config) {
"media.navigator.permission.disabled" : true, "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"],
},
}, },
}; };

View file

@ -11,7 +11,7 @@
// "outFile": "./build/Tone.js", // "outFile": "./build/Tone.js",
"outDir": "./build", "outDir": "./build",
"sourceMap": true, "sourceMap": true,
"moduleResolution": "classic", "moduleResolution": "node",
"strictPropertyInitialization" : true, "strictPropertyInitialization" : true,
"lib": ["es6", "dom"], "lib": ["es6", "dom"],
"baseUrl": "./", "baseUrl": "./",