Skip to content

Commit fb4fcea

Browse files
committed
make jsclient testable
1 parent bf4f71a commit fb4fcea

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

.github/workflows/spa-server-ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- 'client/**'
2828
- 'server/**'
2929
- 'Cargo.lock'
30-
check_js_sdk:
30+
check_js_client:
3131
- 'jsclient/**'
3232
3333
check_server:
@@ -55,6 +55,14 @@ jobs:
5555
needs: changes
5656
if: ${{ needs.changes.outputs.check_js_client == 'true' }}
5757
runs-on: ubuntu-latest
58+
services:
59+
spa-server:
60+
image: ghcr.io/fornetcode/spa-server:latest
61+
ports:
62+
- 9000:9000
63+
- 8080:8080
64+
options: >-
65+
--mount type=bind,source=${{ github.workspace }}/jsclient/test/config.toml,target=/config/config.toml
5866
steps:
5967
- uses: actions/checkout@v4
6068
# Setup .npmrc file to publish to npm
@@ -63,4 +71,6 @@ jobs:
6371
node-version: '20.x'
6472
cache: 'npm'
6573
cache-dependency-path: './jsclient/package-lock.json'
66-
- run: npm ci && npm run build
74+
- run: |
75+
cd ./example/js-app-example && npm ci && npm run build && \
76+
cd ../../jsclient && npm ci && npm run build && npm test

docs/develop/change-log.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Change Log
22

33
### Version 2.4.1
4-
- spa-server: `cors` value bool to array string.
5-
- bump deps version.
4+
- conf: spa-server: `cors` value bool to array string.
5+
- improve: bump deps version.
6+
- ci: jsclient can test auto.
7+
- feat: remove openTelemetry trace.
68

79
### Version 2.4.0
810

jsclient/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
77
"scripts": {
8+
"test": "jest",
89
"build": "tsc"
910
},
1011
"repository": {

jsclient/test/command.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('info', async () => {
1313
})
1414

1515
test('upload', async () => {
16-
const exampleProjectDir = path.resolve(__dirname, '../../example/js-app-example')
16+
const exampleProjectDir = path.resolve(__dirname, '../../example/js-app-example/build')
1717
try {
1818
const result = await runCommand(['upload', path.join(exampleProjectDir, 'build'), LOCAL_HOST])
1919
console.log(result)

jsclient/test/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
file_dir = "./data"
2+
cors = []
3+
[http]
4+
port = 8080
5+
addr = "0.0.0.0"
6+
7+
[admin_config]
8+
port = 9000
9+
addr = "0.0.0.0"

jsclient/test/example.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a.b=1
1+
a.b=2

0 commit comments

Comments
 (0)