Skip to content

chore: migrate unit tests from Jest to Vitest #9565

chore: migrate unit tests from Jest to Vitest

chore: migrate unit tests from Jest to Vitest #9565

Workflow file for this run

name: Playwright Integration Tests
on: [pull_request]
env:
POSTHOG_API_HOST: https://us.i.posthog.com
POSTHOG_PROJECT_ID: 11213
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
affected:
uses: ./.github/workflows/check-affected.yml
with:
package-name: posthog-js
additional-paths: |
packages/browser/
packages/react/
.github/workflows/integration.yml
.github/workflows/check-affected.yml
.github/actions/is-affected/action.yaml
.github/actions/setup/action.yaml
browsers:
name: Test on ${{ matrix.tests.name }}
needs: affected
runs-on: ubuntu-22.04
container:
# Keep this version in sync with packages/browser's @playwright/test dependency.
image: mcr.microsoft.com/playwright:v1.52.0-noble@sha256:a021500a801bab0611049217ffad6b9697d827205c15babb86a53bc1a61c02d5
env:
HOME: /root
POSTHOG_PROJECT_API_KEY: "${{ secrets.POSTHOG_PROJECT_API_KEY }}"
POSTHOG_PERSONAL_API_KEY: "${{ secrets.POSTHOG_PERSONAL_API_KEY }}"
strategy:
fail-fast: false
matrix:
tests:
- name: Chromium
projects: "--project chromium --project chromium-es5"
browser: "chromium"
- name: Firefox
projects: "--project firefox"
browser: "firefox"
- name: Safari
projects: "--project webkit"
browser: "webkit"
steps:
- name: Skip integration tests
if: ${{ github.event.pull_request.head.repo.full_name != github.repository || needs.affected.outputs.is-affected != 'true' }}
run: echo "Skipping ${{ matrix.tests.name }} integration tests because the browser package is unaffected or required secrets are unavailable for fork PRs."
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && needs.affected.outputs.is-affected == 'true' }}
- uses: ./.github/actions/setup
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && needs.affected.outputs.is-affected == 'true' }}
with:
build: false
- name: Build packages
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && needs.affected.outputs.is-affected == 'true' }}
run: pnpm build
- name: Run ${{ matrix.tests.name }} test
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && needs.affected.outputs.is-affected == 'true' }}
timeout-minutes: 30
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
RUN_ID: ${{ github.run_id }}
BROWSER: ${{ matrix.tests.browser }}
run: pnpm exec playwright test --config playwright.config.integration.ts ${{ matrix.tests.projects }}
working-directory: packages/browser