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

Cypress extreme slow initial test with Webpack 5 + Typescript #15447

Closed
petermanders89 opened this issue Mar 12, 2021 · 3 comments · Fixed by #15611
Closed

Cypress extreme slow initial test with Webpack 5 + Typescript #15447

petermanders89 opened this issue Mar 12, 2021 · 3 comments · Fixed by #15611

Comments

@petermanders89
Copy link

Current behavior

The first test run with open is extreme slow with Webpack 5 and a typescript setup. However when using run command it goes fast (as expected). Downgrading to Webpack 4 makes it a lot faster. The message "Your tests are loading" takes about 2 minutes. After which it proceeds to execute the test. Running this with the cypress-preprocessor-webpack-5 did not change anything. I added a complete debug log from a webpack 5 run. Tested with Chrome on Linux, however this also occurs on FireFox and other browsers. I tested on Windows as well, same issue.

Desired behavior

The first test with Webpack 5 should be equally fast as Webpack 4.

Test code to reproduce

I have provided a test repository: https://github.com/petermanders89/cypress-test-repo

Versions

You can see it in the repository, but here are the installed and used versions. Changing Webpack 5 to Webpack 4 solves it, but that's not desired behavior.

{
    "@babel/core": "^7.13.10",
    "@babel/preset-env": "^7.13.10",
    "@babel/preset-typescript": "^7.13.0",
    "@cypress/webpack-preprocessor": "^5.6.0",
    "babel-loader": "^8.2.2",
    "cypress": "^6.6.0",
    "typescript": "^4.2.3",
    "webpack": "^5.25.0"
}

logs.txt

@lukeapage
Copy link
Contributor

this is exactly what I've been investigating. What happens is that inside the cypress plugin

https://github.com/cypress-io/cypress/blob/develop/npm/webpack-preprocessor/index.ts#L305

onCompile is called before the timeout finishes for the handler is called with the result:
https://github.com/cypress-io/cypress/blob/develop/npm/webpack-preprocessor/index.ts#L297

Therefore the handler resolves the 2nd promise - but the 1st promise is the one that is sent back to the proprocessor and the ipc interface.

The call to get the js times out after 2 minutes and is retried. The second time the file is in the cache and is served.

I get this most of the time in webpack 5, but it is intermittant.

@chrisbreiding chrisbreiding removed their assignment May 17, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: to do stage: needs review The PR code is done & tested, needs review labels Jun 9, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: waiting stage: needs review The PR code is done & tested, needs review labels Jun 16, 2021
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jun 22, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 22, 2021

The code for this is done in cypress-io/cypress#15611, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 23, 2021

Released in 7.6.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.6.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants