-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Upgrade to cypress 10 for typescript project broken (from 9.6) #22071
Comments
I'm also still getting upgrade errors on 10.0.2. I had to remove the plugin file property from my cypress.json in order for the migrator to start up. After migration, Cypress refuses to start, saying:
|
Thanks, I am looking into this now. |
It's happening for me with Node 18 on Linux. |
Edit: see this comment, I think this entire error message was a red herring. Initially, what seemed to be happening is we hit this line - On closer inspection, this makes no sense in the first place. The entire logic for loading the config is here. Basically:
In your case, we should be just doing (1) since you are using TS - we can just use your local What's actually happening, outlined here, is you've got a Removing the unused |
As part of this I found another potential issue: we are trying to use |
@josh803316 I found I could just do You actually said this here I'm sorry I missed it. Clearly What is this file supposed to be? Plugins go in Either way, this also explains how you ran into I think this should solve your problem? |
@spiffytech can you share a minimal repo, or at least some basic info about your project? Although you hit the same problem, it might be due to a different reason. |
It's happening for me with Node 18 on MacOs. i don't have a |
@maksim-romanov Hi, thanks for chiming in. Can you provide a minimal repository with the bug? Repo would be ideal - just delete anything that isn't directly related to Cypress. Or if you cannot, your |
Here you go: https://github.com/spiffytech/cypress-22071-repro |
Confirmed that removing the cypress/index.ts file resolved the issue for me. |
@lmiller1990 Thanks, that fixed the issue for me! I still can't use import statements in the plugin file but not sure if I'm supposed to be able to or not. Thanks so much for your help! I'll close down the sample repo if you are ok with it. |
#22096 also exhibits this error but isn't fixed by the |
turns out that the last commit upgrading to cy10 wasn't enough, there were file changes instructed by the launcher ...and also i'm now getting the bug at cypress-io/cypress#22071. 'thanks' to that bug i cant test if these files changes are sufficient, so once that bug is resolved i'll push the requisite commit as/if necessary
If your pluginsFile is As an aside, now that @brianjenkins94 thanks for the detailed bug report in #22096. I'm going to close this issue since the original reporter's bug is solved, and continue the triage and resolution to your bug in the issue you reported. |
What is the fix for this? |
Cypress 10.1.0+ |
@brianjenkins94 (node:4976) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time Error: Cannot find module 'typescript' |
Install typescript in your project, not globally. It's a dependency of your project, so you should install it there (and add it to your Unrelated and somewhat embarrassingly there is an issue with windows + usernames containing a space, which is getting fixed right now: #22297. The reason I mention this is the screenshot above this post shows a username with a space, which might be problem (which is unrelated to the typescript problem discussed here - in general, if you are hitting missing module typescript, you need to make sure it's installed locally). |
It was working fine last week for me and I got that error now... Turns out that I forgot to run |
Why is this closed? I'm still experiencing in 10.3.0 after a fresh installation of node and cypress. |
@actionJacksonfv I fixed this by deleting my existing cypress.config.ts, restarting cypress and letting it generate new config files. |
Are you using a global TypeScript? To answer your original question - it's closed since this issue was resolved, at least for some people (such as the original poster). It's possible the issue is still manifesting based on some other combination of dependencies, projects, etc. If you are still running into this, can you provide a reproduction or explain how I can reproduce it, so I can take a look? Thanks! |
Using
with PnP yarn config for package manager on a fresh VueJS 3 project I have the same error
|
I recreated it, thanks @ZiperRom1. It is a different issue that manifests the same error. I reproduced it, created a minimal reproduction repo, and created a new issue to track this: #22747 |
In case this can help anyone else, I was able to resolve the Unknown file extension ".ts" invalid config error, by making a change to my I changed this:
... to this:
|
Seeing the very same issue. Changing baseUrl to one level less "solves" the problem... |
This happened to me on NVM lts/gallium - no error on stable. |
One more datapoint here: I actually found this thread because I was experiencing the Unknown file extension ".ts" issue only in a docker container and only in CI (Github actions in this case). Everything was working fine on my local environment. My issue actually had very little to do with Cypress and more to do with how ts-node works. In CI, I was running a fairly vanilla docker compose configuration that I assumed would be sufficient to run my typescript tests. It turns out, however, that the Cypress images do not have Typescript installed and it is up to the developer to expose typescript to the cypress container. Once I realized that I was getting the Unknown file extension ".ts" because ts-node couldn't resolve typescript, the fix was fairly straight forward. In my case, I added an extra layer to the Cypress image that installed typescript. Another possible fix could be to run npm i and mounting that directory into Cypress. I didn't run into this issue locally because I had all of my dependencies already installed when I mounted by directory. |
I was facing the same issue and resolved it by removing the |
🤔 You should be able to keep |
While trying to create a reproduction repo, I found that this rule |
Current behavior
As outlined in this issue that was closed prematurely:
#21997
cc @lmiller1990
When I upgrade our existing typescript project it fails with various typescript errors (see the issue listed above). I have created a sample repo that reproduces the issues.
Desired behavior
Smooth upgrade and conversion of support scripts, plugins and specs.
Test code to reproduce
https://github.com/sketchy/cypress10-upgrade-issue
Simply close the repo, update Cypress to 10, follow the upgrade UI process and see the errors.
Cypress Version
10.0.2
Other
Sample repro to reproduce: https://github.com/sketchy/cypress10-upgrade-issue
The text was updated successfully, but these errors were encountered: