:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): cover replay-shared changes in frontend jest (#105391)
jake sciottoeb428590dd98
diff --git a/.depot/actions/paths-filter/__tests__/filter.test.ts b/.depot/actions/paths-filter/__tests__/filter.test.tsindex b3ed1079239c..aac9d8e14c47 100644--- a/.depot/actions/paths-filter/__tests__/filter.test.ts+++ b/.depot/actions/paths-filter/__tests__/filter.test.ts@@ -1,3 +1,7 @@+import {readFileSync} from 'node:fs'+import path from 'node:path'++import * as jsyaml from 'js-yaml'import {Filter} from '../src/filter'import {File, ChangeStatus} from '../src/file'@@ -28,6 +32,15 @@ describe('yaml filter parsing tests', () => {})describe('matching tests', () => {+ test('runs frontend consumer tests when replay-shared source changes', () => {+ const workflowYaml = readFileSync(path.join(__dirname, '../../../../.github/workflows/ci-frontend.yml'), 'utf8')+ const workflow = jsyaml.load(workflowYaml) as {jobs: {changes: {steps: {id?: string; with?: {filters?: string}}[]}}}+ const filtersYaml = workflow.jobs.changes.steps.find(step => step.id === 'filter')?.with?.filters+ const files = modified(['common/replay-shared/src/mobile/transformer/transformers.ts'])++ expect(new Filter(filtersYaml).match(files).frontend_code).toEqual(files)+ })+test('matches single inline rule', () => {const yaml = `src: "src/**/*.js"diff --git a/.github/actions/paths-filter/__tests__/filter.test.ts b/.github/actions/paths-filter/__tests__/filter.test.tsindex b3ed1079239c..aac9d8e14c47 100644--- a/.github/actions/paths-filter/__tests__/filter.test.ts+++ b/.github/actions/paths-filter/__tests__/filter.test.ts@@ -1,3 +1,7 @@+import {readFileSync} from 'node:fs'+import path from 'node:path'++import * as jsyaml from 'js-yaml'import {Filter} from '../src/filter'import {File, ChangeStatus} from '../src/file'@@ -28,6 +32,15 @@ describe('yaml filter parsing tests', () => {})describe('matching tests', () => {+ test('runs frontend consumer tests when replay-shared source changes', () => {+ const workflowYaml = readFileSync(path.join(__dirname, '../../../../.github/workflows/ci-frontend.yml'), 'utf8')+ const workflow = jsyaml.load(workflowYaml) as {jobs: {changes: {steps: {id?: string; with?: {filters?: string}}[]}}}+ const filtersYaml = workflow.jobs.changes.steps.find(step => step.id === 'filter')?.with?.filters+ const files = modified(['common/replay-shared/src/mobile/transformer/transformers.ts'])++ expect(new Filter(filtersYaml).match(files).frontend_code).toEqual(files)+ })+test('matches single inline rule', () => {const yaml = `src: "src/**/*.js"diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex f902d31866b0..ec79f490bc62 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -196,6 +196,7 @@ jobs:- 'frontend/**'- 'ee/frontend/**'- 'common/esbuilder/**'+ - 'common/replay-shared/src/**'- 'packages/**'- 'products/**/*.ts'- 'products/**/*.tsx'@@ -367,11 +368,11 @@ jobs:exit 0fi- # Skip when jest config / build / lock files change — these- # invalidate jest's resolver, transformer cache, or test discovery- # in ways `--findRelatedTests` can't see, so no narrowed run can be- # trusted. Pattern matches mirror the frontend_code paths-filter- # in `changes`.+ # Skip selection when jest config / build / lock files change, or+ # when replay-shared source changes: that package sits outside+ # the frontend jest roots, so --findRelatedTests misses its+ # frontend consumers. Pattern matches mirror the frontend_code+ # paths-filter in `changes`.while IFS= read -r f; docase "$f" injest.*.ts|babel.config.js|tsconfig.json|tsconfig.*.json|\@@ -380,6 +381,10 @@ jobs:fall_back config_change "$f"exit 0;;+ common/replay-shared/src/*)+ fall_back unindexed_dependency "$f"+ exit 0+ ;;esacdone < /tmp/changed.txtdiff --git a/frontend/src/scenes/session-recordings/mobile-replay/__snapshots__/parsing.test.ts.snap b/frontend/src/scenes/session-recordings/mobile-replay/__snapshots__/parsing.test.ts.snapindex 9a0ea4cc27c1..14a8d529a0c4 100644--- a/frontend/src/scenes/session-recordings/mobile-replay/__snapshots__/parsing.test.ts.snap+++ b/frontend/src/scenes/session-recordings/mobile-replay/__snapshots__/parsing.test.ts.snap@@ -108,6 +108,7 @@ exports[`snapshot parsing handles normal mobile data 1`] = `"childNodes": [{"attributes": {+ "data-posthog-screenshot": "true","data-rrweb-id": 4324378400,"height": 852,"src": "data:image/jpeg;base64,/9j/4AAQSkZJR",