Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add mocha-phantomjs for testing browser, update travis

  • Loading branch information...
commit 28933cd61d3d428ad692b99d95cc07fd0d79ce49 1 parent 64cb3a0
@paularmstrong authored
View
4 .travis.yml
@@ -1,3 +1,5 @@
language: node_js
+script: "make lint && make test reporter=spec && make test-browser"
node_js:
- - 0.6
+ - 0.6
+ - 0.8
View
5 Makefile
@@ -12,6 +12,9 @@ opts =
test:
@node_modules/mocha/bin/mocha --reporter ${reporter} ${opts} ${tests}
+test-browser: browser
+ @node_modules/mocha-phantomjs/bin/mocha-phantomjs dist/test/index.html
+
files := $(shell find . -name '*.js' ! -path "*node_modules/*" ! -path "*dist/*")
lint:
@node_modules/nodelint/nodelint ${files} --config=scripts/config-lint.js
@@ -31,4 +34,4 @@ coverage:
speed:
@node tests/speed.js
-.PHONY: all browser test lint coverage speed
+.PHONY: all browser test test-browser lint coverage speed
View
6 dist/test/index.html
@@ -33,7 +33,11 @@
<div id="mocha"></div>
<script>
- mocha.run();
+ if (window.mochaPhantomJS) {
+ mochaPhantomJS.run();
+ } else {
+ mocha.run();
+ }
</script>
</body>
View
5 package.json
@@ -26,7 +26,8 @@
"nodelint": "~0.6",
"uglify-js": ">=1.1.0",
"mocha": "~1.6",
- "expect.js": "~0.2"
+ "expect.js": "~0.2",
+ "mocha-phantomjs": "~1.0.1"
},
"main": "index",
"engines": {
@@ -34,7 +35,7 @@
},
"scripts": {
"prepublish": "npm prune",
- "test": "make lint && make test"
+ "test": "make lint && make test reporter=spec && make test-browser"
},
"bugs": {
"url": "https://github.com/paularmstrong/swig/issues"
View
2  scripts/browser.sh
@@ -88,7 +88,7 @@ find tests -name "*.test.js" ! -name "helpers.test.js" | while read FILE; do
TEST_FILE=$(basename $FILE)
TEMP_FILE="dist/.$TEST_FILE"
NAME=$(sed -e 's/.test.js//' <<< $TEST_FILE)
- cat $FILE >> dist/test/$TEST_FILE
+ cat $FILE > dist/test/$TEST_FILE
cp dist/test/$TEST_FILE $TEMP_FILE
sed "/require\([^\)]\)/d" <$TEMP_FILE > dist/test/$TEST_FILE
Please sign in to comment.
Something went wrong with that request. Please try again.