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

chore(@cypress/vue): fix type testing script #30173

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

mrazauskas
Copy link
Contributor

Additional details

Mentioned I was mentioning in #30081 (comment), it seems like type testing script does not work as intended because of a typo in npm/vue/test-tsd/tsconfig.tsd.json file.

The repo is huge, so it might be I misunderstood something. So for the beginning I would like to open this minimal PR and to see what you and CI thinks.

Steps to reproduce

"tsd": "yarn build && yarn tsc -p test-tsd/tsconfig.tsd.json",

Just add --listFilesOnly to the command and you will see a list of .d.ts files, but none of the files within the npm/vue/test-tsd directory.

How has the user experience changed?

na

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Sep 3, 2024

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

Comment on lines +4 to +5
"noEmit": true,
"skipLibCheck": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified compilerOptions leaving only what is useful. (E.g. experimentalDecorators does not make sense in this context.)

Comment on lines +7 to +10
"exclude": [],
"include": [
"**/*"
]
Copy link
Contributor Author

@mrazauskas mrazauskas Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While selecting entry files, tsc processes includes first. The **/* pattern will select all .ts files in the project directory. It does not select .js, .d.ts or .vue extensions. So the select entry points are: mount-test.ts and test.ts.

Hence there is no need to exclude anything. "exclude": [] simply overwrites the excludes of parent tsconfig.json.

@@ -0,0 +1,5 @@
declare module '*.vue' {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the errors shows, tsc does not know how to deal with .vue files: "Cannot find module './Slots.vue' or its corresponding type declarations." This shim makes it all work as expected.

"tsd": "yarn build && yarn tsc -p test-tsd/tsconfig.tsd.json",
"tsd": "yarn build && yarn tsc -p test-tsd/tsconfig.json",
Copy link
Contributor Author

@mrazauskas mrazauskas Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming tsconfig.json makes sure code editors and tsc pick up the same config. Otherwise tsc would pass, but one would still see the error in the editor.

@jennifer-shehane
Copy link
Member

@mrazauskas I'll run the CI tests.

@jennifer-shehane jennifer-shehane removed the request for review from AtofStryker September 5, 2024 19:32
@jennifer-shehane jennifer-shehane merged commit bccd15b into cypress-io:develop Sep 5, 2024
68 checks passed
@mrazauskas mrazauskas deleted the fix-test-tsd branch September 5, 2024 19:33
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 this pull request may close these issues.

6 participants