Can't use cypress alongside with Jest with multiple tsconfig.json files. #31085
Unanswered
StreetCube
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Main issue
Mainly I want to apologize for the very long post but I wanted to include all of the information availaible for me so maybe you can help me better.
I researched every source every stackoverflow page I could find, and maybe I'm at fault here but I can't seem to solve it after 2 days so I'm a bit desperate, I'm hoping you can help me.
We've made a decision that we're going to use Jest alongside with Cypress with angular. Cypress for e2e and UI testing, Jest for unit tests. As I tried to setup cypress's component testing I found that this messes up the typing of the jest .spec.ts files. As advised I excluded the cypress files from my main tsconfig.json (Files are going to be included at the end of this discussion).
This solved the problem for jest the errors went away, after that I created another tsconfig.json in the cypress folder as advised (I've tried many variations what to and what not to include see down where I included my tsconfig files).
This solved the typing issue in my IDE it seemed like everything is fine, BUT when I start cypress now it bombards me with warnings like:
for ALL of my typescript files, also it creates errors for all my tests and component.ts if I want to start them:
They are already included and were included in many ways. I've tried to directly tell in the
files
option as well what to use, but that also didn't work. Based on these it seems like it's not using its specified tsconfig file? I have no clue and I haven't seen anything in the docs that explains this, and I haven't seen anyone complaining about this either, so I feel like I'm missing something here (obviously).I've also tried to mess with the
cypress.config.ts
to tell a specific tsconfig file it should use inbuildOptions
. However this was some very specific case I found in some forums not entirely related to my issue so I'm fairly certain this is not going to be the solution.I start to feel like this is not library specific, and maybe I'm just misunderstanding something regarding the tsconfig files and how do they work, but anyways I hope you can help me out a bit.
FILES
main tsconfig.json
Note that this file is extended by two different tsconfigs already:
tsconfig.app.json
andtsconfig.spec.json
here are theyapp.json
spec.json
And here's my new tsconfig I've tried to use, this had many variations, included many things so this is not the only thing I've tried. This is currently copied from the main cypress documentation but I try to order some stuff I kinda remember trying:
Many other things were tried but I can't even remember them cause they didn't work.
cypress tsconfig.json
cypress.config.ts
Beta Was this translation helpful? Give feedback.
All reactions