不要怂,就是干,撸起袖子干!

You need to sign in or sign up before continuing.
Makefile 2.03 KB
REPORTER ?= dot
TESTS = $(shell find ./test/* -name "*.test.js")
DIALECT ?= mysql

# test commands

teaser:
	@echo "" && \
	node -pe "Array(20 + '$(DIALECT)'.length + 3).join('#')" && \
	echo '# Running tests for $(DIALECT) #' && \
	node -pe "Array(20 + '$(DIALECT)'.length + 3).join('#')" && \
	echo ''

test:
	@if [ "$$GREP" ]; then \
		make teaser && ./node_modules/mocha/bin/mocha --check-leaks --colors -t 10000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
	else \
		make teaser && ./node_modules/mocha/bin/mocha --check-leaks --colors -t 10000 --reporter $(REPORTER) $(TESTS); \
	fi

cover:
	rm -rf coverage \
	make teaser && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- -- -u exports --report lcovonly -- -R spec --  $(TESTS); \
	mv coverage coverage-$(DIALECT) \

mariadb:
	@DIALECT=mariadb make test
sqlite:
	@DIALECT=sqlite make test
mysql:
	@DIALECT=mysql make test
postgres:
	@DIALECT=postgres make test
postgres-native:
	@DIALECT=postgres-native make test
binary:
	@./test/binary/sequelize.test.bats

mariadb-cover:
	rm -rf coverage
	@DIALECT=mariadb make cover
sqlite-cover:
	rm -rf coverage
	@DIALECT=sqlite make cover
mysql-cover:
	rm -rf coverage
	@DIALECT=mysql make cover
postgres-cover:
	rm -rf coverage
	@DIALECT=postgres make cover
postgres-native-cover:
	rm -rf coverage
	@DIALECT=postgres-native make cover
binary-cover:
	rm -rf coverage
	@./test/binary/sequelize.test.bats

merge-coverage:
	rm -rf coverage
	mkdir coverage
	./node_modules/.bin/lcov-result-merger 'coverage-*/lcov.info' 'coverage/lcov.info'

coveralls-send:
	cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage

# test aliases

pgsql: postgres
postgresn: postgres-native

# test all the dialects \o/

all: sqlite mysql postgres postgres-native mariadb

all-cover: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage
coveralls: sqlite-cover mysql-cover postgres-cover postgres-native-cover mariadb-cover merge-coverage coveralls-send

.PHONY: sqlite mysql postgres pgsql postgres-native postgresn all test