Permalink
Browse files

client tests on travis

  • Loading branch information...
1 parent 804fc4e commit b30a49540bbb152e7526e7779282973bd77714bc @lancejpollard lancejpollard committed Sep 18, 2012
Showing with 47 additions and 14 deletions.
  1. +4 −2 .travis.yml
  2. +43 −12 Makefile
View
@@ -5,8 +5,10 @@ install: npm install
services: mongodb
# @todo once `make test-client` is working
before_script:
- - "make start-client-test-server &"
- - sleep 5
+ - "npm install grunt"
+ - "make setup-test-client"
+ - "make start-test-client &"
+ - sleep 3
# - "cd test/example"
# - "grunt --config ./grunt.coffee"
# - "cd ../.."
View
@@ -2,30 +2,61 @@ SRC = $(shell find test/cases -name client -prune -o -name '*Test.coffee' -print
STORES = memory mongodb
CMD = ./node_modules/mocha/bin/mocha
DIR = $(shell pwd)
+GRUNT = grunt
+FOREVER = forever
-test-all:
- for i in $(STORES); do ./node_modules/mocha/bin/mocha $(SRC) --store $$i; done
+# @todo make this into a method
+#define checkmodule
+#endef
+#
+#check-grunt:
+# $(call checkmodule,grunt,./node_modules/grunt/bin/grunt)
+
+check-grunt:
+ifeq ($(shell which $(GRUNT)),)
+ $(eval GRUNT = ./node_modules/grunt/bin/grunt)
+ifeq ($(shell which ./node_modules/grunt/bin/grunt),)
+ npm install grunt
+endif
+endif
+
+check-forever:
+ifeq ($(shell which $(FOREVER)),)
+ $(eval FOREVER = ./node_modules/forever/bin/forever)
+ifeq ($(shell which ./node_modules/forever/bin/forever),)
+ npm install forever
+endif
+endif
+
+# ps -ef | awk '/node server -p 3210/{print $2}' | wc -l | awk '{print $1}'
+# check-server: check-forever
-check:
+check-phantomjs:
ifeq ($(shell which phantomjs),) # if it's blank
$(error PhantomJS is not installed. Download from http://phantomjs.org or run `brew install phantomjs` if you have Homebrew)
endif
-test: check test-memory test-mongodb
+test: test-memory test-mongodb
test-memory:
$(CMD) $(SRC) --store memory
test-mongodb:
$(CMD) $(SRC) --store mongodb
-start-client-test-server:
- cd test/example && grunt --config ./grunt.coffee
- cd test/example && node server -p 3210
-
test-client:
phantomjs test/client.coffee http://localhost:3210/?test=support,application,store,model
+setup-test-client: check-phantomjs check-grunt
+ $(GRUNT) --config ./grunt.coffee
+ cd test/example && $(GRUNT) --config ./grunt.coffee
+
+start-test-client:
+ cd test/example && node server -p 3210
+
+test-all:
+ for i in $(STORES); do ./node_modules/mocha/bin/mocha $(SRC) --store $$i; done
+
clean:
rm -rf lib/*
@@ -37,15 +68,15 @@ install:
npm install-dev
watch:
- grunt start --config ./grunt.coffee
+ $(GRUNT) start --config ./grunt.coffee
build:
- grunt build:client --config ./grunt.coffee
+ $(GRUNT) build:client --config ./grunt.coffee
dist:
- grunt dist --config ./grunt.coffee
+ $(GRUNT) dist --config ./grunt.coffee
publish:
npm publish
-.PHONY: test-memory test-mongodb test test-all check test-client build dist start-client-test-server
+.PHONY: test-memory test-mongodb test test-all test-client build dist check-phantomjs check-grunt check-forever setup-test-client start-test-client

0 comments on commit b30a495

Please sign in to comment.