-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
77 lines (68 loc) · 1.68 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
MOCHA = node_modules/.bin/_mocha
ISTANBUL = node_modules/.bin/istanbul
ISTANBUL_COMMAND = cover
SEQUELIZE = node_modules/.bin/sequelize
SEQUELIZE_UP = db:migrate
SEQUELIZE_DOWN = db:migrate:undo
JSHINT = node_modules/.bin/jshint
JSHINT_REPORTER = unix
JSCS = node_modules/.bin/jscs
JSCS_REPORTER = inline
TESTS = test
NODE_ENV = test
REPORTER = spec
TIMEOUT = 7000
BIN = node
test: $(MOCHA)
@NODE_ENV=$(NODE_ENV) \
$(BIN) $(FLAGS) \
$(MOCHA) $(MOCHA_FLAGS) \
--timeout $(TIMEOUT) \
--reporter $(REPORTER) \
test/globals.js $(TESTS) \
--recursive
test-cov: $(MOCHA) $(ISTANBUL)
@NODE_ENV=test $(BIN) $(FLAGS) \
$(ISTANBUL) $(ISTANBUL_COMMAND) \
$(MOCHA) \
-- -u exports \
--timeout $(TIMEOUT) \
--reporter $(REPORTER) \
test/globals.js $(TESTS) \
--recursive \
--bail
test-travis: .travis.yml lint
@NODE_ENV=test $(BIN) $(FLAGS) \
$(ISTANBUL) $(ISTANBUL_COMMAND) \
$(MOCHA) \
-- -u exports \
--timeout $(TIMEOUT) \
--reporter $(REPORTER) \
--report lconvonly \
test/globals.js $(TESTS) \
--recursive
jshint: $(JSHINT) $(JSCS)
@echo "Running JSHint..."; \
NODE_ENV=test $(BIN) $(FLAGS) \
$(JSHINT) . --reporter=$(JSHINT_REPORTER) \
&& echo "JSHint ok!"
jscs:
@echo "Running JSCS..."; \
NODE_ENV=test $(BIN) $(FLAGS) \
$(JSCS) . --reporter=$(JSCS_REPORTER) \
&& echo "JSCS ok!"
lint: jshint jscs
migrate:
@NODE_ENV=$(NODE_ENV) \
$(BIN) $(FLAGS) \
$(SEQUELIZE) $(SEQUELIZE_UP) \
--env $(NODE_ENV)
undomigrate:
@for file in $(shell ls migrations); \
do \
NODE_ENV=$(NODE_ENV) \
$(BIN) $(FLAGS) \
$(SEQUELIZE) $(SEQUELIZE_DOWN) \
--env $(NODE_ENV); \
done
.PHONY: test test-cov test-travis jshint jscs lint migrate undomigrate