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

WIP - TypeScript Support Doc #466

Merged
merged 6 commits into from
Mar 21, 2018
Merged

WIP - TypeScript Support Doc #466

merged 6 commits into from
Mar 21, 2018

Conversation

jennifer-shehane
Copy link
Member

@brian-mann
Copy link
Member

What's the rationale for plugin support being in tooling?

@jennifer-shehane
Copy link
Member Author

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:

  • using cucumber with cypress
  • how to get cypress working in my IDE
  • how to have my babel config
  • set up a different mocha reporter
  • typescript intellisense

@brian-mann
Copy link
Member

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
Copy link
Contributor

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.

Copy link
Member Author

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"
Copy link
Contributor

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.

Copy link
Member Author

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
@jennifer-shehane jennifer-shehane merged commit 15b0de6 into develop Mar 21, 2018
@jennifer-shehane jennifer-shehane deleted the issue-400 branch April 13, 2018 17:53
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.

3 participants