-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (63 loc) · 1.45 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
##
# Binaries
##
ESLINT := node_modules/.bin/eslint
KARMA := node_modules/.bin/karma
##
# Files
##
LIBS = $(shell find lib -type f -name "*.js")
TESTS = $(shell find test -type f -name "*.test.js")
SUPPORT = $(wildcard karma.conf*.js)
ALL_FILES = $(LIBS) $(TESTS) $(SUPPORT)
##
# Program options/flags
##
# A list of options to pass to Karma
# Overriding this overwrites all options specified in this file (e.g. BROWSERS)
KARMA_FLAGS ?=
# A list of Karma browser launchers to run
# http://karma-runner.github.io/0.13/config/browsers.html
BROWSERS ?=
ifdef BROWSERS
KARMA_FLAGS += --browsers $(BROWSERS)
endif
ifdef CI
KARMA_CONF ?= karma.conf.ci.js
else
KARMA_CONF ?= karma.conf.js
endif
# Mocha flags.
GREP ?= .
##
# Tasks
##
# Install node modules.
node_modules: package.json $(wildcard node_modules/*/package.json)
@npm install
@touch $@
# Install dependencies.
install: node_modules
# Remove temporary files and build artifacts.
clean:
rm -rf *.log coverage
.PHONY: clean
# Remove temporary files, build artifacts, and vendor dependencies.
distclean: clean
rm -rf node_modules
.PHONY: distclean
# Lint JavaScript source files.
lint: install
@$(ESLINT) $(ALL_FILES)
.PHONY: lint
# Attempt to fix linting errors.
fmt: install
@$(ESLINT) --fix $(ALL_FILES)
.PHONY: fmt
# Run browser unit tests in a browser.
test-browser: install
@$(KARMA) start $(KARMA_FLAGS) $(KARMA_CONF)
# Default test target.
test: lint test-browser
.PHONY: test
.DEFAULT_GOAL = test