diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cca2f46c4..8e6277caa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,26 +20,25 @@ on: jobs: test: - name: Test / OS ${{ matrix.os }} / Node ${{ matrix.node }} + name: Unit + Type Check / Node.js ${{ matrix.node }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest] node: ['20'] - runs-on: ${{ matrix.os }} - steps: - uses: actions/checkout@v4 - - - name: Set up Node - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - - name: Run tests - run: | - npm clean-install - npm run test:coverage + - run: npm clean-install + + - name: Type Check + run: npm run test:types + + - name: Run Unit Tests + Coverage + run: npm run test:coverage - name: Upload coverage results to Coveralls uses: coverallsapp/github-action@master @@ -47,64 +46,91 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./test/coverage/lcov.info - integration: - name: Integration / OS ${{ matrix.os }} / Node ${{ matrix.node }} / Deno ${{ matrix.deno }} + deno-tests: + name: Deno Tests / ${{ matrix.deno }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest] - node: ['20'] deno: ['1.x', '2.x'] - - runs-on: ${{ matrix.os }} - steps: - uses: actions/checkout@v4 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - uses: denoland/setup-deno@v2 with: deno-version: ${{ matrix.deno }} - - - name: Setup Supabase - uses: supabase/setup-cli@v1 + - uses: supabase/setup-cli@v1 with: version: latest - name: Start Supabase - run: | - supabase start + run: supabase start - - name: Build + - name: Run Deno Tests run: | npm clean-install npm run build - npm pack + cd test/deno + npm install + npm test || npm test - - name: Run integration tests + - name: Run integration and browser tests on Deno 2.x only + if: ${{ matrix.deno == '2.x' }} run: | npm run test:integration || npm run test:integration + npm run test:integration:browser + + - name: Stop Supabase + run: supabase stop + + node-integration: + name: Node Integration + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: supabase/setup-cli@v1 + with: + version: latest - - name: Run browser integration tests + - name: Start Supabase + run: supabase start + + - name: Run integration tests run: | - npm run test:integration:browser + npm clean-install + npm run build + npm run test:integration || npm run test:integration + + - name: Stop Supabase + run: supabase stop + + expo-tests: + name: Expo Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: supabase/setup-cli@v1 + with: + version: latest - - name: Run Deno tests + - name: Start Supabase run: | - cd test/deno - npm test || npm test + supabase start - - name: Run expo compatibility tests + - name: Build and test expo run: | + npm clean-install + npm run build + PKG=$(npm pack) + echo "Packed: $PKG" cd examples/expo-app + npm install "../../$PKG" npm install - # make sure we're using the version that was just packed above - npm update @supabase/supabase-js - npm run test || npm run test + npm test || npm test - name: Stop Supabase - run: | - supabase stop + run: supabase stop diff --git a/examples/expo-app/jest.setup.js b/examples/expo-app/jest.setup.js new file mode 100644 index 000000000..b387583da --- /dev/null +++ b/examples/expo-app/jest.setup.js @@ -0,0 +1 @@ +global.WebSocket = require('ws') diff --git a/examples/expo-app/package-lock.json b/examples/expo-app/package-lock.json index 8ef6f2e7f..1b948b11f 100644 --- a/examples/expo-app/package-lock.json +++ b/examples/expo-app/package-lock.json @@ -45,7 +45,8 @@ "eslint-config-expo": "~9.2.0", "jest": "~29.7.0", "jest-expo": "~53.0.5", - "typescript": "~5.8.3" + "typescript": "~5.8.3", + "ws": "^8.18.2" } }, "node_modules/@0no-co/graphql.web": { @@ -3424,9 +3425,9 @@ } }, "node_modules/@supabase/auth-js": { - "version": "2.69.1", - "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.69.1.tgz", - "integrity": "sha512-FILtt5WjCNzmReeRLq5wRs3iShwmnWgBvxHfqapC/VoljJl+W8hDAyFmf1NVw3zH+ZjZ05AKxiKxVeb0HNWRMQ==", + "version": "2.70.0", + "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.70.0.tgz", + "integrity": "sha512-BaAK/tOAZFJtzF1sE3gJ2FwTjLf4ky3PSvcvLGEgEmO4BSBkwWKu8l67rLLIBZPDnCyV7Owk2uPyKHa0kj5QGg==", "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" @@ -3463,9 +3464,9 @@ } }, "node_modules/@supabase/realtime-js": { - "version": "2.11.10-next.1", - "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.11.10-next.1.tgz", - "integrity": "sha512-9ZLY20Ko39Hv9EdHBvBCAlAcaLvin/xRzuUSgB2tTlKBef+j2RXajYVyg9JoI+82CV1MqmXTY6Oc9wNcQQFbYQ==", + "version": "2.11.10", + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.11.10.tgz", + "integrity": "sha512-SJKVa7EejnuyfImrbzx+HaD9i6T784khuw1zP+MBD7BmJYChegGxYigPzkKX8CK8nGuDntmeSD3fvriaH0EGZA==", "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.13", @@ -3486,14 +3487,14 @@ "node_modules/@supabase/supabase-js": { "version": "0.0.0-automated", "resolved": "file:../../supabase-supabase-js-0.0.0-automated.tgz", - "integrity": "sha512-sx8D+m/7MKxbwPPHJZQHxiNf24aK1KVLnboBdqywka4x/vIdqcWqSj3JZj4Nyi82uNMvCzamvr+z/mESlei8EQ==", + "integrity": "sha512-YB02Z/CX6aGSqjgplAnVngyAeYWuMrm2E+DGRRNza0ISmQ4lciYb0pLwpLOgyfU0yJfjkowethcjxb2oNEa2CQ==", "license": "MIT", "dependencies": { - "@supabase/auth-js": "2.69.1", + "@supabase/auth-js": "2.70.0", "@supabase/functions-js": "2.4.4", "@supabase/node-fetch": "2.6.15", "@supabase/postgrest-js": "1.19.4", - "@supabase/realtime-js": "2.11.10-next.1", + "@supabase/realtime-js": "2.11.10", "@supabase/storage-js": "2.7.1" } }, diff --git a/examples/expo-app/package.json b/examples/expo-app/package.json index 866c6ffa7..96f4925c4 100644 --- a/examples/expo-app/package.json +++ b/examples/expo-app/package.json @@ -42,6 +42,7 @@ }, "devDependencies": { "@babel/core": "^7.25.2", + "@testing-library/react-native": "^13.2.0", "@types/jest": "^29.5.14", "@types/react": "~19.1.0", "eslint": "^9.25.0", @@ -49,10 +50,13 @@ "jest": "~29.7.0", "jest-expo": "~53.0.5", "typescript": "~5.8.3", - "@testing-library/react-native": "^13.2.0" + "ws": "^8.18.2" }, "private": true, "jest": { - "preset": "jest-expo" + "preset": "jest-expo", + "setupFiles": [ + "./jest.setup.js" + ] } }