Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

🛠 Fix/typescript support 32 #35

Merged
merged 5 commits into from
Mar 22, 2020
Merged

🛠 Fix/typescript support 32 #35

merged 5 commits into from
Mar 22, 2020

Conversation

MrCube42
Copy link
Contributor

@MrCube42 MrCube42 commented Mar 22, 2020

Fixes #32

Problem

Cypress does not fully support TypeScript out-of-the-box (cypress-io/cypress#1859). Currently Cypress accepts .ts files and the schematic already sets up everything for the IDE (like VSCode) to work. However, TypeScript itself cannot be used during executing because it is not transpiled by default.

Solution

Add TypeScript preprocessor like proposed in Cypress docs to the schematic by default (https://docs.cypress.io/guides/tooling/typescript-support.html#Transpiling-TypeScript-test-files).

Steps taken

Based on the already prepared solution from Gleb @ Cypress (https://github.com/bahmutov/add-typescript-to-cypress):

  • Use simpler version of cypress/tsconfig (@anthonymjones Not really sure whether we actually need the types and target like before. As Gleb himself doesn't add them, I suppose we can just remove them)
  • Transpile TypeScript files by adding a Cypress plugin by default which uses @cypress/webpack-preprocessor (This dependency was already listed by the schematic)
  • Set an explicit type in the default spec.ts to show everyone that TypeScript actually works (not only the .ts ending)
  • Adjust unit tests to now contain 2 more files which are added by the plugin integration

@anthonymjones
Copy link
Contributor

Looks and works great, thank you for your contribution @MrCube42!

@anthonymjones anthonymjones merged commit d9e3fde into briebug:master Mar 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript support
2 participants