mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
test: refactor test:demo script into demo/*/test.sh
This commit is contained in:
@@ -1,85 +0,0 @@
|
||||
# npm run build before running this check
|
||||
set -x
|
||||
|
||||
npm link
|
||||
|
||||
cd demo/webpack
|
||||
npm link liquidjs
|
||||
npm run build
|
||||
if npm start | grep 'Webpack Demo for LiquidJS'; then
|
||||
echo [success] demo/webpack
|
||||
else
|
||||
echo [fail] demo/webpack
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
|
||||
cd demo/nodejs
|
||||
npm link liquidjs
|
||||
if npm start | grep 'NodeJS Demo for LiquidJS'; then
|
||||
echo [success] demo/nodejs
|
||||
else
|
||||
echo [fail] demo/nodejs
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
|
||||
cd demo/template
|
||||
npm link liquidjs
|
||||
if npm start | grep '\[11:8] {{ todo }}'; then
|
||||
echo [success] demo/template
|
||||
else
|
||||
echo [fail] demo/template
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
|
||||
cd demo/typescript
|
||||
npm link liquidjs
|
||||
if npm start | grep 'TypeScript Demo for LiquidJS'; then
|
||||
echo [success] demo/typescript
|
||||
else
|
||||
echo [fail] demo/typescript
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
|
||||
cd demo/esm
|
||||
npm link liquidjs
|
||||
if npm start | grep 'LiquidJS Demo'; then
|
||||
echo [success] demo/esm
|
||||
else
|
||||
echo [fail] demo/esm
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
|
||||
cd demo/express
|
||||
npm link liquidjs
|
||||
|
||||
LOG_FILE=$(mktemp)
|
||||
npm start > $LOG_FILE 2>&1 &
|
||||
SERVER_PID=$!
|
||||
while ! grep -q "Express running" "$LOG_FILE"; do
|
||||
if ! kill -0 $SERVER_PID; then
|
||||
echo "Server exited unexpectedly."
|
||||
cat $LOG_FILE
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
curl http://127.0.0.1:3000 | grep -q 'Welcome to LiquidJS'
|
||||
RESULT=$?
|
||||
killall node
|
||||
rm $LOG_FILE
|
||||
if [ $RESULT = 0 ]; then
|
||||
echo [success] demo/express
|
||||
else
|
||||
echo [fail] demo/express
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
# npm run build before running this check
|
||||
set -x
|
||||
export CI=true
|
||||
|
||||
if [ ! -d dist ]; then
|
||||
echo >2 'build and link liquidjs before run test.sh'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm link
|
||||
|
||||
for demo in $(ls demo); do
|
||||
cd demo/$demo
|
||||
npm link liquidjs
|
||||
|
||||
if npm test; then
|
||||
echo [success] demo/webpack
|
||||
else
|
||||
echo [fail] demo/webpack
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
done
|
||||
Reference in New Issue
Block a user