-
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
After Spec API TypeScript Code breaks the config.ts file - [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" #23141
Comments
Right now there doesn't seem to be enough information to reproduce the problem on our end. Unless we receive a reliable reproduction, we'll eventually have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. Please provide a reproducible example of the issue you're encountering. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide. |
Run any test with the above config file or just the module import in config file, super easy to reproduce. |
Hi @GeorgeXCV, I was able to recreate and fix this issue in this repo: cypress-del-ts The ticket for my project was adding I also made some slight changes in comparison to what the guide describes. |
I get this error:
Line 25 starts here:
Also why does Cypress recommend
|
Hi @GeorgeXCV - could you verify the contents of your
In order to use imports in the config file the TS compiler will need to know how to handle module resolution which is provided by these keys |
Strange, I changed my
I am currently using |
@GeorgeXCV , sorry to hear that didn't fix your issue. There must be some other configuration at play here that hasn't been communicated in this issue. Unfortunately, copying config files into the issue here only gives us a partial view that doesn't capture the entirety of your project context. To help us diagnose what's going on it would be very helpful to get a simple reproduction case as a Git repo. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide. |
Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen. |
I have encountered the same issue with 10.3.1 and 10.9.0. It seems to be related to the import itself. 10.9.0 gives a better error output but it doesn't help to solve the issue.
My paths of tsconfig.json seems to get ignored:
|
Can you include your full Also what is I need more information to reproduce the issue. |
I think I have found the issue in my setup. We have changed the build process from CJS to module builds. In our case the build of the package
Typescript takes the first path which can be resolved. More details can be found here, https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping. I have noticed that it works if I don't use the built package and build it on the fly. The complete tsconfig.json:
The resulting package.json from the build looks like the following:
|
I ran into a similar issue yesterday and found a solution (although it may not be applicable to all cases). So, it's not documented anywhere, but looks like this error happens if your |
Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen. |
Hm, seems a bit unusual to close an issue that has a detailed description of a problem that is still open... can't imagine the motivation for closing it. I suppose maybe the Cypress team discussed that it would clean up clutter? But there are more reasons to keep it open:
|
At the very least, this should stay open until the accepted resolutions which are described above (eg. Then the authors / commenters in this issue (@GeorgeXCV, @CSchulz, @iamsellek, @nikolayeasygenerator, myself) should also be asked to comment whether the new release resolves their issue. If they don't respond within a reasonable amount of time (2 weeks?) then closing seems reasonable at that point. |
@karlhorky Sorry, this issue seems to have gotten incorrectly marked and not routed to the correct team and thus looked abandoned. I will reopen and route. |
Thanks, no worries 👍 |
I was at the same point of the issue creator. My config was working before, and after trying to include removal of sucessful test videos, it broke. I repeated many steps of this thread, then I reverted all my work and I only rewrote the function. It worked:
Seems like the problem appears using lodash or del. |
del has a similar issue sindresorhus/del#152 Could be unrelated to Cypress - can you post a minimal reproduction? Lodash should be working fine, I tried this with a ESM only project and did not encounter any issues. I think there is many ways to encounter this issue, some might be an issue in Cypress, some with external modules. |
After I updated my config file using the changes from cypress-io/cypress-documentation#5198, this issue was resolved for me. More specifically, the errors went away when I removed the |
Seems there are many issues that can manifest in this error. If anyone finds one, please post a new issue with a minimal reproduction, and we will take a look. |
@lmiller1990 I don't think that this should be closed. There is a long, detailed discussion between you and me in this issue which still should be investigated more. I hope the Cypress team takes this issue seriously and decides to reopen, for the sake of your community. |
At the very least, this should stay open until the accepted resolutions which are described above (eg. Then the authors / commenters in this issue (@GeorgeXCV, @CSchulz, @iamsellek, @nikolayeasygenerator, myself) should also be asked to comment whether the new release resolves their issue. |
Oh, I'm sorry, I think you are right - I didn't realize this was the issue with the We can track specific progress for |
To follow our original discussion, and give an update since it's been a while since then
|
|
I had the same issue, due to the thanks a lot for digging into it |
I had the same issue after upgrading TypeScript to 5.4.5.
Revealed the underlying issue - it was |
Current behavior
If I use the code from the snippet here for TypeScript it breaks the project:
Even just this line breaks the project:
const del = require('del')
Desired behavior
I can run my tests and the videos are deleted if test passed.
Test code to reproduce
Cypress Version
10.1.0
Other
Current snippet also isn't 100% TypeScript/Eslint friendly because uses
require
instead ofimport
and has unused parameter. Something like this should work right?The text was updated successfully, but these errors were encountered: