Skip to content

Commit 62bb20e

Browse files
committed
test: refactor test:demo script into demo/*/test.sh
1 parent da516a4 commit 62bb20e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3179
-23204
lines changed

Diff for: .github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node.js
1313
uses: actions/setup-node@v3
1414
with:
15-
node-version: '20'
15+
node-version: '22'
1616
- name: Install dependencies
1717
run: npm ci
1818
- name: Test

Diff for: demo/browser/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"description": "Liquidjs Demo for Browser Usage",
66
"main": "index.html",
77
"scripts": {
8+
"test": "echo not implemented",
89
"start": "http-server -c-1 "
910
},
1011
"author": "harttle <[email protected]>",

Diff for: demo/esm/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"name": "liquidjs-demo-nodejs",
2+
"name": "liquidjs-demo-esm",
33
"description": "Node.js demo for liquidjs",
44
"private": true,
55
"main": "index.mjs",
66
"scripts": {
7+
"test": "./test.sh",
78
"start": "node index.mjs"
89
},
910
"dependencies": {

Diff for: demo/esm/test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -ex
2+
3+
npm start | grep 'LiquidJS Demo'

Diff for: demo/express/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "express-demo",
2+
"name": "liquidjs-demo-express",
33
"version": "1.0.0",
44
"private": true,
55
"description": "Express Demo Using liquidjs",
66
"main": "index.js",
77
"scripts": {
88
"start": "node index.js",
9-
"test": "echo \"Error: no test specified\" && exit 1"
9+
"test": "./test.sh"
1010
},
1111
"author": "harttle",
1212
"license": "MIT",

Diff for: demo/express/test.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set -x
2+
3+
LOG_FILE=$(mktemp)
4+
npm start > $LOG_FILE 2>&1 &
5+
SERVER_PID=$!
6+
while ! grep -q "Express running" "$LOG_FILE"; do
7+
if ! kill -0 $SERVER_PID; then
8+
echo "Server exited unexpectedly."
9+
cat $LOG_FILE
10+
return 1
11+
fi
12+
sleep 1
13+
done
14+
curl http://127.0.0.1:3000 | grep -q 'Welcome to LiquidJS'
15+
RESULT=$?
16+
killall node
17+
rm $LOG_FILE
18+
if [ $RESULT != 0 ]; then
19+
exit 1
20+
fi

Diff for: demo/nodejs/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"main": "index.js",
66
"scripts": {
7+
"test": "./test.sh",
78
"start": "node index.js"
89
},
910
"dependencies": {

Diff for: demo/nodejs/test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -ex
2+
3+
npm start | grep 'NodeJS Demo for LiquidJS'

Diff for: demo/reactjs/README.md

+5-2,506
Large diffs are not rendered by default.

Diff for: demo/reactjs/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
<title>React Demo for LiquidJS</title>
8+
</head>
9+
<body>
10+
<noscript>
11+
You need to enable JavaScript to run this app.
12+
</noscript>
13+
<div id="root"></div>
14+
<script type="module" src="/src/index.tsx"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)