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
Can't run Typescript tests in Cypress when I have @cypress/webpack-batteries-included-preprocessor enabled #15767
Comments
I managed to get a simple repo with example:
|
Have you tried the solution from #7503? |
@hkarambizi If you mean that I should add |
To enable TypeScript support, you'll need to provide the path to your typescript dependency: const options = webpackPreprocessor.defaultOptions
options.webpackOptions.module.rules.push({
parser: { amd: false },
})
options.typescript = require.resolve('typescript')
on('file:preprocessor', webpackPreprocessor(options)) I realize this isn't documented, so I'll update the README for @cypress/webpack-batteries-included-preprocessor to include that. |
Trying this out on the repro, I found there's a bug in the batteries-included preprocessor that prevents TypeScript support from working when passing in the default options, so what I posted in the above comment won't work. I'll work on a fix and publish a new version of @cypress/webpack-batteries-included-preprocessor. |
Internal Jira issue: TR-763 |
The code for this is done in cypress-io/cypress#15991, but has yet to be released. |
@cypress/webpack-batteries-included-preprocessor@ Upgrading to |
That actually worked, thanks you 🙇♂️ |
Current behavior
Because of this issue we have to use
@cypress/webpack-batteries-included-preprocessor enabled
in our setup. This looks like this:// cypress/plugins/
We have 2
tsconfig.json
files in the project.If we don't set
tsconfig.json
in the root folder, then we get :Root
tsconfig.json
looks like this :Cypress tsconfig.json looks like this:
// cypress/tsconfig.json
If we have webpack preprocessor enabled, then at the run of typescript spec we get this error:
But js specs that use our generated API client work just fine.
If will disable preprocessing, then typescript spec runs just fine, but specs with generated API client will fail just like described in issue
Desired behavior
We would love convert our specs into typescript and use our generated client along with it.
Test code to reproduce
I will try to create some small demo project, but meanwhile wanted to ask if you know where at least to look for a problem ? I couldn't find anywhere in the google this kind of error.
Versions
Cypress 6.8.0
Mac OS
Chrome 89
The text was updated successfully, but these errors were encountered: