-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WIP - TypeScript Support Doc #466
Conversation
jennifer-shehane
commented
Mar 16, 2018
- addresses Typescript Support doc #400
What's the rationale for plugin support being in tooling? |
I guess I thought tooling would be things that are extensions of cypress, but not really specific to the core essential 'run e2e tests' - more specific to your personal workflow and involving 1 other library/third parties code, so:
|
Some of that makes sense... I guess some may have a corresponding Recipe too, which is also fine. So Tooling is like... hey... so you wanna add stuff to Cypress to make it better? Maybe stuff for your IDE, or business processes (cucumber), or maybe how you interface with your own node code... here's a list of things. I'm good with it 👍 |
|
||
In order to get intellisense working, you can try a few approaches: | ||
|
||
## Triple-Slash Directives |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this method is limited to TypeScript. It should work on JavaScript files as well in VSCode, Atom and probably more editors/IDEs. I ask because the section is labeled "TypeScript Support" which JavaScript developers might just skip over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I will have to think about a good place to mention this elsewhere in the docs.
"include": [ | ||
"integration/*.ts", | ||
"support/*.ts", | ||
"../node_modules/cypress" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this JSON block should be:
If you write your tests in TypeScript, you may find it more convenient to add a tsconfig.json
inside your Cypress folder.
{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"],
},
"include": [
"**/*.ts"
]
}
The "types"
will tell the TypeScript compiler to only include type definitions from Cypress. This will address instances where the project also uses @types/chai
or @types/jquery
. Since chai and jQuery are namespaces (globals), incompatible versions will cause the package manager (yarn or npm) nest and include multiple definitions and cause conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg, thank you! I was struggling 😅 I think this has helped finally push it to a shippable state.
- add new config - mention IntelliSense support for plan JavaScript - add links ’TypeScript’ examples - add IntelliSense note to main api index - rearrange ‘tooling’ docs