-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add documentation on typescript (+webpack) support #19
Comments
@bahmutov suggestions? |
It would be great to have some documentation on this as I was unsuccessful getting coverage with typescript. |
Note that your documentation page: suggests: Additional information We have published a utility npm module, add-typescript-to-cypress, that sets TypeScript test transpilation for you with a single command. |
I am also currently struggling with this. My code is instrumented and there is an out.json being generated in .nyc_output but the coverage report is a blank table as described above. I have tried the OPs suggestion to no avail. Documentation on how this is supposed to work with .ts and webpack would be excellent, as I am currently floundering. |
I was having the same issue. After some investigation, I got it working by installing also
Then in my // You want ONLY do this when building the app to be run by Cypress...
// A good approach is to control it through an environment variable:
// `if (process.env.CYPRESS_CODE_COVERAGE) plugins.push('istambul')`
plugins.push('istambul') and on my "nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"all": true
}, ( cc. @SatorSquare ) |
@jennifer-shehane I'm happy to open a PR adding documentation on how to get it working with TS 👍🏻 |
excellent @lluia this is good stuff, and I would love to have a small example repo we could clone and add it to the list here https://github.com/cypress-io/code-coverage#examples |
@bahmutov I believe setting a codesandbox using |
Thank you @lluia I will refer others to your repo! |
How would this work in create-react-app? I did overwrite the webpack config to add istanbul as a plugin. But it seems like that doesn't work. Any ideas on it? EDIT: The following seems to work, I used a plugin called
|
right, @maximgeerinck - without ejecting you would need to somehow get your settings into webpack config |
🎉 This issue has been resolved in version 1.6.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
My project is typescript + webpack based and I ran into some dead ends during setup because of that. Especially in the report generation part,
nyc
would always render an empty table even though the coverage file was there.In the end I got the project running by using
@istanbuljs/nyc-config-typescript
and adding the suggested.nycrc
file suggested in their documentation.Hope it helps someone.
The text was updated successfully, but these errors were encountered: