Skip to content

Commit 67a6d6d

Browse files
authored
refactor: write tests to also work with deno and bun (#1143)
1 parent d5ffc92 commit 67a6d6d

26 files changed

+1678
-1238
lines changed

.github/workflows/test.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Test
2-
"on":
2+
on:
33
push:
44
branches:
55
- dependabot/npm_and_yarn/**
66
pull_request:
77
types:
88
- opened
99
- synchronize
10+
- reopened
11+
1012
jobs:
1113
test-building:
1214
runs-on: ubuntu-latest
@@ -20,15 +22,15 @@ jobs:
2022
- run: npm run build
2123

2224
test_matrix:
23-
needs:
24-
- test-building
25+
needs: test-building
2526
runs-on: ubuntu-latest
2627
strategy:
2728
matrix:
2829
node_version:
2930
- 18
3031
- 20
3132
- 22
33+
- 24
3234
name: Node ${{ matrix.node_version }}
3335
steps:
3436
- uses: actions/checkout@v4
@@ -38,20 +40,44 @@ jobs:
3840
cache: npm
3941
- run: npm ci
4042
- run: npm test
41-
42-
test:
43+
44+
test-deno:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: denoland/setup-deno@v2
49+
with:
50+
deno-version: v2.x # Run with latest stable Deno.
51+
- run: deno install
52+
- run: deno test --allow-env --allow-read --allow-net --allow-sys --no-check
53+
54+
test-bun:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: oven-sh/setup-bun@v2
59+
- run: bun install
60+
- run: bun test
61+
62+
validate-typescript:
4363
runs-on: ubuntu-latest
44-
needs:
45-
- test-building
46-
- test_matrix
4764
steps:
48-
- run: exit 1
49-
if: ${{ needs.test_matrix.result != 'success' }}
5065
- uses: actions/checkout@v4
5166
- uses: actions/setup-node@v4
5267
with:
5368
cache: npm
5469
node-version: lts/*
5570
- run: npm ci
5671
- run: npm run validate:ts
72+
73+
test:
74+
runs-on: ubuntu-latest
75+
needs:
76+
- test-bun
77+
- test_matrix
78+
- test-deno
79+
- validate-typescript
80+
steps:
81+
- run: exit 1
82+
if: ${{ needs.test_matrix.result != 'success' || needs.test-bun.result != 'success' || needs.test-deno.result != 'success' }}
5783
if: ${{ always() }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.nyc_output
22
coverage
33
node_modules
4+
deno.lock
5+
bun.lock
46

57
# Build output folder
68
pkg/

0 commit comments

Comments
 (0)