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

Timeout: Tests never run #181

Open
george-norris-salesforce opened this issue Jul 5, 2019 · 9 comments
Open

Timeout: Tests never run #181

george-norris-salesforce opened this issue Jul 5, 2019 · 9 comments

Comments

@george-norris-salesforce
Copy link

george-norris-salesforce commented Jul 5, 2019

Start-server-and-test starts server and I can navigate the localhost:5000.

But the tests never run.

{
  "start-server-and-test": "^1.9.1",
}

OS X 10.13.6

...
"test:cypress": "NODE_ENV=test start-server-and-test start http://localhost:5000 cy:run",
"cy:run": "cypress run",
...
starting server using command "npm run start"
and when url "http://localhost:5000" is responding
running tests using command "npm run cy:run"

tests never run results in this error

Error: Timeout
at Timeout._onTimeout (/Users/geo/Code/MyProject/node_modules/wait-on/lib/wait-on.js:110:10)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
@george-norris-salesforce george-norris-salesforce changed the title Tests never run Timeout: Tests never run Jul 5, 2019
@huantaoliu
Copy link

you can try change http to http-get
start-server-and-test start http-get://localhost:5000 cy:run

@hendrik-scholz
Copy link

hendrik-scholz commented Aug 10, 2019

It might have something to do with the way wait-on works. The library is used to check whether resources are available.

"For http(s) resources wait-on will check that the requests are returning 2XX (success) to HEAD or GET requests (after following any redirects)." https://www.npmjs.com/package/wait-on

Since the endpoint http://127.0.0.1:3000 was not implemented in my application, an HTTP status code 404 was returned and start-server-and-test waited until the configured timeout. I changed start-server-and-test start http://127.0.0.1:3000 test to start-server-and-test start http://127.0.0.1:3000/authorization test so that wait-on got an HTTP status code 200. After that start-server-and-test ran the tests as expected.

@dan-cooke
Copy link

Same issue here with next-js application.

yarn run v1.19.1
$ start-server-and-test dev http-get://localhost:5000 cypress:open
starting server using command "npm run dev"
and when url "[ 'http-get://localhost:5000' ]" is responding
running tests using command "npm run cypress:open"

Endpoint is returning a 200 on initial bundle request.

@nweiser1
Copy link

having a similar issue
when i use the hard coded machine ip - it works
but when i put it localhost or 127.0.0.1 it does not work
tried using http-get, same issue
"start:server-and-client": "start-test start:server http-get://localhost:3000 start:client",

@vlindhol
Copy link

I get the same problem, both locally and in CircleCI. This package seems to miss that the endpoint is available.

@nya1
Copy link

nya1 commented Mar 23, 2020

You can try with tcp:PORT as the url according to https://github.com/jeffbski/wait-on
with that it should start when the specified port is open for connections

@jeremyriverain
Copy link

As @nya1 advised, the tcp:PORT option was my solution

{
    "test": "start-server-and-test 'npx http-server . -c-1 --silent -p 5555' tcp:5555 cypress:run"
}

emmenko added a commit to commercetools/merchant-center-application-kit that referenced this issue Mar 21, 2023
* chore: upgrade docs-kit to v21

* chore: use node 18 for development

* chore: upgrade gatsby to v5

* fix: import

* ci: bump cache

* chore(website): upgrade react to v18

* ci: use ipv4 loopback address (node v18 compatibility)

bahmutov/start-server-and-test#181
facebook/create-react-app#11302
cypress-io/github-action#811

* chore: update docs analytics tags and beta link

---------

Co-authored-by: Nikolaus Kuehn <[email protected]>
@fontcoderrrrrrr
Copy link

Hello anynoe, I solved the problem by substituting http:127.0.0.1:yourport for http://localhost:yourport.

@MikeMcC399
Copy link

@fontcoderrrrrrr

I solved the problem by substituting http:127.0.0.1:yourport for http://localhost:yourport/.

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

10 participants