use a variable for jasmine-node program
[mkws-moved-to-github.git] / test / Makefile
1 # Copyright (c) 2013 IndexData ApS. http://indexdata.com
2
3 # For running on Mike's local install of node.js
4 MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
5 NPM_INSTALL_FLAGS=-q
6 JASMINE_NODE=   ./node_modules/jasmine-node/bin/jasmine-node
7 PHANTOMJS=      ./node_modules/phantomjs/bin/phantomjs
8 PHANTOMJS_URL=  https://mkws-dev.indexdata.com/jasmine-popup.html       
9 PHANTOMJS_TIMEOUT=      12      
10 IMAGES= ./images
11 SCREENSHOT_WIDTH=       360 480 640 768 1024 1200 1440 2048
12
13 all: check
14
15 clean:
16         rm -f mkws-error.png mkws-error.html images/*.png
17
18 distclean: clean
19         rm -rf node_modules
20
21 mkws-complete-syntax-check:
22         ${MAKE} -C../tools/htdocs $@
23
24 check: mkws-complete-syntax-check
25         @if [ ! -e node_modules ]; then echo "please run first: make node-modules"; exit 1; fi 
26         ${JASMINE_NODE} --noColor --captureExceptions --forceexit ./spec
27         ${JASMINE_NODE} --noColor --captureExceptions --forceexit ./spec-sp
28
29 test: check
30
31 terse:
32         $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
33
34 phantomjs:
35         ${PHANTOMJS} phantom/evaluate.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
36
37 screenshot:
38         ${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
39
40 screenshot-mkws:
41         for i in ${SCREENSHOT_WIDTH}; do \
42             ${PHANTOMJS} phantom/screenshot.js http://mkws.indexdata.com ${IMAGES}/mkws-$$i.png $$i 1000 &  \
43         done; wait
44         ls -l ${IMAGES}
45
46 screenshot-indexdata:
47         for i in ${SCREENSHOT_WIDTH}; do \
48             ${PHANTOMJS} phantom/screenshot.js http://www.indexdata.com ${IMAGES}/indexdata-$$i.png $$i 1000 &  \
49         done; wait
50         ls -l ${IMAGES}
51
52 jsbeautifier jsb indent:
53         for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \
54           jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
55         done
56
57 node_modules node-modules:
58         npm install ${NPM_INSTALL_FLAGS}
59
60 help:
61         @echo "make [ all | check | clean | distclean ]"
62         @echo "     [ phantomjs | screenshot ]"
63         @echo "     [ jsbeautifier | node-modules ]"
64         @echo ""
65         @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOM_URL=https://mkws-dev.indexdata.com/jasmine-popup.html"
66