Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,48 @@ jobs:
if: always()
run: supabase stop

node-20-integration:
name: Node 20 Integration
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Setup Supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest

- name: Start Supabase
run: supabase start

- name: Install dependencies and build
run: |
npm ci
npm run build

- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq

- name: Download artifact
run: npm run update:test-deps:node-20

- name: Run integration tests
run: |
export SUPABASE_SERVICE_ROLE_KEY="$(supabase status --output json | jq -r '.SERVICE_ROLE_KEY')"
npm run test:integration:node-20

- name: Stop Supabase
if: always()
run: supabase stop

next-integration:
name: Next.js Integration
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
"test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
"test:integration:browser": "deno test --allow-all test/integration.browser.test.ts",
"test:integration:node-20": "cd test/integration/node-20 && npm install && npm run test",
"test:edge-functions": "deno test --allow-all --no-check test/deno/edge-functions-integration.test.ts",
"test:watch": "jest --watch --verbose false --silent false",
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
Expand All @@ -47,14 +48,15 @@
"update:test-deps:expo": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/expo/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/expo && npm install",
"update:test-deps:next": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/next/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/next && npm install --legacy-peer-deps",
"update:test-deps:deno": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cd test/deno && npm install",
"update:test-deps:bun": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/bun && bun install"
"update:test-deps:bun": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/bun && bun install",
"update:test-deps:node-20": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/node-20/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/node-20 && npm install"
},
"dependencies": {
"@supabase/auth-js": "2.71.1",
"@supabase/functions-js": "2.4.5",
"@supabase/node-fetch": "2.6.15",
"@supabase/postgrest-js": "1.19.4",
"@supabase/realtime-js": "2.15.1",
"@supabase/realtime-js": "2.15.2",
"@supabase/storage-js": "^2.10.4"
},
"devDependencies": {
Expand Down
28 changes: 28 additions & 0 deletions test/integration/node-20/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, test, expect, beforeAll } from 'vitest'
import { createClient, REALTIME_CHANNEL_STATES, SupabaseClient } from '@supabase/supabase-js'
import type { RealtimeChannel, WebSocketLikeConstructor } from '@supabase/realtime-js'
import ws from 'ws'

const SUPABASE_URL = 'http://127.0.0.1:54321'
const ANON_KEY =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0'

const supabase: SupabaseClient = createClient(SUPABASE_URL, ANON_KEY, {
realtime: { transport: ws as WebSocketLikeConstructor },
})

describe('realtime connection', () => {
let channel: RealtimeChannel
beforeAll(() => (channel = supabase.channel('realtime:server')))

test('should connect to the server', async () => {
let currentState
channel.subscribe((state) => {
console.log('state', state)
currentState = state
})
await new Promise((resolve) => setTimeout(resolve, 4000))
expect(currentState).toBe('SUBSCRIBED')
expect(channel.state).toBe(REALTIME_CHANNEL_STATES.joined)
})
})
2 changes: 2 additions & 0 deletions test/integration/node-20/mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "20"
26 changes: 26 additions & 0 deletions test/integration/node-20/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "ts-node index.ts",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "vitest run"
},
"version": "1.0.0",
"author": "",
"description": "",
"license": "ISC",
"repository": {
"type": "git",
"url": ""
},
"dependencies": {
"@supabase/supabase-js": "file:supabase-supabase-js-0.0.0-automated.tgz",
"vitest": "^3.2.4",
"ws": "^8.18.3"
},
"devDependencies": {
"typescript": "^5.9.2",
"@types/ws": "^8.18.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main
1 change: 1 addition & 0 deletions test/integration/node-20/supabase/.temp/cli-latest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.34.3
Loading