From b89ac68cc0d93b624ff1d839babe826684c328b1 Mon Sep 17 00:00:00 2001 From: Sander Koenders Date: Tue, 11 Sep 2018 10:40:20 +0200 Subject: [PATCH] test(setup): Setup test frameworks and adjust project accordingly --- package.json | 18 +++++++++++++++++- stryker.conf.js | 14 ++++++++++++++ tsconfig.json | 6 +++++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 stryker.conf.js diff --git a/package.json b/package.json index 2342a2e..32c0f7c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "scripts": { "tslint": "tslint --project tsconfig.json", "build": "npm run tslint && tsc", - "test": "echo \"Error: no test specified\" && exit 1" + "pretest": "npm run build", + "test": "nyc --reporter=html --report-dir=reports/coverage --check-coverage --lines 80 --functions 80 --branches 75 mocha \"test/**/*Spec.js\" --exit", + "posttest": "stryker run" }, "keywords": [ "NodeJS", @@ -16,7 +18,21 @@ "author": "Sander Koenders", "license": "Apache-2.0", "devDependencies": { + "@types/chai": "^4.1.4", "@types/express": "^4.16.0", + "@types/mocha": "^5.2.5", + "@types/sinon": "^5.0.2", + "chai": "^4.1.2", + "mocha": "^5.2.0", + "nyc": "^13.0.1", + "sinon": "^6.2.0", + "source-map-support": "^0.5.9", + "stryker": "^0.29.1", + "stryker-api": "^0.21.0", + "stryker-html-reporter": "^0.16.1", + "stryker-mocha-framework": "^0.12.1", + "stryker-mocha-runner": "^0.14.1", + "stryker-typescript": "^0.13.2", "tslint": "^5.11.0", "typescript": "^3.0.3" }, diff --git a/stryker.conf.js b/stryker.conf.js new file mode 100644 index 0000000..45f0215 --- /dev/null +++ b/stryker.conf.js @@ -0,0 +1,14 @@ +module.exports = function(config) { + config.set({ + testRunner: "mocha", + mutator: "typescript", + transpilers: ["typescript"], + reporters: ["html", "clear-text", "progress"], + packageManager: "npm", + testFramework: "mocha", + coverageAnalysis: "perTest", + tsconfigFile: "tsconfig.json", + mutate: ["src/**/*.ts"], + coverageAnalysis: "off" + }); +}; diff --git a/tsconfig.json b/tsconfig.json index d054461..613522e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,10 @@ // Emit metadata and allow decorators for InversifyJS "experimentalDecorators": true, - "emitDecoratorMetadata": true + "emitDecoratorMetadata": true, + + // Emit source maps and declaration files + "sourceMap": true, + "declaration": true } } \ No newline at end of file