Commit d020d2a2 authored by Hunter Loftis's avatar Hunter Loftis

test and implementation for failing on incorrectly formatted json; new vendor/jq

parent 7084667a
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
####### Configure environment ####### Configure environment
set -e # fail fast set -o errexit # always exit on error
set -o pipefail # don't ignore exit codes when piping output
set -o errtrace # trap errors in functions as well set -o errtrace # trap errors in functions as well
set -o pipefail # don't ignore exit codes when piping output
set -o posix # more strict failures in subshells
# set -x # enable debugging # set -x # enable debugging
# Configure directories # Configure directories
......
...@@ -18,6 +18,15 @@ testDetectWithoutPackageJson() { ...@@ -18,6 +18,15 @@ testDetectWithoutPackageJson() {
assertCapturedError 1 "" assertCapturedError 1 ""
} }
testBadJson() {
compile "bad-json"
assertCaptured "Build failed"
assertCaptured "We're sorry this build is failing"
assertNotCaptured "build directory..."
assertNotCaptured "Installing binaries"
assertCapturedError 1 ""
}
testIoJs() { testIoJs() {
compile "iojs" compile "iojs"
assertCaptured "Node engine: 1.0." assertCaptured "Node engine: 1.0."
...@@ -92,8 +101,10 @@ testNpmVersionSpecific() { ...@@ -92,8 +101,10 @@ testNpmVersionSpecific() {
testFailingBuild() { testFailingBuild() {
compile "failing-build" compile "failing-build"
assertCaptured "Building dependencies"
assertCaptured "Build failed" assertCaptured "Build failed"
assertCaptured "We're sorry this build is failing" assertCaptured "We're sorry this build is failing"
assertNotCaptured "Checking startup method"
assertCapturedError 1 "" assertCapturedError 1 ""
} }
......
...@@ -39,12 +39,7 @@ read_json() { ...@@ -39,12 +39,7 @@ read_json() {
local file=$1 local file=$1
local node=$2 local node=$2
if test -f $file; then if test -f $file; then
local result="$(cat $file | $bp_dir/vendor/jq -r $node)" cat $file | $bp_dir/vendor/jq --raw-output "$node // \"\"" || return 1
if [ "$result" == "null" ]; then
echo ""
else
echo "$result"
fi
else else
echo "" echo ""
fi fi
......
A fake README, to keep npm from polluting stderr.
\ No newline at end of file
{
"name": "node-buildpack-test-app",
"version": "0.0.1",
"description": "node buildpack integration test app",
"repository" : {
"type" : "git",
"url" : "http://github.com/example/example.git"
},
"dependencies": {
"hashish": "*"
"express": "*"
},
"engines": {
"node": "0.10.29"
}
}
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment