Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dc6901
commit e36b2c7
Showing
11 changed files
with
204 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
src/* | ||
test/* | ||
template/* | ||
utils/* | ||
node_modules/* | ||
build/*.amd.js | ||
Makefile | ||
index.html | ||
index.html | ||
.travis.yml | ||
testrunner.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
language: node_js | ||
node_js: | ||
- 0.8 | ||
- 0.9 | ||
- 0.10 | ||
- 0.12 | ||
git: | ||
depth: 1 | ||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
console.log('Loading: test.html'); | ||
var page = require('webpage').create(); | ||
var url = 'index.html'; | ||
page.open(url, function (status) { | ||
if (status === 'success') { | ||
setTimeout(function () { | ||
var results = page.evaluate(function() { | ||
// remove the first node with the total from the following counts | ||
var passed = Math.max(0, document.querySelectorAll('.pass').length - 1); | ||
return { | ||
// retrieve the total executed tests number | ||
total: ''.concat( | ||
passed, | ||
' blocks (', | ||
document.querySelector('#wru strong').textContent.replace(/\D/g, ''), | ||
' single tests)' | ||
), | ||
passed: passed, | ||
failed: Math.max(0, document.querySelectorAll('.fail').length - 1), | ||
failures: [].map.call(document.querySelectorAll('.fail'), function (node) { | ||
return node.textContent; | ||
}), | ||
errored: Math.max(0, document.querySelectorAll('.error').length - 1), | ||
errors: [].map.call(document.querySelectorAll('.error'), function (node) { | ||
return node.textContent; | ||
}) | ||
}; | ||
}); | ||
console.log('- - - - - - - - - -'); | ||
console.log('total: ' + results.total); | ||
console.log('- - - - - - - - - -'); | ||
console.log('passed: ' + results.passed); | ||
if (results.failed) { | ||
console.log('failures: \n' + results.failures.join('\n')); | ||
} else { | ||
console.log('failed: ' + results.failed); | ||
} | ||
if (results.errored) { | ||
console.log('errors: \n' + results.errors.join('\n')); | ||
} else { | ||
console.log('errored: ' + results.errored); | ||
} | ||
console.log('- - - - - - - - - -'); | ||
if (0 < results.failed + results.errored) { | ||
status = 'failed'; | ||
} | ||
phantom.exit(0); | ||
}, 2000); | ||
} else { | ||
phantom.exit(1); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
program () { | ||
local bin="$1" | ||
if [ -d "node_modules/$bin" ]; then | ||
bin="$2" | ||
else | ||
if [ "$(which $bin)" = "" ]; then | ||
mkdir -p node_modules | ||
echo "installing $1" | ||
npm install $bin >/dev/null 2>&1 | ||
bin="$2" | ||
fi | ||
fi | ||
echo $bin | ||
} | ||
|
||
run () { | ||
local bin="$(program 'browserify' 'node_modules/browserify/bin/cmd.js')" | ||
$bin src/main.js -o build/bundle.max.js -d | ||
} | ||
|
||
run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
program () { | ||
local bin="$1" | ||
if [ -d "node_modules/$bin" ]; then | ||
bin="$2" | ||
else | ||
if [ "$(which $bin)" = "" ]; then | ||
mkdir -p node_modules | ||
echo "installing $1" | ||
npm install $bin >/dev/null 2>&1 | ||
bin="$2" | ||
fi | ||
fi | ||
echo $bin | ||
} | ||
|
||
run () { | ||
local bin="$(program 'jshint' 'node_modules/jshint/bin/jshint')" | ||
local folder=$1 | ||
local js="" | ||
# drop some info in the stdout | ||
echo "linting $f ... " | ||
for f in $folder/*; do | ||
# if it's a fodler, go for recursion | ||
if [ -d "$f" ]; then | ||
run "$f" | ||
else | ||
# grab .js files only | ||
js=$(echo "$f" | sed 's/.js//') | ||
if [ "$js" != "$f" ]; then | ||
# finally use jshint to verify the file | ||
$bin "$f" | ||
# in case there was an error | ||
if [[ $? -ne 0 ]] ; then | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
run src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
run () { | ||
local bin="uglifyjs" | ||
if [ -d "node_modules/uglify-js" ]; then | ||
bin="node_modules/uglify-js/bin/uglifyjs" | ||
else | ||
if [ "$(which $bin)" = "" ]; then | ||
mkdir -p node_modules | ||
echo "installing uglify-js" | ||
npm install "uglify-js@1" >/dev/null 2>&1 | ||
bin="node_modules/uglify-js/bin/uglifyjs" | ||
fi | ||
fi | ||
echo "$@" >build/bundle.js | ||
$bin --verbose build/bundle.max.js >>build/bundle.js | ||
|
||
} | ||
|
||
run "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
program () { | ||
local bin="$1" | ||
if [ -d "node_modules/$bin" ]; then | ||
bin="$2" | ||
else | ||
if [ "$(which $bin)" = "" ]; then | ||
mkdir -p node_modules | ||
echo "installing $1" | ||
npm install $bin >/dev/null 2>&1 | ||
bin="$2" | ||
fi | ||
fi | ||
echo $bin | ||
} | ||
|
||
run () { | ||
local bin="$(program 'watchify' 'node_modules/watchify/bin/cmd.js')" | ||
$bin src/main.js -o build/bundle.max.js -v | ||
} | ||
|
||
run |