question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't have tsconfig.json in Cypress-cucumber-typescript for React

See original GitHub issue

I have a project with React, Cypress-cucumber-preprocessor, Typescript(output in es5).
When I run the cypress with official example or another example, it has those problems:

TypeScript error: cypress/integration/Google/google.ts(5,3): Error TS2304: Cannot find name 'cy'.

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'

If I delete tsconfig.json in React parent folder, it fixed the Syntax Error but it still has TypeScript error.
So it seems like tsconfig.json make this problem, but the project should not without tsconfig.json.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ashishpCACTUScommented, Apr 23, 2021

We ran into similar issues and fixed it by using a webpack configuration.

CSchulz - Can you please explain what webpack configuration you used. I have same issue when using it with an Angular solution

1reaction
ghostcommented, Feb 4, 2020

Hello, @WeihsuPeach. Do you have some line like "types": ["cypress"] in your tsconfig.json file?

I think that this problem is related to the fact that tsify is using the project’s root tsconfig.json to process your code. You can add types declaration to the root file. On the other hand, you can pass another tsconfig.json file to the tsify.

options.browserifyOptions.plugin.unshift(['tsify', { project: tsConfigPath }]);

I’m not sure whether this approach will work but it’s worth trying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't have tsconfig.json in Cypress-cucumber-typescript for ...
I modified the tsconfig.json file from my project's root folder to ignore the cypress folder. Try this too to test, here it worked....
Read more >
Can't have tsconfig.json in Cypress-cucumber-typescript for ...
I have a project with React, Cypress-cucumber-preprocessor, Typescript(output in es5). When I run the cypress with official example or ...
Read more >
TypeScript - Cypress Documentation
Configure tsconfig.json · Open the command palette (Mac: cmd+shift+p , Windows: ctrl+shift+p ) · Type "restart ts" and select the "TypeScript: Restart TS...
Read more >
Use TypeScript With Cypress - Gleb Bahmutov
If we try to use ES6 features in our specs, VSCode will show an error, and Cypress test will not be transpiled. ......
Read more >
Migrate a Cypress Cucumber Project To Use TypeScript
Firstly, we need to install TypeScript into the project: npm install --save-dev typescript. The next step is to add the tsconfig.json file ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found