forked from chaijs/chai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (89 loc) · 2.14 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
NODE_MAJOR_VERSION := $(firstword $(subst ., ,$(shell node --version)))
ifeq ($(NODE_MAJOR_VERSION),v8)
TESTS = test/*.js
else ifeq ($(NODE_MAJOR_VERSION),v10)
TESTS = test/*.js
else ifeq ($(NODE_MAJOR_VERSION),v12)
TESTS = test/*.js
else
TESTS = test/*.js test/*.mjs
endif
REPORTER = dot
#
# Browser Build
#
all: chai.js
chai.js: node_modules lib/*
@printf "==> [Browser :: build]\n"
@./node_modules/.bin/browserify \
--bare \
--outfile chai.js \
--standalone chai \
--entry index.js
#
# Release Task
#
define release
./node_modules/.bin/bump -y --$(1) package.json lib/chai.js
make chai.js
git add --force chai.js lib/chai.js package.json bower.json
npm ls --depth=-1 --long . --loglevel silent | head -1 | git commit -F-
endef
release-patch:
@$(call release,patch)
release-minor:
@$(call release,minor)
release-major:
@$(call release,major)
#
# Node Module
#
node_modules: package.json
@npm install
#
# Tests
#
test: test-node test-chrome
test-node: node_modules
@printf "==> [Test :: Node.js]\n"
@NODE_ENV=test ./node_modules/.bin/mocha \
--require ./test/bootstrap \
--reporter $(REPORTER) \
$(TESTS)
test-cov: node_modules
@NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \
--require ./test/bootstrap \
$(TESTS) \
test-chrome: clean-browser chai.js
@printf "==> [Test :: Karma (chrome)]\n"
@./node_modules/karma/bin/karma start \
--single-run --browsers HeadlessChrome
test-firefox: clean-browser chai.js
@printf "==> [Test :: Karma (Firefox)]\n"
@./node_modules/karma/bin/karma start \
--browsers Firefox
test-sauce: clean-browser chai.js
@printf "==> [Test :: Karma (Sauce)]\n"
@CHAI_TEST_ENV=sauce ./node_modules/karma/bin/karma start \
--single-run
test-travisci:
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
@make test-cov
@make test-sauce
#
# Clean up
#
clean: clean-node clean-browser clean-cov
clean-node:
@rm -rf node_modules
clean-browser:
@rm -f chai.js
clean-cov:
@rm -rf coverage
#
# Instructions
#
.PHONY: all
.PHONY: test test-all test-node test-chrome test-sauce test-cov
.PHONY: clean clean-node clean-browser clean-cov
.PHONY: release-patch release-minor release-major