forked from Strider-CD/strider
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (63 loc) · 2.34 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
has_sauce := $(SAUCE_USERNAME)
no_browser_tests := $(NO_BROWSER_TESTS)
ifdef no_browser_tests
test-env :=
else
ifndef has_sauce
test-env := test-local
else
test-env := test-sauce
endif
endif
build:
npm run build
## ================= Test Suite ====================================
test: build test-syntax test-smoke test-unit test-browser
test-smoke:
# TODO Smoke tests should fail _fast_ on silly errors.
test-unit:
@./node_modules/.bin/mocha -R spec test/unit/test_middleware.js
@./node_modules/.bin/mocha -R spec test/unit/test_ansi.js
@./node_modules/.bin/mocha -R spec test/unit/test_config.js
@./node_modules/.bin/mocha -R spec test/unit/test_utils.js
# Either test-local or test-sauce
test-browser: $(test-env)
# ===== SAUCE:
test-sauce: test-sauce-pre test-integration-sauce
test-sauce-pre:
ifndef SAUCE_ACCESS_KEY
$(error You need env: SAUCE_ACCESS_KEY)
endif
# Sauce Connect: https://saucelabs.com/docs/connect
test-integration-sauce:
# --- INTEGRATION TESTING ---
echo $$WEBDRIVER_REMOTE
echo $$BROWSERS
# -------
TEST_STRIDER=1 ./node_modules/mocha/bin/mocha -R spec test/runner.js
test-client-sauce:
./node_modules/mocha-selenium/bin/mocha-selenium.js -c test/client/selenium.json -p -e sauce test/client/dashboard.js test/client/projects.js
# ====== LOCAL:
test-local:
# You need to run chromedriver for this to work. If you don't have it,
# you can get it w/ npm install -g chromedriver
# Then `chromedriver --url-base=/wd/hub`
#
# Limit to a single test suite by specifying the filename:
# e.g. TEST_SUITE=login_test make test-local
#
# You can combine this with `watchy` to improve your workflow:
# e.g. TEST_SUITE=login_test watchy -w test/integration/login_test.js -- make test-local
$(which chromedriver)
WEBDRIVER_REMOTE='{"hostname":"localhost","port":9515}' BROWSERS='[{"version":"","browserName":"chrome","platform":"Linux"}]' ./node_modules/mocha/bin/mocha -R spec test/runner.js
start-chromedriver:
chromedriver --url-base=/wd/hub
test-client-local:
./node_modules/.bin/mocha test/client/
test-syntax: lint
tolint := *.js *.json lib client
lint:
@./node_modules/.bin/jshint --verbose $(tolint)
authors-list:
git shortlog -e -n -s $$commit | awk '{ args[NR] = $$0; sum += $$0 } END { for (i = 1; i <= NR; ++i) { printf "%-60s %2.1f%%\n", args[i], 100 * args[i] / sum } }' > AUTHORS
.PHONY: test lint start-chromedriver