-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (39 loc) · 1.06 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
#
# Makefile for mocha
# by: zander - [email protected]
#
# usage:
# make test
# make test <path/to/test>
#
# override default MOCHA_OPTS:
# make MOCHA_OPTS='-C -R dot' test
#
ENV_VARS=NODE_ENV=test PORT=9999
TEST_DIR=test/unit/
MOCHA_BIN=mocha
MOCHA_DEFAULT_OPTS=--recursive -t 30000
MOCHA_OPTS=-R spec
ifneq "$(wildcard ./node_modules/sails-test-helper/node_modules/.bin/mocha)" ""
MOCHA_BIN=./node_modules/sails-test-helper/node_modules/.bin/mocha
endif
ifneq "$(wildcard ./node_modules/.bin/mocha)" ""
MOCHA_BIN=./node_modules/.bin/mocha
endif
check: test
test:
@$(eval TARGETS=$(filter-out $@,$(MAKECMDGOALS)))
@$(eval TARGETS=$(TARGETS:test/%=%))
@$(eval TARGETS=$(TARGETS:unit%=%))
@$(eval TARGETS=$(TARGETS:/%=%))
@$(eval TARGETS=$(addprefix $(TEST_DIR),$(TARGETS)))
@$(eval TARGET=$(shell [ -z $(firstword ${TARGETS}) ] && echo ${TEST_DIR}))
@$(ENV_VARS) $(MOCHA_BIN) $(MOCHA_DEFAULT_OPTS) $(MOCHA_OPTS) $(TARGET) $(TARGETS)
clean:
@echo 'deleting node_modules...'
@\rm -Rf ./node_modules
silent:
@:
%: silent
@:
.PHONY: check clean silent test