Created
January 12, 2014 00:07
-
-
Save alfonsodev/8378678 to your computer and use it in GitHub Desktop.
example Makefile of a Node.js project to create code coverage reports mocha, instanbul, coveralls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MOCHA=node_modules/.bin/mocha | |
ISTANBUL=node_modules/.bin/istanbul | |
COVERALLS=node_modules/coveralls/bin/coveralls.js | |
# test files must start with "test*.js" | |
TESTS=$(shell find test/ -name "test*.js" -not -path "*service/*") | |
SERVICETEST=$(shell find test/service/ -name "test*.js" ) | |
test: | |
$(MOCHA) -R spec $(TESTS) | |
test-service: | |
$(MOCHA) -R spec $(SERVICETEST) | |
test-debug: | |
$(MOCHA) debug -R spec $(TESTS) | |
test-coverage: | |
# Remove libcov if exits | |
rm -rf lib-cov/ | |
rm -rf html-report/ | |
$(ISTANBUL) instrument lib/ -o lib-cov/ | |
TODO_COV=1 ISTANBUL_REPORTERS=lcov,text-summary,html $(MOCHA) --reporter mocha-istanbul $(TESTS) | |
test-coveralls: | |
echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID) | |
cat lcov.info | $(COVERALLS) | |
.PHONY: coverage clean test test-debug test-coverage test-coveralls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment