Skip to content

Commit

Permalink
Tests and automatic type generation (#134)
Browse files Browse the repository at this point in the history
This PR does two big things:

1) Automatic generation of types. As part of this, additional types
information has been moved across to some of the source `.ts` files
(mainly around http queries).

2) Adds a wide range of tests, in `tests/`.

There's still a load of clean-up to be done, which is what I will be
working on next. In the meantime, probably best to ignore the contents
of `dist/`, which we'll probably stop committing in future.
  • Loading branch information
jawj authored Jan 20, 2025
1 parent da779b2 commit 4a084c6
Show file tree
Hide file tree
Showing 66 changed files with 15,223 additions and 6,569 deletions.
7 changes: 7 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# copy to .env.test and fill in the blanks
VITE_NEON_DB_URL="postgresql:// ..."
VITE_NEON_DB_POOLER_URL="postgresql:// ..."
VITE_WSPROXY="... .workers.dev"
VITE_VERCEL_TOKEN="..."
VITE_CLERK_USER="... @neon.tech"
VITE_CLERK_SECRET_KEY="sk_test_ ..."
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
steps:
# setup
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4

- name: Install package dependencies
run: bun install
run: npm install

# goal
- name: Check TypeScript types
run: bun run check
run: npm run check

- name: Check code formatting
run: bun run format
run: npm run format
41 changes: 36 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,48 @@ on:
branches:
- main

env:
VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }}
VITE_NEON_DB_POOLER_URL: ${{ secrets.VITE_NEON_DB_POOLER_URL }}
VITE_VERCEL_TOKEN: ${{ secrets.VITE_VERCEL_TOKEN }}
VITE_CLERK_SECRET_KEY: ${{ secrets.VITE_CLERK_SECRET_KEY }}
VITE_WSPROXY: ${{ vars.VITE_WSPROXY }}
VITE_CLERK_USER: ${{ vars.VITE_CLERK_USER }}

jobs:
test:
test-node-16:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16

- name: Install package dependencies
run: |
# strip Prisma, whose preinstall script throws on Node versions less than 18.x
sudo apt-get install jq && \
mv package.json package.json.old && \
jq 'del(.devDependencies.prisma, .devDependencies."@prisma/client")' package.json.old > package.json
npm install
# goal
- name: Run CLI-based tests in Node 16 (no native WebSocket or fetch), node environment
run: npm run test:node

test-node-lts:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install package dependencies
run: bun install
run: npm install

# goal
- name: Run tests
run: bun run test
- name: Run all tests in Node LTS
run: npm run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.dev.vars
.env.local
.env.*
!.env.template
node_modules
tmp
.DS_Store
29 changes: 29 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"mainEntryPointFilePath": "dist/dts/export/index.d.ts",
"newlineKind": "lf",
"enumMemberOrder": "preserve",
"bundledPackages": ["subtls"],
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "dist/dts/_extracted.d.ts"
},
"apiReport": {
"enabled": false
},
"docModel": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"extractorMessageReporting": {
"ae-wrong-input-file-type": {
"logLevel": "none"
},
"ae-missing-release-tag": {
"logLevel": "none"
}
}
}
}
Loading

0 comments on commit 4a084c6

Please sign in to comment.