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

cli-plugin-e2e-cypress test throws exception after tests succeed at the end - TypeError: server.stop is not a function #7230

Open
AlexanderTheGrey opened this issue Jul 11, 2022 · 20 comments

Comments

@AlexanderTheGrey
Copy link

Version

5.0.8

Environment info

macOS 10.15.7

Steps to reproduce

I tried on Cypress 9.5.1 and 10.3.0. After my tests succeed, the server attempts to close, but the cli-plugin-e2e-cypress fails to close the server:

@vue/cli-plugin-e2e-cypress/index.js:49
      runner.on('exit', () => server.stop())
                                                       ^
TypeError: server.stop is not a function
    at ChildProcess.<anonymous> (node_modules/@vue/cli-plugin-e2e-cypress/index.js:49:38)
    at ChildProcess.emit (node:events:538:35)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

What is expected?

The server should close properly.

What is actually happening?

cli-plugin-e2e-cypress is claiming that there is no stop() function on the server.

@AlexanderTheGrey
Copy link
Author

A temporary fix is to downgrade cli-plugin-e2e-cypress to 4.5.19.

@WhereJuly
Copy link

I have the very same issue on Cypress v9.7.0.

@OrLevi-1
Copy link

OrLevi-1 commented Aug 2, 2022

same issue with cypress v10.3.1

@wilcode
Copy link

wilcode commented Aug 4, 2022

same issue with cypress v10.3.1

+1, this is blocking my project upgrading to the latest Cypress version.

@iriadp
Copy link

iriadp commented Aug 31, 2022

+1 Any updates on this?

@iriadp
Copy link

iriadp commented Sep 2, 2022

A temporary fix is to downgrade cli-plugin-e2e-cypress to 4.5.19.

But that version isn't working for me with Cypress 10

@MorSof
Copy link

MorSof commented Sep 18, 2022

+1 Any updates on this?

@yrollam
Copy link

yrollam commented Oct 4, 2022

Would love a fix for this, its also blocking our upgrade to Cypress 10!

@drnir
Copy link

drnir commented Oct 6, 2022

Hey, can we have an estimated resolution time-frame for this issue?

@drnir
Copy link

drnir commented Oct 6, 2022

A temporary fix is to downgrade cli-plugin-e2e-cypress to 4.5.19.

is this cli-plugin-e2e-cypress version compatible with cypress 10?

@douglasjam
Copy link

Same error for me, my libs:

"@vue/cli-plugin-e2e-cypress": "^5.0.8"
"cypress": "^10.11.0"

@honzabilek4
Copy link

+1 here. It's not possible to use cypress 10 right now.

@ghost
Copy link

ghost commented Dec 7, 2022

Hi, "@vue/cli-plugin-e2e-cypress" not updated yet so still blocking for a cypress update.

@EmmanuelQ
Copy link

Any updates on this?

@bpb54321
Copy link

bpb54321 commented Feb 7, 2023

I agree, quite surprising that this hasn't been resolved yet. As I work around, I created the following npm script:
"test:e2e-report": "export NODE_ENV=e2e && vue-cli-service serve & wait-on http://localhost:8080/osc/ && cypress run && pkill -f vue-cli-service"
This starts a Vue development server in the background, then runs the Cypress tests, then kills the Vue development server after the Cypress process has exited. This works perfectly in our CI/CD environment (Bamboo), but it has the negative side effect of killing any development servers spun up with vue-cli-service locally.
The start-server-and-test module suggested by the Cypress docs (https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server) also seems to work quite well and be more targeted, but it seems to require running npm in a child process, which my CI/CD environment doesn't currently support.
In any case, this allows me to run Cypress 12 in CI/CD without having to wait on this fix to the Vue CLI.

@qq411910014
Copy link

I have the same problem in vue2. however, it does work in vue3

@daniel-bsci
Copy link

daniel-bsci commented Feb 8, 2023

Ran into this too. Ended up upgrading to Naruto and switched to Vite. It was quite painless actually and a much better dev/test experience. Vue CLI is abandoned so I'm not counting on this is getting resolved.

@bpb54321
Copy link

bpb54321 commented Feb 9, 2023

To follow-up on my previous comment, we are indeed still stuck on Vue 2.7, happy to hear that upgrading to Vue 3 and Vite will resolve the problem.

Using Vue 2 and Vue CLI, I did improve my npm script to the following, using the start-server-and-test package suggested in the Cypress doc (https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server):

start-server-and-test 'vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint --mode e2e' http://localhost:8080/osc/ 'cypress run'

I got around the limitation of my CI/CD runner not being able to execute npm by passing command strings instead of npm script names to start-server-and-test (the docs for the module mention that you can do this if you read them in detail https://github.com/bahmutov/start-server-and-test)

@wisetwo
Copy link

wisetwo commented May 8, 2023

Try upgrading @vue/cli-service version may fix the problem : )

Here is my situation:

before:

"@vue/cli-plugin-e2e-cypress": "^5.0.8",
"@vue/cli-service": "^4.3.0"

after:

"@vue/cli-plugin-e2e-cypress": "^5.0.8",
"@vue/cli-service": "~5.0.8",

BTW, vue.config.js may also needs modification due to @vue/cli-service version changes.

@Skelinen
Copy link

In case this is relevant for someone again, here is how I fixed it for our project.

We've Vue 2, and were running Cypress 9.5.2, and ran to this error when trying to update it to a more recent version.

Here's a change that would fix it:
https://github.com/vuejs/vue-cli/pull/7288/files

I used patch-package as a devDependency to apply the fix - I did the modifications needed, then ran patch-package for the module. Then, added patch-package to postinstall. Here's step-by-step for yarn:

  1. Do the modifications shown in the PR.
  2. Add patch-package as a devDependency.
  3. yarn install
  4. yarn patch-package @vue/cli-plugin-e2e-cypress
  5. Add this to package.json
 "scripts": {
  "postinstall": "patch-package"
 }
  1. yarn install

Voilà. It should work now. It creates a patch file which it applies at the end of each install to the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests