File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}"
2121
2222# Run prism mock on the given spec
2323if [ " $1 " == " --daemon" ]; then
24+ # Pre-install the package so the download doesn't eat into the startup timeout
25+ npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
26+
2427 npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock " $URL " & > .prism.log &
2528
26- # Wait for server to come online
29+ # Wait for server to come online (max 30s)
2730 echo -n " Waiting for server"
31+ attempts=0
2832 while ! grep -q " ✖ fatal\|Prism is listening" " .prism.log" ; do
33+ attempts=$(( attempts + 1 ))
34+ if [ " $attempts " -ge 300 ]; then
35+ echo
36+ echo " Timed out waiting for Prism server to start"
37+ cat .prism.log
38+ exit 1
39+ fi
2940 echo -n " ."
3041 sleep 0.1
3142 done
You can’t perform that action at this time.
0 commit comments