diff --git a/karma.conf.js b/karma.conf.js index f583707..3ac72ad 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -9,25 +9,30 @@ const webpackConfig = require("./webpack.config.js")({ production: false, karma: delete webpackConfig.entry; module.exports = config => { + "use strict"; var configuration = { + client: { + mocha: { + timeout : 5000 + } + }, basePath: "", frameworks: [ "mocha", - "chai", - "sinon", + "sinon-chai", "es6-shim" ], files: [ { pattern: "node_modules/reflect-metadata/Reflect.js", include: true }, { pattern: "node_modules/bluebird/js/browser/bluebird.js", include: true }, { pattern: "node_modules/phaser-ce/build/phaser.js", include: true }, - { pattern: "./test/**/**/**.test.ts", include: true }, + { pattern: "./test/index.ts", include: true }, { pattern: '**/*.map', served: true, included: false, watched: true } ], preprocessors: { - "./**/**/**/**.ts": ["sourcemap"], - "./test/**/**/**.test.ts": ["webpack"] + "./test/index.ts": ["webpack"], + "./**/**/**/**.ts": ["sourcemap"] }, webpack: webpackConfig, webpackMiddleware: { @@ -40,11 +45,13 @@ module.exports = config => { "karma-remap-istanbul", "karma-mocha-reporter", "karma-mocha", - "karma-chai", - "karma-sinon", + "karma-sinon-chai", "karma-es6-shim", "karma-coverage-istanbul-reporter" ], + mime: { + "text/x-typescript": ["ts","tsx"] + }, reporters: ( config.singleRun ? ["dots", "mocha", "coverage-istanbul"] : @@ -64,6 +71,7 @@ module.exports = config => { colors: true, logLevel: config.LOG_INFO, autoWatch: true, + concurrency: Infinity, browsers: [], browserNoActivityTimeout: 50000 }; diff --git a/package.json b/package.json index 3942940..f9fff1f 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@types/chai": "^4.1.7", "@types/mocha": "^5.2.5", "@types/sinon": "^5.0.7", + "@types/webpack-env": "^1.13.6", "bluebird": "^3.5.3", "browserify-versionify": "^1.0.6", "chai": "^4.2.0", @@ -69,14 +70,12 @@ "istanbul": "^0.4.5", "istanbul-instrumenter-loader": "^3.0.1", "karma": "^3.1.1", - "karma-chai": "^0.1.0", "karma-chrome-launcher": "^2.2.0", "karma-coverage-istanbul-reporter": "^2.0.4", "karma-es6-shim": "^1.0.0", "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.5", "karma-remap-istanbul": "^0.6.0", - "karma-sinon": "^1.0.5", "karma-sinon-chai": "^2.0.2", "karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-writer": "^0.1.2", diff --git a/test/index.ts b/test/index.ts new file mode 100644 index 0000000..85b2203 --- /dev/null +++ b/test/index.ts @@ -0,0 +1,7 @@ +/// + +// require all modules ending in ".test.ts" from the +// current directory and all subdirectories +const testsContext = require.context(".", true, /\.test\.ts$/); + +testsContext.keys().forEach(testsContext); diff --git a/yarn.lock b/yarn.lock index de8f765..a317c77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -151,6 +151,11 @@ resolved "https://registry.npmjs.org/@types/sinon/-/sinon-5.0.7.tgz#0d9f89dd0c9988c4f1505a92a3a324ee7bdb18a6" integrity sha512-opwMHufhUwkn/UUDk35LDbKJpA2VBsZT8WLU8NjayvRLGPxQkN+8XmfC2Xl35MAscBE8469koLLBjaI3XLEIww== +"@types/webpack-env@^1.13.6": + version "1.13.6" + resolved "http://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.13.6.tgz#128d1685a7c34d31ed17010fc87d6a12c1de6976" + integrity sha512-5Th3OsZ4gTRdr9Mho83BQ23cex4sRhOR4XTG+m+cJc0FhtUBK9Vn62hBJ+pnQYnSxoPOsKoAPOx6FcphxBC8ng== + "@webassemblyjs/ast@1.7.11": version "1.7.11" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.11.tgz#b988582cafbb2b095e8b556526f30c90d057cace" @@ -3497,11 +3502,6 @@ just-extend@^3.0.0: resolved "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz#cee004031eaabf6406da03a7b84e4fe9d78ef288" integrity sha512-Fu3T6pKBuxjWT/p4DkqGHFRsysc8OauWr4ZRTY9dIx07Y9O0RkoR5jcv28aeD1vuAwhm3nLkDurwLXoALp4DpQ== -karma-chai@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/karma-chai/-/karma-chai-0.1.0.tgz#bee5ad40400517811ae34bb945f762909108b79a" - integrity sha1-vuWtQEAFF4Ea40u5RfdikJEIt5o= - karma-chrome-launcher@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz#cf1b9d07136cc18fe239327d24654c3dbc368acf" @@ -3555,11 +3555,6 @@ karma-sinon-chai@^2.0.2: resolved "https://registry.npmjs.org/karma-sinon-chai/-/karma-sinon-chai-2.0.2.tgz#e28c109b989973abafc28a7c9f09ef24a05e07c2" integrity sha512-SDgh6V0CUd+7ruL1d3yG6lFzmJNGRNQuEuCYXLaorruNP9nwQfA7hpsp4clx4CbOo5Gsajh3qUOT7CrVStUKMw== -karma-sinon@^1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/karma-sinon/-/karma-sinon-1.0.5.tgz#4e3443f2830fdecff624d3747163f1217daa2a9a" - integrity sha1-TjRD8oMP3s/2JNN0cWPxIX2qKpo= - karma-sourcemap-loader@^0.3.7: version "0.3.7" resolved "https://registry.npmjs.org/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.7.tgz#91322c77f8f13d46fed062b042e1009d4c4505d8"