Skip to content
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

Testcafe typescript fails with @babel/types/lib/index.d.ts error #5807

Closed
oreporan opened this issue Dec 16, 2020 · 17 comments
Closed

Testcafe typescript fails with @babel/types/lib/index.d.ts error #5807

oreporan opened this issue Dec 16, 2020 · 17 comments
Labels
STATE: Need clarification An issue lacks information for further research.

Comments

@oreporan
Copy link

oreporan commented Dec 16, 2020

What is your Test Scenario?

Upgraded react storybook to latest, which caused updates to @babel
Since then, testcafe fails on compilation of typescript

What is the Current behavior?

Running:

testcafe --skip-js-errors --selector-timeout 30000 --assertion-timeout 30000 --quarantine-mode chrome ./tests/behaviour/web

Results in :

ERROR Cannot prepare tests due to an error.

Error: TypeScript compilation failed.
/Users/xxx/node_modules/@babel/types/lib/index.d.ts (1450, 50): '{' or ';' expected.
/Users/xxx/node_modules/@babel/types/lib/index.d.ts (1450, 55): ';' expected.
/Users/xxx/node_modules/@babel/types/lib/index.d.ts (1450, 58): ';' expected.
/Users/xxx/node_modules/@babel/types/lib/index.d.ts (1452, 104): '{' or ';' expected.
....

What is the Expected behavior?

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
Your complete test code (or attach your test files):
 
Your complete configuration file (if any):

Your complete test report:

Screenshots:

Steps to Reproduce:

Create a repo with storybook versions:

 "@storybook/addon-info": "5.3.21",
        "@storybook/addon-knobs": "6.1.11",
        "@storybook/addon-notes": "5.3.21",
        "@storybook/addon-options": "5.3.21",
        "@storybook/react": "6.1.11",
        "@types/storybook__react": "4.0.2",
        "testcafe": "^1.10.0",

Try to run testcafe using:

testcafe  chrome 

Your Environment details:

  • testcafe version: 1.10.0
  • node.js version: v12.14.0
  • command-line arguments: testcafe
  • browser name and version: chrome
  • platform and version:
  • other:
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 16, 2020
@hanh45
Copy link

hanh45 commented Dec 17, 2020

I play with this bug in 1 day.
I fixed as:
Add "@babel/types": "7.6.1" to devDependencies in package.json
Delete node-module and package-lock.json
Rebuild

@AlexKamaev
Copy link
Contributor

@oreporan
I couldn't reproduce the issue. I performed the following steps:

  • created a new project using the npm init command;
  • added all dependencies you described in the Steps to reproduce section;
  • ran the testcafe chrome test.ts command

Everything worked as expected in this case.
Try to follow these steps to reproduce the issue.
If the issue persists, delete the node_modules folder and the package-lock.json file. After that, please run npm install and try again.
If it does not help, please share an example so we can reproduce the issue on our side.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 17, 2020
@AlexKamaev AlexKamaev added the STATE: Need clarification An issue lacks information for further research. label Dec 17, 2020
@sawo
Copy link

sawo commented Dec 17, 2020

My understanding is that the babel/types/lib/index.d.ts file contains some too long lines.
When I reformatted the file above, all the bugs disappeared. I do not know, how to fix it permanently.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 17, 2020
@Aashishgtbit
Copy link

Aashishgtbit commented Dec 18, 2020

I solve this issue by installing all the modules separately as a devDependency.

    "@types/babel__core": "^7.1.12",
    "@types/babel__generator": "^7.6.2",
    "@types/babel__template": "^7.4.0",
    "@types/babel__traverse": "^7.11.0",

@AlexKamaev
Copy link
Contributor

Thank you all for your input.
If anybody has an example on how to reproduce the issue, please share it with us.

@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@oreporan
Copy link
Author

oreporan commented Dec 18, 2020

@Aashishgtbit

That resulted in

ERROR Error: Cannot find module 'babel-plugin-transform-inline-environment-variables'

I don't feel going down the babel rabbit hole is a good solution

@AlexKamaev
Try adding also babel-loader: 8.0.6

@no-response no-response bot removed the STATE: Need clarification An issue lacks information for further research. label Dec 18, 2020
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@mihanizm56
Copy link

The same error on building cra3 with typescript default configuration. Sometimes rebuild helps, but sometimes not, this works rather strange.

@mihanizm56
Copy link

mihanizm56 commented Dec 19, 2020

looks like the bug in babel types - I think you have the same issue. Am I right?
image

@castamir
Copy link

Might be related to babel/babel#12519 and babel/babel#12521

@mihanizm56
Copy link

Might be related to babel/babel#12519 and babel/babel#12521

yeah - this one!

@oreporan
Copy link
Author

so do any changes need to be done to testcafe to make this fix work?

@mihanizm56
Copy link

so do any changes need to be done to testcafe to make this fix work?

If it contains babel types dep then we should wait for the fixed version from babel team, I suppose.
If not - no, this is not related to testcafe directly

@castamir
Copy link

Let's wait till a new version is released, then let's verify if this bug is still present in testcafe or not.

@miherlosev
Copy link
Collaborator

miherlosev commented Dec 21, 2020

Folks
I guess this thread mentions two problems:

I agree with @castamir - let's wait for the new TestCafe version with the #5808 fix. After it, you can recheck your scenarios and localize the problem more precisely.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 21, 2020
@miherlosev
Copy link
Collaborator

The version of TestCafe with the #5808 fix is already released - 1.10.1.
Please recheck your scenarios and tell us about your results.

@miherlosev miherlosev added the STATE: Need clarification An issue lacks information for further research. label Dec 29, 2020
@castamir
Copy link

Our issue was resolved with new version of @babel/types

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 29, 2020
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 30, 2020
@no-response
Copy link

no-response bot commented Jan 8, 2021

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

@no-response no-response bot closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need clarification An issue lacks information for further research.
Projects
None yet
Development

No branches or pull requests

8 participants