From 365c5fda10bbef6639bbd6ca3414b376d0dc9627 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Sat, 18 Jun 2016 14:32:16 +0300 Subject: [PATCH] Istanbul code coverage --- .gitignore | 6 ++++-- package.json | 15 +++++++++------ tsconfig-test.json | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 tsconfig-test.json diff --git a/.gitignore b/.gitignore index 79f7aa85..eeba4d47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .idea -node_modules npm-debug.log *.js.map -tmp \ No newline at end of file +/coverage +/node_modules +/test-tmp +/tmp diff --git a/package.json b/package.json index 6f405480..c27f32db 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "babel-polyfill": "^6.9.1", "babel-preset-es2015": "^6.9.0", "chai": "^3.5.0", + "istanbul": "^1.0.0-alpha.2", "lite-server": "^1.3.1", "mocha": "^2.5.3", "source-map-support": "^0.4.0", @@ -39,15 +40,17 @@ "url": "git+https://github.com/sanex3339/javascript-obfuscator.git" }, "scripts": { - "tsc": "tsc", - "tsc:w": "tsc -w", - "webpack": "node_modules/.bin/webpack", - "watch": "node_modules/.bin/webpack --watch", "lite": "lite-server", + "webpack": "node_modules/.bin/webpack", + "build": "npm run webpack && npm test", + "watch": "node_modules/.bin/webpack --watch", "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ", + "test:compile": "tsc -p tsconfig-test.json", "test:dev": "node test/dev/test.js", - "test:mocha": "mocha --require ts-node/register test/**/*.spec.ts", - "test": "npm run test:dev && npm run test:mocha", + "test:full": "npm run test:compile && istanbul cover _mocha -- test-tmp/test/**/**.spec.js && npm run test:removeTestTmpDir", + "test:mocha": "npm run test:compile && mocha -- test-tmp/test/**/**.spec.js && npm run test:removeTestTmpDir", + "test:removeTestTmpDir": "rm -rf test-tmp", + "test": "npm run test:dev && npm run test:full", "typings": "node_modules/.bin/typings install" }, "author": { diff --git a/tsconfig-test.json b/tsconfig-test.json new file mode 100644 index 00000000..6192d979 --- /dev/null +++ b/tsconfig-test.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "outDir": "test-tmp", + "target": "ES6", + "module": "commonjs", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": true, + "noImplicitAny": true + }, + "exclude": [ + "node_modules", + "typings/browser", + "typings/browser.d.ts" + ] +} \ No newline at end of file