-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Version
1.54.2
Steps to reproduce
- clone https://github.com/shairez/playwright-ct-crash-stale-cache-repro
- Run
pnpm install
- Run
pnpm test-ct
to run the component tests. - Delete the
Child.test.tsx
andChild.tsx
files. - Run
pnpm test-ct
to run the tests again. - see the error.
Expected behavior
When test and component files are deleted, their cached component references should be automatically filtered out, and the remaining tests should run successfully without manual cache clearing.
Actual behavior
When using Playwright component testing, deleting test files and their associated components causes subsequent test runs to fail with "cannot find component" errors, even though the deleted components are no longer referenced by any existing tests.
This forces developers to manually run npx playwright clear-cache
or clear the Playwright cache directory (playwright/.cache/
) when components are deleted... which is no fun.
Additional context
In packages/playwright-ct-core/src/vitePlugin.ts
, the checkNewComponents
function blindly adds all old cached components back to the component registry without verifying that their source test files still exist.
I created a PR with the fix here #37069
Environment
System:
OS: Linux 6.14 Ubuntu 25.04 25.04 (Plucky Puffin)
CPU: (32) x64 AMD Ryzen 9 9950X 16-Core Processor
Memory: 23.53 GB / 59.47 GB
Container: Yes
Binaries:
Node: 22.14.0 - ~/.volta/tools/image/node/22.14.0/bin/node
Yarn: 4.7.0 - ~/.volta/tools/image/yarn/4.7.0/bin/yarn
npm: 10.9.2 - ~/.volta/tools/image/node/22.14.0/bin/npm
pnpm: 10.6.3 - ~/.volta/bin/pnpm
Languages:
Bash: 5.2.37 - /usr/bin/bash
npmPackages:
@playwright/experimental-ct-react: ^1.54.2 => 1.55.0-next