Commit db801a04 authored by Hunter Loftis's avatar Hunter Loftis

test and implementation for no-start warnings

parent 6046385b
...@@ -43,6 +43,7 @@ handle_failure() { ...@@ -43,6 +43,7 @@ handle_failure() {
warn_untracked_dependencies "$LOG_FILE" warn_untracked_dependencies "$LOG_FILE"
warn_angular_resolution "$LOG_FILE" warn_angular_resolution "$LOG_FILE"
warn_missing_devdeps "$LOG_FILE" warn_missing_devdeps "$LOG_FILE"
warn_no_start "$LOG_FILE"
failure_message | output "$LOG_FILE" failure_message | output "$LOG_FILE"
} }
trap 'handle_failure' ERR trap 'handle_failure' ERR
...@@ -159,3 +160,5 @@ summarize_build() { ...@@ -159,3 +160,5 @@ summarize_build() {
header "Build succeeded!" header "Build succeeded!"
summarize_build | output "$LOG_FILE" summarize_build | output "$LOG_FILE"
warn_no_start "$LOG_FILE"
...@@ -35,6 +35,14 @@ warning() { ...@@ -35,6 +35,14 @@ warning() {
echo "" >> $warnings echo "" >> $warnings
} }
warn() {
local tip=${1:-}
local url=${2:-https://devcenter.heroku.com/articles/nodejs-support}
echo " ! $tip" || true
echo " $url" || true
echo ""
}
warn_node_engine() { warn_node_engine() {
local node_engine=${1:-} local node_engine=${1:-}
if [ "$node_engine" == "" ]; then if [ "$node_engine" == "" ]; then
...@@ -101,3 +109,15 @@ warn_missing_devdeps() { ...@@ -101,3 +109,15 @@ warn_missing_devdeps() {
fi fi
fi fi
} }
warn_no_start() {
local log_file="$1"
if ! [ -e "$BUILD_DIR/Procfile" ]; then
local startScript=$(read_json "$BUILD_DIR/package.json" ".scripts.start")
if [ "$startScript" == "" ]; then
if ! [ -e "$BUILD_DIR/server.js" ]; then
warn "This app may not specify any way to start a node process" "https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type"
fi
fi
fi
}
{
"name": "no-start",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
},
"keywords": [],
"author": "",
"license": "ISC"
}
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
"repository" : { "repository" : {
"type" : "git", "type" : "git",
"url" : "http://github.com/example/example.git" "url" : "http://github.com/example/example.git"
},
"scripts": {
"start": "node server.js"
} }
} }
#!/usr/bin/env bash #!/usr/bin/env bash
# See README.md for info on running these tests. # See README.md for info on running these tests.
testWarnNoStart() {
compile "no-start"
assertCaptured "may not specify any way to start"
assertCapturedSuccess
compile "no-version"
assertNotCaptured "may not specify any way to start"
assertCapturedSuccess
}
testWarnDevDeps() { testWarnDevDeps() {
compile "missing-devdeps-1" compile "missing-devdeps-1"
assertCaptured "A module may be missing" assertCaptured "A module may be missing"
......
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