diff --git a/.gitignore b/.gitignore index 9ed3cff..b0fd4a4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules .DS_Store lib-cov coverage.html +html-report diff --git a/.jshintrc b/.jshintrc index ea91c3f..4872d84 100644 --- a/.jshintrc +++ b/.jshintrc @@ -10,5 +10,9 @@ "maxlen" : 120, "indent" : 4, "predef" : ["describe", "it", "beforeEach"], - "quotmark" : "single" + "quotmark" : "single", + "maxerr": 5, + "maxdepth": 2, + "maxstatements": 12, + "maxcomplexity": 5 } diff --git a/.npmignore b/.npmignore index c6e4c30..0cbce09 100644 --- a/.npmignore +++ b/.npmignore @@ -4,3 +4,4 @@ test/ lib-cov node_modules coverage.html +html-report diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8f53866 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +BIN = ./node_modules/.bin +MOCHA = $(BIN)/mocha +ISTANBUL = $(BIN)/istanbul +JSHINT = $(BIN)/jshint +JSCS = $(BIN)/jscs + +.PHONY: test +test: + $(MOCHA) -u bdd -R spec --recursive + +.PHONY: clean +clean: + -rm -rf lib-cov + -rm -rf html-report + +.PHONY: lib-cov +lib-cov: clean + $(ISTANBUL) instrument --output lib-cov --no-compact --variable global.__coverage__ lib + +.PHONY: coverage +coverage: lib-cov + PACKAGE_COVERAGE=1 $(MOCHA) -u bdd --reporter mocha-istanbul + @echo + @echo Open html-report/index.html file in your browser + +.PHONY: lint +lint: + $(JSHINT) . + $(JSCS) . diff --git a/package.json b/package.json index e69ee64..8e418c9 100644 --- a/package.json +++ b/package.json @@ -19,17 +19,17 @@ "devDependencies" : { "jshint": "2.1.3", "mocha": "1.11.0", - "jscs": "1.0.0" + "jscs": "1.0.0", + "istanbul": "0.1.39", + "mocha-istanbul": "*" }, "bin" : { "package-bin" : "./bin/package-bin" }, "scripts": { - "test" : "npm run-script jshint && npm run-script check-style && npm run-script unit-test", - "jshint": "./node_modules/.bin/jshint .", - "unit-test": "./node_modules/.bin/mocha -u bdd -R spec --recursive test", - "check-style": "./node_modules/jscs/bin/jscs .", - "lib-cov": "jscoverage lib lib-cov", - "coverage": "rm -Rf lib-cov && npm run-script lib-cov && PACKAGE_COVERAGE=1 ./node_modules/.bin/mocha -u bdd -R html-cov --recursive test > coverage.html" + "test" : "make test", + "lint": "make lint", + "coverage": "make coverage", + "clean": "make clean" } }