Skip to content
Newer
Older
100644 36 lines (31 sloc) 1002 Bytes
eda7c43 @lawnsea Finish test build support
lawnsea authored
1 PWD = $(shell pwd)
2 TEST_REPORTER ?= dot
3 TEST_PORT ?= 8080
4 TEST_TIMEOUT ?= 4000
5 TEST_SLOW ?= 2000
6 NODE_MODULES = $(PWD)/node_modules
65b75b3 @lawnsea Run test server in the right directory
lawnsea authored
7 # XXX: below may be a bit too clever
eda7c43 @lawnsea Finish test build support
lawnsea authored
8 PID_FILE := $(PWD)/$(shell echo ".test-server-pid.$$RANDOM")
9
41fd5b9 @lawnsea Finish Cucumber.js example (fixes #8)
lawnsea authored
10 fixture-server:
65b75b3 @lawnsea Run test server in the right directory
lawnsea authored
11 @cd tests/fixtures ; \
12 $(NODE_MODULES)/.bin/http-server -s -p $(TEST_PORT) & \
13 echo "$$!" > $(PID_FILE) ; \
14 cd $(PWD)
41fd5b9 @lawnsea Finish Cucumber.js example (fixes #8)
lawnsea authored
15
16 test: fixture-server
eda7c43 @lawnsea Finish test build support
lawnsea authored
17 @$(NODE_MODULES)/.bin/mocha tests/test --recursive \
cb7f44a @lawnsea Always kill test server
lawnsea authored
18 --globals define \
19 --timeout $(TEST_TIMEOUT) --slow $(TEST_SLOW) \
e66c759 @lawnsea Pass thru arguments to mocha when running the tests
lawnsea authored
20 -R $(TEST_REPORTER) $(TEST_ARGS) ; \
cb7f44a @lawnsea Always kill test server
lawnsea authored
21 STATUS=$$? ; \
22 kill -9 `cat $(PID_FILE)` ; rm $(PID_FILE) ; \
23 exit $$STATUS
937633b @lawnsea Switch to mocha for tests
lawnsea authored
24
41fd5b9 @lawnsea Finish Cucumber.js example (fixes #8)
lawnsea authored
25 cucumber.js: fixture-server
26 @TEST_PORT=$(TEST_PORT) $(NODE_MODULES)/.bin/cucumber.js \
27 -f pretty \
28 examples/cucumber/features \
29 --require examples/cucumber/features/steps \
30 --require examples/cucumber/features/support ; \
31 STATUS=$$? ; \
32 kill -9 `cat $(PID_FILE)` ; rm $(PID_FILE) ; \
33 exit $$STATUS
34
35 .PHONY: test fixture-server cucumber.js
Something went wrong with that request. Please try again.