Commit e9266dfe authored by zeke's avatar zeke

add tests around creating a default Procfile

parent d93ee4ce
......@@ -80,14 +80,15 @@ status "Cleaning up node-gyp and npm artifacts"
rm -rf "$build_dir/.node-gyp"
rm -rf "$build_dir/.npm"
# Add npm start to Procfile if necessary
# If Procfile is absent, try to create one using `npm start`
if [ ! -e $build_dir/Procfile ]; then
npm_start=$(cat $build_dir/package.json | $bp_dir/vendor/jq -r .scripts.start)
# If a start script is declared, add it to a Procfile
if [ "$npm_start" != "null" ]; then
status "No Procfile present; adding npm start script to Procfile"
echo "web: $npm_start" > $build_dir/Procfile
if [ "$npm_start" == "null" ]; then
protip "Create a Procfile or specify a start script in package.json"
else
status "No Procfile found; adding npm start script to Procfile"
echo "web: npm start" > $build_dir/Procfile
fi
fi
......
......@@ -91,6 +91,19 @@ testUserConfig() {
assertCapturedError 1 ""
}
testProcfileAbsentNpmStartPresent() {
compile "procfile-absent-npm-start-present"
assertCaptured "No Procfile found; adding npm start script to Procfile"
assertFile "web: npm start" "Procfile"
assertCapturedSuccess
}
testProcfileAbsentNpmStartAbsent() {
compile "procfile-absent-npm-start-absent"
assertCaptured "Create a Procfile or specify a start script"
assertCapturedSuccess
}
# Pending Tests
# testNodeBinariesAddedToPath() {
......
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": "*"
},
"engines": {
"node": "~0.10.0"
}
}
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": "*"
},
"engines": {
"node": "~0.10.0"
},
"scripts": {
"start": "echo foo"
}
}
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