[Bug]: Component fails to render in test when importing/using a variable from the same file as the component.
Version
1.41.2
Steps to reproduce
- Download the attached minimal reproduction zip file.
- Install dependencies with
pnpm install. - Run the tests with
pnpm test(should pass). - Uncomment the
console.log(links);line in the test. - Run the tests again.
Expected behavior
When component testing, we should be able to import & use a variable from the same file as the component currently under test.
Actual behavior
The component fails to render in test when importing/using a variable from the same file as the component.
Additional context
No response
Environment
System:
OS: macOS 14.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.21 GB / 16.00 GB
Binaries:
Node: 18.18.2 - ~/.asdf/installs/nodejs/18.18.2/bin/node
npm: 10.2.5 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 8.15.2 - /opt/homebrew/bin/pnpm
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
@playwright/experimental-ct-react: 1.41.2 => 1.41.2
I can reproduce, great repro, thanks! We'll look at it.
@mxschmitt do you got any progress ?? I want to solve so may be we can work together, How is it?
I've also noticed that sometimes attempting to import a variable from the same file as the component under test will cause the test file itself to disappear completely from the Playwright UI.
I haven't been able to create a minimal reproduction of this to add to the bug, but it's likely related to the original issue.
This doesn't appear to be an issue when importing types or interfaces used as props passed to the component.