Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add tests around creating a default Procfile

  • Loading branch information...
commit e9266dfec59d3110ff1a651542b7a651f1b08364 1 parent d93ee4c
Zeke Sikelianos zeke authored
11 bin/compile
View
@@ -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
13 bin/test
View
@@ -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() {
1  test/procfile-absent-npm-start-absent/README.md
View
@@ -0,0 +1 @@
+A fake README, to keep npm from polluting stderr.
15 test/procfile-absent-npm-start-absent/package.json
View
@@ -0,0 +1,15 @@
+{
+ "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"
+ }
+}
1  test/procfile-absent-npm-start-present/README.md
View
@@ -0,0 +1 @@
+A fake README, to keep npm from polluting stderr.
18 test/procfile-absent-npm-start-present/package.json
View
@@ -0,0 +1,18 @@
+{
+ "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"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.