Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .github/actions/setup-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Setup and Cache Playwright'
description: 'Installs playwright browsers and caches them.'

inputs:
version:
description: 'The version of playwright'
required: true

outputs:
cache-hit:
description: 'Whether the cache was hit or not'
value: ${{ steps.playwright-cache.outputs.cache-hit }}

runs:
using: 'composite'
steps:
- name: Cache playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
key: playwright-browsers-${{ runner.os }}-${{ inputs.version }}
path: ~/.cache/ms-playwright

- name: Install playwright browsers if they don't exist
shell: bash
run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Install playwright dependencies if binaries exist
shell: bash
run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build libs
run: pnpm run build
- name: Get playwright version
run: echo "PLAYWRIGHT_VERSION=$(pnpm list @playwright/test | grep @playwright/test | awk '{print $2}')" >> $GITHUB_ENV
- name: Setup playwright
uses: ./.github/actions/setup-playwright
with:
version: ${{ env.PLAYWRIGHT_VERSION }}
- name: Tests
run: pnpm run test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"scripts": {
"build": "pnpm --filter @supabase/pg-parser build",
"test": "pnpm --filter @supabase/pg-parser test"
}
},
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}
11 changes: 8 additions & 3 deletions packages/pg-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"wasm-opt": "docker compose run --rm binaryen wasm-opt -Oz --enable-bulk-memory pg-parser.wasm -o pg-parser.min.wasm",
"wasm-objdump": "docker compose run --rm wabt wasm-objdump",
"prepublishOnly": "pnpm build",
"test": "vitest"
"test": "vitest",
"test:unit:node": "vitest --project unit:node",
"test:unit:vercel-edge": "vitest --project unit:vercel-edge",
"test:unit:browser": "vitest --project unit:browser"
},
"files": [
"dist/**/*"
Expand All @@ -34,10 +37,12 @@
"@bjorn3/browser_wasi_shim": "^0.4.1"
},
"devDependencies": {
"@edge-runtime/vm": "^5.0.0",
"@playwright/test": "^1.52.0",
"@total-typescript/tsconfig": "^1.0.4",
"@types/common-tags": "^1.8.4",
"@types/node": "^22.15.3",
"@vitest/browser": "^3.1.1",
"@vitest/browser": "^3.1.3",
"common-tags": "^1.8.2",
"mkdirp": "^3.0.1",
"pg-proto-parser": "^1.24.0",
Expand All @@ -46,6 +51,6 @@
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"vite": "^6.3.2",
"vitest": "^3.1.1"
"vitest": "^3.1.3"
}
}
24 changes: 24 additions & 0 deletions packages/pg-parser/vitest.workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,28 @@ export default defineWorkspace([
include: ['src/**/*.{test,spec}.ts'],
},
},
{
test: {
name: 'unit:vercel-edge',
environment: 'edge-runtime',
include: ['src/**/*.{test,spec}.ts'],
},
},
{
test: {
name: 'unit:browser',
include: ['src/**/*.{test,spec}.ts'],
browser: {
enabled: true,
provider: 'playwright',
headless: true,
screenshotFailures: false,
instances: [
{ browser: 'chromium' },
{ browser: 'firefox' },
{ browser: 'webkit' },
],
},
},
},
]);
40 changes: 35 additions & 5 deletions pnpm-lock.yaml

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