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