forked from tuhuayuan/xiucall-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (46 loc) · 1.28 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
SRC = $(wildcard src/*.js)
LIB = $(SRC:src/%.js=lib/%.js)
FUNCTESTS ?= $(shell ls -S `find test/functests -type f -name "*.js" -print`)
UNITTESTS ?= $(shell ls -S `find test/unittests -type f -name "*.js" -print`)
MODE ?= connector
NPM_REGISTRY ?= "--registry=http://registry.npm.taobao.org"
# unittest configs
MOCHA_OPTS = --compilers js:babel-register -s 1000
TIMEOUT = 5000
REPORTER = spec
pre-build:
npm $(NPM_REGISTRY) install
uninstall:
@rm -rf ./node_modules
build: pre-build $(LIB)
lib/%.js: src/%.js .babelrc
mkdir -p $(@D)
./node_modules/.bin/babel $< -o $@
test-cov:
@NODE_ENV=test ./node_modules/.bin/babel-node \
./node_modules/.bin/babel-istanbul cover \
./node_modules/.bin/_mocha -- \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
$(MOCHA_OPTS) \
$(FUNCTESTS) $(UNITTESTS)
test: test-unit test-func
test-unit:
@NODE_ENV=test ./node_modules/.bin/mocha \
-r ./test/entry.js \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
$(UNITTESTS)
test-func:
@NODE_ENV=test ./node_modules/.bin/mocha \
-r ./test/entry.js \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
$(MOCHA_OPTS) \
$(FUNCTESTS)
clean:
@rm -rf $(LIB)
@rm -rf ./coverage
run: build
@node lib/index.js --mode $(MODE)
.PHONY: test test-unit test-func test-cov pre-build uninstall clean run