TESTS = test/**.test.js
REPORTER = spec
TIMEOUT = 10000
MOCHA_OPTS =

install:
	@tnpm install

eslint: install
	@./node_modules/.bin/eslint ./lib

test: install
	@NODE_ENV=test ./node_modules/.bin/mocha \
		--require should \
		--require co-mocha \
		--reporter $(REPORTER) \
		--timeout $(TIMEOUT) \
		$(MOCHA_OPTS) \
		$(TESTS)

test-cov: install
	@NODE_ENV=test ./node_modules/.bin/istanbul cover --preserve-comments \
		./node_modules/.bin/_mocha \
		-- -u exports \
		--require should \
		--reporter $(REPORTER) \
		--timeout $(TIMEOUT) \
		$(MOCHA_OPTS) \
		$(TESTS)

autod: install
	@./node_modules/.bin/autod -w --prefix="~" \
        -e coverage \
        -t test \
	-D mocha,co-mocha,should,eslint,git-pre-hooks
	@$(MAKE) install

.PHONY: test

