Skip to content

Instantly share code, notes, and snippets.

@BoyCook
Last active December 11, 2015 13:18
Show Gist options
  • Save BoyCook/4606004 to your computer and use it in GitHub Desktop.
Save BoyCook/4606004 to your computer and use it in GitHub Desktop.
Makefile for Node.js projects
TESTS = test/spec
REPORTER = spec
XML_FILE = reports/TEST-all.xml
HTML_FILE = reports/coverage.html
test: test-mocha
test-ci:
$(MAKE) test-mocha REPORTER=xUnit > $(XML_FILE)
test-all: clean test-ci test-cov
test-mocha:
@NODE_ENV=test mocha \
--timeout 200 \
--reporter $(REPORTER) \
$(TESTS)
test-cov: lib-cov
@APP_COVERAGE=1 $(MAKE) test-mocha REPORTER=html-cov > $(HTML_FILE)
lib-cov:
jscoverage lib lib-cov
clean:
rm -f reports/*
rm -fr lib-cov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment