Skip to content

Commit

Permalink
test: refactor test:demo script into demo/*/test.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Aug 28, 2024
1 parent da516a4 commit 62bb20e
Show file tree
Hide file tree
Showing 48 changed files with 3,179 additions and 23,204 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Test
Expand Down
1 change: 1 addition & 0 deletions demo/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "Liquidjs Demo for Browser Usage",
"main": "index.html",
"scripts": {
"test": "echo not implemented",
"start": "http-server -c-1 "
},
"author": "harttle <[email protected]>",
Expand Down
3 changes: 2 additions & 1 deletion demo/esm/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "liquidjs-demo-nodejs",
"name": "liquidjs-demo-esm",
"description": "Node.js demo for liquidjs",
"private": true,
"main": "index.mjs",
"scripts": {
"test": "./test.sh",
"start": "node index.mjs"
},
"dependencies": {
Expand Down
3 changes: 3 additions & 0 deletions demo/esm/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -ex

npm start | grep 'LiquidJS Demo'
4 changes: 2 additions & 2 deletions demo/express/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "express-demo",
"name": "liquidjs-demo-express",
"version": "1.0.0",
"private": true,
"description": "Express Demo Using liquidjs",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./test.sh"
},
"author": "harttle",
"license": "MIT",
Expand Down
20 changes: 20 additions & 0 deletions demo/express/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set -x

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
exit 1
fi
1 change: 1 addition & 0 deletions demo/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"main": "index.js",
"scripts": {
"test": "./test.sh",
"start": "node index.js"
},
"dependencies": {
Expand Down
3 changes: 3 additions & 0 deletions demo/nodejs/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -ex

npm start | grep 'NodeJS Demo for LiquidJS'
2,511 changes: 5 additions & 2,506 deletions demo/reactjs/README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions demo/reactjs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<title>React Demo for LiquidJS</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading

0 comments on commit 62bb20e

Please sign in to comment.