Giter VIP home page Giter VIP logo

start-server-and-test's Introduction

start-server-and-test

Starts server, waits for URL, then runs test command; when the tests end, shuts down server

NPM

Build status semantic-release js-standard-style renovate-app badge

Install

Requires Node version 16 or above.

npm install --save-dev start-server-and-test

Upgrade

v1 to v2

If you are using just the port number, and the resolved URL localhost:xxxx no longer works, use the explicit http://localhost:xxxx instead

# v1
$ npx start-test 3000
# v2
$ npx start-test http://localhost:3000

Use

This command is meant to be used with NPM script commands. If you have a "start server", and "test" script names for example, you can start the server, wait for a url to respond, then run tests. When the test process exits, the server is shut down.

{
    "scripts": {
        "start-server": "npm start",
        "test": "mocha e2e-spec.js",
        "ci": "start-server-and-test start-server http://localhost:8080 test"
    }
}

To execute all tests simply run npm run ci.

Commands

In addition to using NPM script names, you can pass entire commands (surround them with quotes so it is still a single string) that will be executed "as is". For example, to start globally installed http-server before running and recording Cypress.io tests you can use

# run http-server, then when port 8000 responds run Cypress tests
start-server-and-test 'http-server -c-1 --silent' 8000 './node_modules/.bin/cypress run --record'

Because npm scripts execute with ./node_modules/.bin in the $PATH, you can mix global and locally installed tools when using commands inside package.json file. For example, if you want to run a single spec file:

{
  "scripts": {
    "ci": "start-server-and-test 'http-server -c-1 --silent' 8080 'cypress run --spec cypress/integration/location.spec.js'"
  }
}

Or you can move http-server part into its own start script, which is used by default and have the equivalent JSON

{
  "scripts": {
    "start": "http-server -c-1 --silent",
    "ci": "start-server-and-test 8080 'cypress run --spec cypress/integration/location.spec.js'"
  }
}

Here is another example that uses Mocha

{
  "scripts": {
    "ci": "start-server-and-test 'http-server -c-1 --silent' 8080 'mocha e2e-spec.js'"
  }
}

Alias

You can use either start-server-and-test, server-test or start-test commands in your scripts.

You can use : in front of port number like server-test :8080, so all these are equivalent

start-server-and-test start http://127.0.0.1:8080 test
server-test start http://127.0.0.1:8080 test
server-test http://127.0.0.1:8080 test
server-test 127.0.0.1:8080 test
start-test :8080 test
start-test 8080 test
start-test 8080

Tip: I highly recommend you specify the full url instead of the port, see the localhost vs 0.0.0.0 vs 127.0.0.1 section later in this README.

Options

If you use convention and name your scripts "start" and "test" you can simply provide URL

{
    "scripts": {
        "start": "npm start",
        "test": "mocha e2e-spec.js",
        "ci": "start-server-and-test http://localhost:8080"
    }
}

You can also shorten local url to just port, the code below is equivalent to checking http://127.0.0.1:8080.

{
    "scripts": {
        "start": "npm start",
        "test": "mocha e2e-spec.js",
        "ci": "server-test 8080"
    }
}

You can provide first start command, port (or url) and implicit test command

{
    "scripts": {
        "start-it": "npm start",
        "test": "mocha e2e-spec.js",
        "ci": "server-test start-it 8080"
    }
}

You can provide port number and custom test command, in that case npm start is assumed to start the server.

{
    "scripts": {
        "start": "npm start",
        "test-it": "mocha e2e-spec.js",
        "ci": "server-test :9000 test-it"
    }
}

You can provide multiple resources to wait on, separated by a pipe |. (be sure to wrap in quotes)

{
  "scripts": {
    "start": "npm start",
    "test-it": "mocha e2e-spec.js",
    "ci": "server-test \"8080|http://foo.com\""
  }
}

or for multiple ports simply: server-test '8000|9000' test.

If you want to start the server, wait for it to respond, and then run multiple test commands (and stop the server after they finish), you should be able to use && to separate the test commands:

{
  "scripts": {
    "start": "npm start",
    "test:unit": "mocha test.js",
    "test:e2e": "mocha e2e.js",
    "ci": "start-test 9000 'npm run test:unit && npm run test:e2e'"
  }
}

The above script ci after the 127.0.0.1:9000 responds executes the npm run test:unit command. Then when it finishes it runs npm run test:e2e. If the first or second command fails, the ci script fails. Of course, your mileage on Windows might vary.

expected

The server might respond, but require authorization, returning an error HTTP code by default. You can still know that the server is responding by using --expect argument (or its alias --expected):

$ start-test --expect 403 start :9000 test:e2e

See demo-expect-403 NPM script.

Default expected value is 200.

npx and yarn

If you have npx available, you can execute locally installed tools from the shell. For example, if the package.json has the following local tools:

{
  "devDependencies": {
    "cypress": "3.2.0",
    "http-server": "0.11.1",
    "start-server-and-test": "1.9.0"
  }
}

Then you can execute tests simply:

$ npx start-test 'http-server -c-1 .' 8080 'cypress run'
starting server using command "http-server -c-1 ."
and when url "http://127.0.0.1:8080" is responding
running tests using command "cypress run"
Starting up http-server, serving .
...

Similarly, you can use yarn to call locally installed tools

$ yarn start-test 'http-server -c-1 .' 8080 'cypress run'
yarn run v1.13.0
$ /private/tmp/test-t/node_modules/.bin/start-test 'http-server -c-1 .' 8080 'cypress run'
starting server using command "http-server -c-1 ."
and when url "http://127.0.0.1:8080" is responding
running tests using command "cypress run"
Starting up http-server, serving .
...

localhost vs 0.0.0.0 vs 127.0.0.1

The latest versions of Node and some web servers listen on host 0.0.0.0 which no longer means localhost. Thus if you specify just the port number, like :3000, this package will try http://127.0.0.1:3000 to ping the server. A good practice is to specify the full URL you would like to ping.

# same as "http://127.0.0.1:3000"
start-server start 3000 test
# better
start-server start http://127.0.0.1:3000 test
# or
start-server start http://0.0.0.0:3000 test
# of course, if your server is listening on localhost
# you can still set the URL
start-server start http://localhost:3000 test

If you specify just localhost or 127.0.0.1 or 0.0.0.0, it automatically pings http://... URL.

start-test localhost:3000
# is the same as
start-test http://localhost:3000

Note for yarn users

By default, npm is used to run scripts, however you can specify that yarn is used as follows:

"scripts": {
    "start-server": "yarn start",
    "test": "mocha e2e-spec.js",
    "ci": "start-server-and-test 'yarn start-server' http://localhost:8080 'yarn test'"
}

Note for webpack-dev-server users

Also applies to Vite users!

If you are using webpack-dev-server (directly or via angular/cli or other boilerplates) then the server does not respond to HEAD requests from start-server-and-test. You can check if the server responds to the HEAD requests by starting the server and pinging it from another terminal using curl

# from the first terminal start the server
$ npm start
# from the second terminal call the server with HEAD request
$ curl --head http://localhost:3000

If the server responds with 404, then it does not handle the HEAD requests. You have two solutions:

Use HTTP GET requests

You can force the start-server-and-test to ping the server using GET requests using the http-get:// prefix:

start-server-and-test http-get://localhost:8080

Ping a specific resource

As an alternative to using GET method to request the root page, you can try pinging a specific resource, see the discussion in the issue #4.

# maybe the server responds to HEAD requests to the HTML page
start-server-and-test http://localhost:3000/index.html
# or maybe the server responds to HEAD requests to JS resource
start-server-and-test http://localhost:8080/app.js

Explanation

You can watch the explanation in the video Debug a Problem in start-server-and-test.

Under the hood this module uses wait-on to ping the server. Wait-on uses HEAD by default, but webpack-dev-server does not respond to HEAD only to GET requests. Thus you need to use http-get:// URL format to force wait-on to use GET probe or ask for a particular resource.

Debugging

To see diagnostic messages, run with environment variable DEBUG=start-server-and-test

$ DEBUG=start-server-and-test npm run test
  start-server-and-test parsing CLI arguments: [ 'dev', '3000', 'subtask' ] +0ms
  start-server-and-test parsed args: { services: [ { start: 'npm run dev', url: [Array] } ], test: 'npm run subtask' }
...
making HTTP(S) head request to url:http://127.0.0.1:3000 ...
  HTTP(S) error for http://127.0.0.1:3000 Error: Request failed with status code 404

Disable HTTPS certificate checks

To disable HTTPS checks for wait-on, run with environment variable START_SERVER_AND_TEST_INSECURE=1.

Timeout

This utility will wait for maximum of 5 minutes while checking for the server to respond (default). Setting an environment variable WAIT_ON_TIMEOUT=600000 (milliseconds) sets the timeout for example to 10 minutes.

Interval

This utility will check for a server response every two seconds (default). Setting an environment variable WAIT_ON_INTERVAL=600000 (milliseconds) sets the interval for example to 10 minutes.

Starting two servers

Sometimes you need to start one API server and one webserver in order to test the application. Use the syntax:

start-test <first command> <first resource> <second command> <second resource> <test command>

For example if API runs at port 3000 and server runs at port 8080:

{
  "scripts": {
    "test": "node src/test",
    "start:api": "node src/api",
    "start:server": "node src/server",
    "test:all": "start-test start:api 3000 start:server 8080 test"
  }
}

In the above example you would run npm run test:all to start the API first, then when it responds, start the server, and when the server is responding, it would run the tests. After the tests finish, it will shut down both servers. See the repo start-two-servers-example for full example

Note for Apollo Server users

When passing a simple GET request to Apollo Server it will respond with a 405 error. To get around this problem you need to pass a valid GraphQL query into the query parameter. Passing in a basic schema introspection query will work to determine the presence of an Apollo Server. You can configure your npm script like so:

{
  "scripts": {
    "ci": "start-server-and-test start 'http-get://localhost:4000/graphql?query={ __schema { queryType { name } } }' test"
  }
}

Small print

Author: Gleb Bahmutov <[email protected]> Β© 2017

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

See LICENSE

start-server-and-test's People

Contributors

adrianjost avatar bahmutov avatar cmcnicholas avatar cpow avatar dallonf avatar idmontie avatar jayphelps avatar jesstelford avatar jgjp avatar lorenzleutgeb avatar manduro avatar matzeeable avatar mucsi96 avatar myrjola avatar patrick-hardin avatar penx avatar renovate-bot avatar renovate[bot] avatar ricksbrown avatar sarimarton avatar sonicoder86 avatar sportnak avatar svenheden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

start-server-and-test's Issues

Can we detect the port automatically?

If we start a process, can we detect which port it binds to automatically?

"start-test server test"

Or by default "start-test" if using default "start" and "test" scripts

Command timeout

Can we have another argument/parameter to configure the timeout of the command?
For example: After waiting 2 minutes without any response from the endpoint. The process will exit with code 1.

Thank for your great work with this project.
Cheer.

When used with Gatsby's --https flag, the test command is never run

Is this a bug report or a feature request?

I guess it's a bug if it is supposed to work and a feature request if it isn't.

  • version 1.7.12
  • platform OSX

Reproduction using Gatsby's default starter here.

Expected behavior

With the following npm scripts:

"develop": "gatsby develop --https",
"start": "npm run develop",
"cy:open": "cypress open",
"test:e2e": "start-server-and-test develop https://localhost:8000 cy:open"

I should be able to run npm run test:e2e, see Gatsby run the development server, and Cypress open in a new window.

Actual behavior

Gatsby runs the development server but Cypress never opens.

Discussion

This works fine without the --https flag for gatsby develop.

need compatibility with cross-env package

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

Bug
If this is a bug report, please provide as much info as possible

  • version
    1.5
  • platform
    mac
  • expected behavior
    no error after exist
  • actual behavior
    error after test finishes and exits.

-Detail:
I am using Jest library as testing package.
If I use cross-env to define environment variables for both test and start-server, then it will throw errors when the Jest test exists.
My current configuration:
"test": "cross-env NODE_ENV=test jest --forceExist",
"test-server": "cross-env NODE_ENV=test ts-node src/index.ts",
"ci": "start-server-and-test test-server http://localhost:4000 test",

the error message when it exists the test is the following:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-server: cross-env NODE_ENV=test ts-node src/index.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tanekim/.npm/_logs/2018-07-05T23_57_30_700Z-debug.log

If I remove the keywords cross-env from all lines and then run ci again, then I don't see the error message.
Also, it is a problem with mac, not windows, as I tested.

If this is a new feature request, please describe it below

Problem using http-get without start script name

If we use two argument form this works

start-test 4200 cy:open

But if we have a webpack dev server that does not respond to HEAD requests and we need to wait using GET request, the following does not work

start-test http-get://localhost:4200 cy:open

Feature Request: Shortcuts

Thanks for this wonderful module first. This is very useful for my acceptance test.

For lazy developer like me, can you make the CLI shorter than the existing one?

  • server-test as the shortcut of start-server-and-test
  • 8080 as shortcut of http://localhost:8080 or https://localhost:8080

For example,

  • server-test 8080
  • server-test start-server 8080
  • server-test start 8080 my-test

@bahmutov if you are ok with it, I can make a PR.

Allow passing arguments to test script

And maybe to start script to make it simple to refine commands without defining new npm scripts

Currently, let's say we have npm test command

{
  "scripts": {
    "start": "server",
    "cy": "cypress run",
    "test": "start-test :3000 cy"
  }
}

and the CI build command could be simply npm test

Now let's say we want to record tests on Cypress dashboard, this would be simply cypress run --record, but how to pass this from npm test? Right now need to define custom commands

{
  "scripts": {
    "start": "server",
    "cy": "cypress run",
    "cy:record": "cypress run --record",
    "test": "start-test :3000 cy",
    "test:ci": "start-test :3000 cy:record"
  }
}

and set CI script to use npm run test:ci

So too much effort to pass --record argument. It would be much nicer to pass something like this from CI script

npm test -- --test-args "--record"

which this package would append to its "test" command and would run npm run cy -- --record

webpack dev server proxy doesn't work well with start-server-and-start

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

If this is a bug report, please provide as much info as possible

  • version - 1.7.13
  • platform - Mac
  • expected behavior - no errors
  • actual behavior - missing request headers

Assume you are running two servers - web and api

Web:8080
Api: 8000

Web proxies * at 8000.

config.devServer.proxy = {
    '**': {
        bypass(request) {
            if (request.headers.accept.indexOf('html') !== -1) {
                return '/index.html';
            }

            return false;
        },
        target: 'http://localhost:8000'
    }
};
    "cypress:run": "cypress run",
    "start:server": "npx foo --type server",
    "start:api": "npx foo -- type api",
    "start:server-with-api": "start-test start:api 8000?url=api start:server",
    "test:acceptance": "start-test server-with-api http-get://localhost:5555 cypress:run",

When checking for server, request header is undefined and cypress:run cannot start.

Error: server closed unexpectedly

I have problems with even start server etc. I was following instructions, and I can't make this thing to work. So here is more information:

What I want to achieve

  • I'm using cypress to test my html/js/css website (a basic site that is using gulp to do better optimization etc).
  • I was trying several ways that are described over the internet but without success
  • I want that this script works on Netlify too
  • I need a server that is running on the port 5000

What I was trying to do?

npm run deploy

Build process finished fine, but then here is an error:

start-server-and-test start cy:run

starting server using command "npm run start"
and when url "undefined" is responding
running tests using command "npm run test"
/home/bruno_afk/Dev/paveljame-site/node_modules/lazy-ass/index.js:117
throw err;
^

Error: missing url to wait on null
at lazyAssLogic (/home/bruno_afk/Dev/paveljame-site/node_modules/lazy-ass/index.js:110:14)
at lazyAss (/home/bruno_afk/Dev/paveljame-site/node_modules/lazy-ass/index.js:115:28)
at startAndTest (/home/bruno_afk/Dev/paveljame-site/node_modules/start-server-and-test/src/index.js:24:3)
at Object. (/home/bruno_afk/Dev/paveljame-site/node_modules/start-server-and-test/src/bin/start.js:13:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! Test failed. See above for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] predeploy: CI=1 npm i cypress; npm run develop; npm test
npm ERR! Exit status 1

My npm scripts

"scripts": {
        "gulp": "node_modules/.bin/gulp",
        "start-server-and-test": "node_modules/.bin/start-server-and-test",
        "start": "start-test -p 5000",
        "test": "start-server-and-test start cy:run",
        "dev": " gulp publish",
        "develop": "gulp build",
        "build": "gulp publish",
        "predeploy": "CI=1 npm i cypress; npm run develop; npm test",
        "deploy": "npm run build",
        "cy:run": "cypress run",
        "cy:open": "cypress open"
    },
  • node version: 10.16.0
  • npm version: 6.9.0
  • package version: 1.9.1
  • PopOS 19.04 (linux)

Launched processes not closed after tests have ended

Is this a bug report or a feature request?

Bug report

  • version
    1.0.1
  • platform
    Debian 9.3 (Linux)
  • expected behavior
    After running tests the processes which it started should have been shut down
  • actual behavior
    Some node processes seem still be running (in the example repo stated below there is still parcel bundler running which serves the pages after the tests have been completed).

Repository which can be used to reproduce the bug: https://github.com/tkivela/hyperapptemplate_ts
Start e2e tests by running "npm run e2etest" (or "yarn e2etest")

can this be used with a remote backend server?

When looking at this it seems that you have to have a local client and local server to use this? My setup is a local client which is developed using a remote backend server, or would that still work to have the restart of my backend before I run my local cypress tests?

Args slice bug

Is this a bug report or a feature request?

bug report

  • version 1.7.12
  • platform mac os mojave
  • expected behavior no error
  • actual behavior error

info

patched package a bit to show debug info

image

and ran this

npx cross-env FOO=bar start-server-and-test webpack-dev-server http://localhost:9876 karma:test --log-level=DEBUG

got this error

npx cross-env FOO=bar start-server-and-test webpack-dev-server http://localhost:9876 karma:test --log-level=DEBUG
start-server-and-test: args.length -> 4
----------- start dump args  --------------
[ 'webpack-dev-server',
  'http://localhost:9876',
  'karma:test',
  '--log-level=DEBUG' ]
----------- done dump args  --------------
/Users/colch/Documents/Workspace/HelloWorldGreeterEnterprise/node_modules/lazy-ass/index.js:117
      throw err;
      ^

Error: expect: <start script name> <url> <test script name>
    at lazyAssLogic (/Users/colch/Documents/Workspace/HelloWorldGreeterEnterprise/node_modules/lazy-ass/index.js:110:14)
    at lazyAss (/Users/colch/Documents/Workspace/HelloWorldGreeterEnterprise/node_modules/lazy-ass/index.js:115:28)
    at Object.<anonymous> (/Users/colch/Documents/Workspace/HelloWorldGreeterEnterprise/node_modules/start-server-and-test/bin/start.js:36:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

package now allows to specify things and forces me to wrap everything :(

BTW do you need help with fix?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Ruby and Linux ENV not loading correctly maybe...

This is more of a question and not a bug report I think but I'm having an issue with start-server-and-test not loading my Linux environment and so uses the wrong ruby version. Here's my scripts section:

"scripts": {
    "start": "./bin/rails s -e test",
    "test": "node cypress-run.js",
    "ci": "start-server-and-test http://localhost:3000"
  }

So when running "npm run ci", I get this error:
"Your Ruby version is 2.3.1, but your Gemfile specified 2.5.0"

I can run the "start" script successfully. The correct version of ruby is used via RVM (Ruby Version Manager) and the server starts.

But when running the "ci" script, it's not running with my Linux ENV. It's seeing my system ruby which is version 2.3.1 (Linux mint 18.3 default), and not the RVM ruby version set in Bash ENV which is 2.5.0.

Is there something I can do to make "ci": "start-server-and-test http://localhost:3000" use my Bash ENV?

  • version: ^1.1.0
  • node: 8.11.0
  • platform: Linux mint 18.3
  • rvm 1.29.3

starting cypress and webpack

Is this a bug report or a feature request?

bug report

version

start-server-and-test: 1.7.12
cypress: 3.2.0

platform

win10

expected behavior

using scripts like these

"cy:start": "npm run open:src",
"cy:run": "cypress run",
"cy:test": "start-server-and-test cy:start http-get://localhost:3000 cy:run"

should work as described in README

actual behavior

It completes start script(builds source and then webpack) but it doesn't get any further than that

Cypress never start with yarn - Error Timeout

This is command I'm about to run

yarn start-test start:local https://localhost:3000 'yarn cypress:ci'
this run apps and app is accessible on https://localhost:3000 but task yarn cypress:ci is never reached

as you can see it from here it doesn't do anything specific
"cypress:ci": "cypress run --config testFiles=**/ci.suites.js"

If this is a bug report, please provide as much info as possible

  • "start-server-and-test": "^1.10.5"
  • OS Catalina
  • running cypress tests
  • actual nothing happen
Error: Timeout
    at Timeout._onTimeout (/vaske/repos/my-app/node_modules/wait-on/lib/wait-on.js:113: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)
error Command failed with exit code 1.

my whole goal is to run cypress test once when app is served.
Serving of app take some time, but nothing unusual.

Rails and webpack dev server with https proxy doesn't work

Is this a bug report or a feature request?

Bug report

If this is a bug report, please provide as much info as possible

I'm using latest CRA with proxy, in https.

β–Ά cat node_modules/start-server-and-test/package.json | grep version
  "version": "1.9.1",

β–Ά cat node_modules/webpack-dev-server/package.json| ag version   
  "version": "3.2.1",

β–Ά rails -v           
Rails 5.2.3

β–Ά lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

  • expected behavior
    first rails server start, then webpack dev server, and then the test script

  • actual behavior
    rails server start and starts logging errors

this is my setup:

// package.json

"prestart": "yarn copy-cert",
"start": "REACT_APP_ENV=development HTTPS=true PORT=3001 react-app-rewired start",
"cy:run:record": "cypress run --record --key a615cced-169b-4415-a88c-905f77e5c3a8",
"start:api": "rails server",
"start-api-and-webpack-dev": "start-server-and-test start:api https://localhost:3000 start",
"cy:ci:two-servers": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start-api-and-webpack-dev https-get://localhost:3001 cy:run:record",

when I run $ yarn cy:ci:two-servers, here's what happens:
two sevrers

However, running the scripts on separate terminals works great:

two sevrers

Also, if I run this (notice I send rails to the background with rails server &)

"cy:ci": "START_SERVER_AND_TEST_INSECURE=1 rails server & start-server-and-test start https-get://localhost:3001 cy:run:record",

then the rails server runs fine, and then the webpack dev server, but the tests never run:

ci rails to background

Any ideas how to approach this?

Thanks again for the great package and your help!

Terminal output hijacked after test finishes

Thank you for this nice package!

Is this a bug report or a feature request?

Bug Report

  • Version: ^1.5.0
  • Platform: macOS High Sierra 10.13.6
  • Expected Behavior: Tool runs (as part of npm script) and releases control back to my keyboard after it finishes.
  • Actual Behavior: Script runs, and completes successfully, however the keyboard input stops coming through when I type into the terminal after the script finishes. The only way to fix it is to reset the terminal. Even tput reset doesn't clean it up!

You can find this in action in our core repository: https://github.com/patternfly/patternfly-next

  1. Clone it
  2. Install it with npm install
  3. Run npm script that uses this package with npm run test:ci
  4. Type into terminal you just ran the test in, notice the characters you type are no longer output in the console, however the input is still being captured
  5. type reset, notice problem is fixed

Apologies if I've overlooked something and this isn't a bug with this lib. Thanks for looking into this!

Timeout: Tests never run

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)

Dependency deprecation warning: nsp (npm)

On registry https://registry.npmjs.org, the "latest" version (v3.2.1) of dependency nsp has the following deprecation notice:

The Node Security Platform service is shutting down 9/30 - https://blog.npmjs.org/post/175511531085/the-node-security-platform-service-is-shutting

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about nsp's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

Dependency deprecation warning: travis-deploy-once (npm)

On registry https://registry.npmjs.org/, the "latest" version (v5.0.11) of dependency travis-deploy-once has the following deprecation notice:

We recommend to use Travis Build Stages instead

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about travis-deploy-once's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Hmm, not working with vuepress dev mode

Cannot seem to detect the built VuePress site, for example here

https://github.com/bahmutov/try-vuepress

$ DEBUG=wait-on npm run test:dev

> [email protected] test:dev /Users/gleb/git/try-vuepress
> start-test dev http-get://localhost:8080/try-vuepress/ cy:open

starting server using command "npm run dev"
and when url "http-get://localhost:8080/try-vuepress/" is responding
running tests using command "cy:open"

> [email protected] dev /Users/gleb/git/try-vuepress
> vuepress dev src


  VuePress dev server listening at http://localhost:8080/try-vuepress/

How to set NODE_ENV=test?

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

I'm using start-server-and-test to run Cypress. We have a IP restriction when NOT in NODE_ENV=test. So, I run NODE_ENV=test start-server-and-test start http://localhost:5000 cy:open. But console.log(process.env.NODE_ENV) on the server shows it is still in development mode, so no tests ever run.

How can I set the NODE_ENV when using start-server-and-test?

Can't seem to actually wait for Hapi servers

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

If this is a bug report, please provide as much info as possible

  • version 1.7.12
  • platform Mac
  • expected behavior wait for a hapi server
  • actual behavior does not wait for hapi server to be up

I tried both...

    "foo": "start-server-and-test api http://localhost:8000 test",

and

    "foo": "start-server-and-test api http-get://localhost:8000 test",

How to start API-server in different directory?

I am running v1.7.12 of start-server-and-test, and I am trying to start both my Vue application as well as my API-server, so I can run my Cypress tests.

However, the API server is in a different (higher) directory than the Vue application, so "npm run start" will not work. However, I found out that I can start the API server from my Vue app directory, by using the following command:
npm run start --prefix ../

So, with that in mind, I added the following lines to the "scripts" section of package.json:
"test": "cypress run",
"start:api": "npm run serve",
"start:server": "npm run start --prefix ../",
"start:server-and-api": "start-test start:api 3000 start:server",
"test:all": "start-test start:api 3000 start:server 5000"

And then I started the test with:
npm run test:all
However, when I try to use this command with start-server-and-test, I run into an exception. You can look at the full debug log of this error: 2019-04-03T08_28_10_343Z-debug.log

Is this a bug in start-server-and-test? Or is it perhaps a feature which is not supported (yet) by this package?

small correction:
I see that I have switched the settings for the API and the Vue server around, so here is what my configuration looks like when I correct that:
"start:server": "npm run serve",
"start:api": "npm run start --prefix ../",
"start:server-and-api": "start-test start:api 3000 start:server",
"test:all": "start-test start:api 3000 start:server 5000"
The exception/error remains, however.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Error: kill ESRCH

Is this a bug report or a feature request?

Bug report

If this is a bug report, please provide as much info as possible

  • version 1.4.1
  • platform: teamcity

expected behavior

The server to run in CI environment.

actual behavior

The command crashes with the following info:

[04:09:56][Step 3/6] { Error: kill ESRCH
[04:09:56][Step 3/6]     at exports._errnoException (util.js:1018:11)
[04:09:56][Step 3/6]     at process.kill (internal/process.js:190:13)
[04:09:56][Step 3/6]     at children.forEach.child (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/start-server-and-test/src/index.js:32:21)
[04:09:56][Step 3/6]     at Array.forEach (native)
[04:09:56][Step 3/6]     at Promise.fromNode.then.children (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/start-server-and-test/src/index.js:31:20)
[04:09:56][Step 3/6]     at tryCatcher (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/util.js:16:23)
[04:09:56][Step 3/6]     at Promise._settlePromiseFromHandler (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/promise.js:512:31)
[04:09:56][Step 3/6]     at Promise._settlePromise (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/promise.js:569:18)
[04:09:56][Step 3/6]     at Promise._settlePromise0 (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/promise.js:614:10)
[04:09:56][Step 3/6]     at Promise._settlePromises (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/promise.js:693:18)
[04:09:56][Step 3/6]     at Promise._fulfill (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/promise.js:638:18)
[04:09:56][Step 3/6]     at /home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/bluebird/js/release/nodeback.js:42:21
[04:09:56][Step 3/6]     at /home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/ps-tree/index.js:86:7
[04:09:56][Step 3/6]     at Stream.a.end (/home/teamcity/buildAgent/work/7182f89e35c6b1c9/node_modules/event-stream/index.js:87:5)
[04:09:56][Step 3/6]     at Stream.onend (internal/streams/legacy.js:44:10)
[04:09:56][Step 3/6]     at emitNone (events.js:91:20) code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }
[04:09:56][Step 3/6] error An unexpected error occurred: "Command failed.
[04:09:56][Step 3/6] Exit code: 1
[04:09:56][Step 3/6] Command: sh
[04:09:56][Step 3/6] Arguments: -c start-server-and-test start http://localhost:3000 cypress:run:ci
[04:09:56][Step 3/6] Directory: /home/teamcity/buildAgent/work/7182f89e35c6b1c9
[04:09:56][Step 3/6] Output:
[04:09:56][Step 3/6] ".

Here are the relevant commands I'm running:

"watch-css": "npm run build-css && node-sass-chokidar src/css/scss/ -o src/css/dist/ --watch",
"start": "npm-run-all -p watch-css start-js",
"cypress:run:ci": "./node_modules/.bin/cypress run",
"cypress:ci": "start-server-and-test start http://localhost:3000 cypress:run:ci"

cypress:ci being the one called in teamcity.

When I run this command locally, it works fine.

Thank you!

Environment variables in npm script does not work

Is this a bug report or a feature request?

Bug report

  • version
    1.4.1
  • platform
    Linux RHEL 7.4
  • expected behavior
    When using
    "e2e": "env PORT=8010 start-server-and-test develop $PORT cypress:run"
    I expect start-server-and-test to listen to url http://localhost:8010.
  • actual behavior
    starting server using command "npm run start"
    and when url "undefined" is responding
    running tests using command "test"
    ...
    throw err;
    ^

Error: missing url to wait on null
...
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
...
npm ERR! Exit status 1

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

[Question] Does this work with webpack-dev-server ?

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

It's a question

Description

Hi, I am trying to integrate your module, I find it in Cypress documentation.
I have a React Application build with Webpack, I use Webpack-dev-server, in my script I have :
"ci": "start-server-and-test start http://localhost:8080 cy:open",

Where start simply start my server by doing :
"start": "webpack-dev-server --watch",

And it seems to work fine, except that it doesn't wait the end of bundling before launching the test command, here is what happen in the console :

starting server using command "npm run start" and when url "http://localhost:8080" is responding running tests using command "cy:open"

webpack-dev-server --watch
http://localhost:8080/
webpack result is served from /
content is served from C:\Dev\workspace\setup\react

Here it should wait the bundle to be done, but instead of this, it launches the next command

cypress open

Do you have any idea of how I can accomplish what I want to do ?
Temporarily I set a sleep of 30s in my test runner but it's not maintainable.

feature request: CRA

Feature Request. I'm currently running cypress using the following configuration. Is there a way to hook into the existing CRA start process and not have to setup serve to do this. This works but looking for a better approach:

        "start": "react-scripts start",
        "start-https": "HTTPS=true && react-scripts start",
        "build": "react-scripts build",
        "test": "is-ci test:cypress:run test:cypress:dev",
        "cy:run": "cypress run",
        "cy:open": "cypress open",
        "pretest:cypress:run": "npm run build",
        "test:cypress:run": "server-test serve :3000 cy:run",
        "test:cypress:dev": "npm-run-all --parallel --race start cy:open",
        "serve": "npx serve -n -s --listen 3000 build",

Fail immediately if the server cannot be started

Hi there @bahmutov, great work here 🀘

I have a feature request and I'm interested in what you think.

It would be nice to have the script to fail if the server fails to start for some reason. This is my use case:

I have the test:e2e command set up in my package.json like this:

"start": "react-scripts start",
"cy:run": "cypress:run",
"test:e2e": "start-server-and-test start http://localhost:3000 cy:run"

When I run the yarn test:e2e, I see that the server fails to start. It has a compilation error. But the latter command (cy:run) starts running.

It would be nice to have it somehow fail immidiately, instead of waiting for cy:run to finish. What do you think?

allow arbitrary start and test commands

Version 1.7.14 assumes that start and test commands are NPM script names. It would be nice to allow any commands. For example step 1 could be allowing passing arbitrary commands like this

start-test 'http-server -c-1 --silent' 8080 test

We could check the "start" argument - in this case "http-server -c-1 --silent" against NPM script names. Since it is NOT "start" or "test" or a script name, it would be its own command.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Error: spawn ps ENOENT

Is this a bug report or a feature request?

Bug

  • version
npm -v start-server-and-test
5.6.0
  • platform
    linux: alpine-node
  • expected behavior
    Exits with code 0 at end of test
  • actual behavior
    After tests complete, I get Error: spawn ps ENOENT, and exits with code 1
    All specs passed!                           00:27       15       15        -        -        -  

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn ps ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:e2e: `start-server-and-test start:qa http-get://0.0.0.0:8080 cy:run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-12-01T05_09_26_197Z-debug.log
Exited with code 1

It looks like this started when I added env to the beginning of start:web?

    "start:web": "env APP_ENV=dev webpack-dev-server --inline --hot --host 0.0.0.0",
    "test:e2e": "start-server-and-test start:web http-get://0.0.0.0:8080 cy:run",
    "cy:run": "cypress run",

I need to keep env. Any suggestions on what I should try? Thanks!

Latest release not executing tests

Bug

Version 1.5.0

Running webpack-dev-server 2.11.2

Command: start-server-and-test start-e2e http-get://localhost:4200 test-e2e

where:

"start-e2e": "webpack-dev-server --port=4200 --env.MODE=e2e"
"test-e2e": "testcafe -c 2 chrome:headless e2e/tests/nsl"

It gets stucked at running webpack-dev-server, doesn't execute test command(aka nothing happens, tests are not running)...

Doesn't work with https for webpack-dev-server

Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.

Is this a bug report or a feature request?

Version
"start-server-and-test": "^1.9.0"
"cypress": "^3.2.0",

Platform
macOs High Sierra - Version 10.13.6

I am using create-react-app and I am running my development webpack server in https.
So running npm run cypress:open, I would expect

  1. My application to run in https://localhost:3000
  2. Once the server is up, the cypress launcher to run on it.

Only the first step happens, cypress launcher is not opening up.

This is my scripts config in package.json.

 "scripts": {
        "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
        "start-js": "export HTTPS=true&&react-scripts start",
        "start": "npm-run-all -p watch-css start-js",
        "cy:open": "cypress open",
        "cypress:open": "start-server-and-test start http-get://localhost:3000 cy:open"
    },

I am facing this issue only for https, not http.

Ability to set headers

If this is a new feature request, please describe it below

Hi I'm just trying to get this to work with apollo-server [https://www.apollographql.com/docs/apollo-server/api/apollo-server.html].
If you send a HEAD request you get a 405 - Method not allowed.
If you send a GET request with no headers you get a 400 - Bad request.

BUT if you add the header 'Accept': 'text/html' it works.

It's a bit of a weird situation, I think it's because apollo-server does a check to see wether to show the playground or use the api.

I'm not sure what the best solution would be maybe allowing custom headers to be passed to wait-on but in my situation I'm waiting on 2 servers to wake up, though the extra headers on the server that works fine with the HEAD request doesn't hurt.

Thanks and great work on the project by the way.

Cheers,
Kristian

Angular CLI on Jenkins/Docker

Is this a bug report or a feature request?

bug, maybe...

  • version
    ^1.7.11 / node 11.9.0
  • platform
    docker/jenkins

First off, thanks! This is just what I needed.

So, running this on the docker image locally i have no issues (once i make change from #4) but when I run this via my jenkins pipeline i get the below log. I also tried it by referencing one of the assets but it doesn't seem to like that either.

Any other things I could try to point me in the right direction? Maybe a permission issue or something related to the host system?

Debug Log

+ npm run ci:test



> @bob/[email protected] ci:test /opt/appserver/jenkins/workspace/-webui_lassie_feature_addCypress

> start-server-and-test start http-get://localhost:4200 cypress:run



starting server using command "npm run start"

and when url "http-get://localhost:4200" is responding

running tests using command "cypress:run"

2019-02-07T01:25:40.067Z start-server-and-test starting server, verbose mode? true

2019-02-07T01:25:40.076Z start-server-and-test starting waitOn http-get://localhost:4200

> @bob/[email protected] prestart /opt/appserver/jenkins/workspace/-webui_lassie_feature_addCypress

> ngtw build

child next [ { 'http-get://localhost:4200': -404 } ]

wait-on(446) waiting for: http-get://localhost:4200

child complete

Successful Tailwind Build!

> @bob/[email protected] start /opt/appserver/jenkins/workspace/-webui_lassie_feature_addCypress

> ng serve & ngtw watch

child next []

child complete

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete



Date: 2019-02-07T01:25:58.400Z

Hash: ba30fa9325fc337d232c

Time: 12504ms

chunk {main} main.js, main.js.map (main) 42.5 kB [initial] [rendered]

chunk {news-news-module} news-news-module.js, news-news-module.js.map (news-news-module) 25.5 kB  [rendered]

chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered]

chunk {runtime} runtime.js, runtime.js.map (runtime) 8.77 kB [entry] [rendered]

chunk {styles} styles.js, styles.js.map (styles) 896 kB [initial] [rendered]

chunk {vendor} vendor.js, vendor.js.map (vendor) 4.11 MB [initial] [rendered]

β„Ή ο½’wdmο½£: Compiled successfully.

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

child next []

child complete

Thanks in advance for any help

ELIFECYCLE error

Is this a bug report or a feature request? bug report

  • expected behavior: After server is up and tests have completed running the server should stop and exit without error.

  • actual behavior: After the server is up and tests have completed running I get the above stack trace error and the server remains live.

Running on Windows 10 bash terminal.

Ran with debug mode. Stack trace is:

Test Suites: 4 passed, 4 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        7.336s, estimated 13s
Ran all test suites matching /\\GoldTests\\*/i.
  start-server-and-test getting child processes +9s
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn wmic.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:setSeleniumVar: `cross-env REACT_APP_IS_SELENIUM_TESTING=true DEBUG=start-server-and-test "start-test" "start" "3000" "test:selenium"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:setSeleniumVar script.

scripts I'm running are:

"test:setSeleniumVar": "cross-env REACT_APP_IS_SELENIUM_TESTING=true DEBUG=start-server-and-test",
"test:selenium": "npm test -- /GoldTests/*",
"test:integration": "npm run test:setSeleniumVar start-test start 3000 test:selenium"

package.json:

	"dependencies": {
		"@codewithdan/observable-store": "1.0.20",
		"axios": "0.18.1",
		"file-saver": "2.0.2",
		"react": "16.8.6",
		"react-autosuggest": "9.4.3",
		"react-beautiful-dnd": "10.1.1",
		"react-bootstrap": "1.0.0-beta.9",
		"react-dom": "16.8.6",
		"react-jsonschema-form": "^1.6.1",
		"react-scripts": "3.0.1",
		"selenium-webdriver": "^4.0.0-alpha.4"
	},
	"devDependencies": {
		"@babel/plugin-proposal-class-properties": "^7.5.5",
		"@babel/preset-env": "^7.5.4",
		"@babel/preset-react": "^7.0.0",
		"@types/jest": "^24.0.15",
		"babel-jest": "^24.8.0",
		"babel-plugin-transform-runtime": "^6.23.0",
		"chromedriver": "^73.0.0",
		"cross-env": "^5.2.0",
		"enzyme": "^3.10.0",
		"enzyme-adapter-react-16": "^1.14.0",
		"geckodriver": "^1.16.2",
		"identity-obj-proxy": "^3.0.0",
		"jest": "24.7.1",
		"mocha": "^6.1.4",
		"react-test-renderer": "^16.8.6",
		"selenium-side-runner": "^3.12.1",
		"start-server-and-test": "^1.10.0"
	},

on jenkins got extra stack trace info

13:14:55  { Error: Command failed: /bin/sh -c npm run test:runner
13:14:55      at makeError (/opt/jenkins_slave/workspace/ui-1.0.0-feature-Tardis-5264-E2E/node_modules/start-server-and-test/node_modules/execa/index.js:174:9)
13:14:55      at Promise.all.then.arr (/opt/jenkins_slave/workspace/ui-1.0.0-feature-Tardis-5264-E2E/node_modules/start-server-and-test/node_modules/execa/index.js:278:16)
13:14:55      at process._tickCallback (internal/process/next_tick.js:68:7)
13:14:55    code: 1,
13:14:55    stdout: null,
13:14:55    stderr: null,
13:14:55    failed: true,
13:14:55    signal: null,
13:14:55    cmd: '/bin/sh -c npm run test:runner',
13:14:55    timedOut: false,
13:14:55    killed: false }

Timeout does not work resulting in ESOCKETTIMEDOUT using cypress

Hi,

I am using start-server-and-test (v1.9.1) in combination with cypress (v3.3.1), as described here: https://docs.cypress.io/guides/guides/continuous-integration.html#Solutions with the command
start-server-and-test start http://localhost:3000 cypressRunChrome

According to the description of the 5-Minute-Timeout utility, it should wait until the server is ready and responds. This seems not to work in my case, resulting in an ESOCKETTIMEDOUT error while running the tests. I the log file, I see that the dev server starts at 11:18:53, it is ready at 11:20:08, but the test are already starting at 11:19:14.

I am expecting that start-server-and-test start is waiting, but for some reasons, it does not.

Log snippet:

11:18:47	starting server using command "npm run start"
11:18:47	and when url "http://localhost:3000" is responding
11:18:47	running tests using command "npm run cypressRunChrome"
11:18:48	
11:18:48	> [email protected] start C:\...
11:18:48	> react-scripts start
11:18:48	
11:18:53	Starting the development server...
11:18:58	
11:18:58	> [email protected] cypressRunChrome C:\...
11:18:58	> cypress run --browser chrome
11:19:14	
11:19:14	====================================================================================================
11:19:14	
11:19:14	  (Run Starting)
11:19:14	
11:19:14	  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Ώ
11:19:14	  β”‚ Cypress:    3.3.1                                                                              β”‚
11:19:14	  β”‚ Browser:    Chrome 71                                                                          β”‚
11:19:14	  β”‚ Specs:      5 found (...) β”‚
11:19:14	  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:19:14	
11:19:14	────────────────────────────────────────────────────────────────────────────────────────────────────
11:19:14	                                                                                                    
11:19:14	  Running: test.js...                                                             (1 of 5) 
...
11:19:50	We attempted to make an http request to this URL but the request failed without a response.
11:19:50	
11:19:50	We received this error at the network level:
11:19:50	
11:19:50	  &gt; Error: ESOCKETTIMEDOUT
...
11:20:08	Compiled successfully!
11:20:08	
11:20:08	You can now view App in the browser.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.