Skip to content

Commit 17e4681

Browse files
authored
misc: add tests (#27)
* misc: add tests * chore: github actions * chore: fix tests
1 parent a96b1f8 commit 17e4681

15 files changed

+5203
-499
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Proxy Server CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [20.x, 22.x, 24.x, 25.x]
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: Run tests
27+
run: npm test -- --ci
28+
29+
- name: Upload test results (optional)
30+
if: failure()
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: jest-results-${{ matrix.node-version }}
34+
path: jest-results.json
35+
if-no-files-found: ignore
36+

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,3 @@ With that, requests with path prefix `/api_v1` will be streamed to client 1, req
133133
## Related
134134

135135
A introduce article: [Building a HTTP Tunnel with WebSocket and Node.JS](https://medium.com/@embbnux/building-a-http-tunnel-with-websocket-and-node-js-98068b0225d3?source=friends_link&sk=985d90ec9f512928b34ed38b7ddcb378)
136-
137-
## TODO
138-
139-
- [ ] Add tests

jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('jest').Config} */
2+
module.exports = {
3+
testEnvironment: 'node',
4+
testMatch: ['**/tests/**/*.test.js'],
5+
verbose: true,
6+
testTimeout: 15000,
7+
maxWorkers: 1,
8+
globalTeardown: '<rootDir>/tests/globalTeardown.js',
9+
};

0 commit comments

Comments
 (0)