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

replace ComponentName.cy.ts to ComponentName.cy.tsx in component test #24880

Closed
hidaviddong opened this issue Nov 29, 2022 · 3 comments
Closed
Assignees

Comments

@hidaviddong
Copy link

What would you like?

Replace the default providedComponentName.cy.ts with ComponentName.cy.tsx
image

Why is this needed?

Using Next.js + TypeScript , component test default provided spec ComponentName.cy.ts

When we import a component, it will report an TS error by default
image
The solution is to change file ComponentName.cy.ts toComponentName.cy.tsx
image

Other

No response

@mike-plummer
Copy link
Contributor

Hi @DongHY1 , thanks for opening an issue! It sounds like you're proposing that projects that are JSX-friendly include the JSX/TSX extension by default when proposing names for newly-created component spec files, is that correct? I think that would be possible, but we would need to do some brainstorming to ensure we only apply that logic for projects where it makes sense (for example, Angular and Svelte by default don't use JSX).

Our "Create Spec from Component" feature is being expanded to support React in an upcoming release, and that will utilize JSX the way you describe plus automatically add the import and mount statements to the new spec for you. I wonder if this would meet your needs?

@hidaviddong
Copy link
Author

hidaviddong commented Dec 10, 2022

Hi @DongHY1 , thanks for opening an issue! It sounds like you're proposing that projects that are JSX-friendly include the JSX/TSX extension by default when proposing names for newly-created component spec files, is that correct? I think that would be possible, but we would need to do some brainstorming to ensure we only apply that logic for projects where it makes sense (for example, Angular and Svelte by default don't use JSX).

Our "Create Spec from Component" feature is being expanded to support React in an upcoming release, and that will utilize JSX the way you describe plus automatically add the import and mount statements to the new spec for you. I wonder if this would meet your needs?

I'm looking forward to trying it out when it becomes available. It sounds like it will be a great addition to the tool, and I'm sure it will be very useful for creating specs for React components.

@mike-plummer
Copy link
Contributor

This work is being tracked under #24773 , closing this issue as a duplicate of the functionality being delivered there

@mike-plummer mike-plummer closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2022
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

No branches or pull requests

3 participants