Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Component test. Type error when extending fixture - ComponentFixtures is not exported and cannot be named #15352

Closed
pashidlos opened this issue Jul 4, 2022 · 4 comments · Fixed by #15583
Assignees

Comments

@pashidlos
Copy link

Context:

  • @playwright/experimental-ct-react: 1.22.2

Code Snippet
https://github.com/pashidlos/pw-component-test-example/blob/import-interface/src/component_tests/Fixture.ts

Describe the bug

Exported variable 'X' has or is using name 'ComponentFixtures' from external module "/node_modules/@playwright/experimental-ct-react/index" but cannot be named.ts(4023)
@aslushnikov
Copy link
Collaborator

@pavelfeldman could you please take a look?

@pavelfeldman
Copy link
Member

@pashidlos I ran:

git clone https://github.com/pashidlos/pw-component-test-example
git checkout import-interface
yarn
yarn test-ct

and the test passed just fine.

@pashidlos
Copy link
Author

@pavelfeldman try running

yarn run tsc

@aslushnikov aslushnikov added v1.25 and removed v1.24 labels Jul 12, 2022
@pavelfeldman
Copy link
Member

Here is what I see:

yarn run v1.22.18
$ /home/pfeldman/tmp/pw-component-test-example/node_modules/.bin/tsc
node_modules/@visual-regression-tracker/agent-playwright/dist/playwrightVisualRegressionTracker.d.ts:2:37 - error TS2307: Cannot find module 'playwright' or its corresponding type declarations.

2 import { Page, ElementHandle } from "playwright";
                                      ~~~~~~~~~~~~

src/component_tests/Fixture.ts:8:14 - error TS4023: Exported variable 'componentTest' has or is using name 'ComponentFixtures' from external module "/home/pfeldman/tmp/pw-component-test-example/node_modules/@playwright/experimental-ct-react/index" but cannot be named.

8 export const componentTest = base.extend<Fixture>({

First issue should be fixed in @visual-regression-tracker/agent-playwright - should say

import { Page, ElementHandle } from "playwright-core";

Second seems to be related to TS's inability to re-export implicit types: microsoft/TypeScript#9944. I'll see if we can export internal type to mitigate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants