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

npm run test-e2e fails / CONTRIBUTING.md directions incomplete or incorrect #542

Closed
joshsleeper opened this issue Apr 20, 2018 · 14 comments
Closed

Comments

@joshsleeper
Copy link

joshsleeper commented Apr 20, 2018

goal

to submit a minor documentation pull request.

CONTRIBUTING.md asks that I actually use cypress to test the documentation before I submit the pr, so I was attempting to do so as detailed and ran into an issue.

repro steps

  1. fork cypress-documentation
  2. make and commit minor change
  3. npm install
  4. npm run build
  5. npm start
  6. visit localhost:2222 in my browser
  7. stop the running npm start process in preparation to run npm run test-e2e
    • note: successful up until here, doc change looks great when viewed in the browser
  8. npm run test-e2e

what I expected to happen

cypress would start an node server to test against, and then execute cypress (which was installed correctly in step 3 above, mind you) against that node server to test.

what happened instead

[admin@localhost cypress-documentation]$ npm run test-e2e

> [email protected] test-e2e /home/admin/repos/cypress-documentation
> start-server-and-test start http://localhost:2222 cypress:run

starting server using command "npm run start"
and when url "http://localhost:2222" is responding
running tests using command "cypress:run"

> [email protected] start /home/admin/repos/cypress-documentation
> node --stack-size=8192 ./index.js server --port 2222

disabling filter cleanup for environment development
in environment development site url is https://docs.cypress.io
NODE_ENV is: development
INFO  Start processing
Request to: https://www.cypress.io/about timed out. Ignoring this error and proceeding. Waited for 15582ms.
Request to: https://nodejs.org/api/events.html#events_emitter_on_eventname_listener timed out. Ignoring this error and proceeding. Waited for 13176ms.
Request to: http://globtester.com/ timed out. Ignoring this error and proceeding. Waited for 12560ms.
Request to: https://travis-ci.org/ timed out. Ignoring this error and proceeding. Waited for 11737ms.
Request to: http://karma-runner.github.io/ timed out. Ignoring this error and proceeding. Waited for 10964ms.
Request to: https://github.com/mochajs/mochajs.github.io/blob/master/index.md#root-level-hooks timed out. Ignoring this error and proceeding. Waited for 10831ms.
Request to: http://api.jquery.com/eq timed out. Ignoring this error and proceeding. Waited for 15632ms.
Request to: http://api.jquery.com/prevAll timed out. Ignoring this error and proceeding. Waited for 15626ms.
Request to: http://api.jquery.com/last timed out. Ignoring this error and proceeding. Waited for 15629ms.
Request to: http://chaijs.com/ timed out. Ignoring this error and proceeding. Waited for 10962ms.
Request to: http://sinonjs.org/releases/v2.0.0/sandbox/ timed out. Ignoring this error and proceeding. Waited for 10964ms.
Request to: https://on.cypress.io/contributing timed out. Ignoring this error and proceeding. Waited for 12121ms.
Request to: http://mochajs.org/#bdd timed out. Ignoring this error and proceeding. Waited for 13780ms.
Request to: https://github.com/michaelleeallen/mocha-junit-reporter timed out. Ignoring this error and proceeding. Waited for 12122ms.
Request to: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support timed out. Ignoring this error and proceeding. Waited for 12087ms.
Request to: https://github.com/visionmedia/debug timed out. Ignoring this error and proceeding. Waited for 12020ms.
Request to: https://github.com/cypress-io/cypress-webpack-preprocessor timed out. Ignoring this error and proceeding. Waited for 11367ms.
Request to: https://www.w3.org/TR/html5/editing.html#focusable failed.
Error: socket hang up
    at createHangUpError (_http_client.js:336:15)
    at TLSSocket.socketOnEnd (_http_client.js:429:23)
    at TLSSocket.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1106:12)
    at process._tickCallback (internal/process/next_tick.js:178:19)
From previous event:
    at validateExternalUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:115:9)
    at Object.validateAndGetUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:273:12)
    at Object.getUrlProps (/home/admin/repos/cypress-documentation/lib/tags/url.js:14:23)
    at Promise.resolve.then (/home/admin/repos/cypress-documentation/lib/tags/url.js:88:24)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
StatusCodeError: 404 - ""
    at new StatusCodeError (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/errors.js:32:15)
    at /home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:97:41
From previous event:
    at Request.plumbing.init (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:36:28)
    at Request.RP$initInterceptor [as init] (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/configure/request2.js:41:27)
    at new Request (/home/admin/repos/cypress-documentation/node_modules/request/request.js:128:8)
    at request (/home/admin/repos/cypress-documentation/node_modules/request/index.js:53:10)
    at validateExternalUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:98:10)
    at Object.validateAndGetUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:273:12)
    at Object.getUrlProps (/home/admin/repos/cypress-documentation/lib/tags/url.js:14:23)
    at Promise.resolve.then (/home/admin/repos/cypress-documentation/lib/tags/url.js:88:24)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
Request to: https://code.visualstudio.com/ timed out. Ignoring this error and proceeding. Waited for 14286ms.
Request to: https://docs.travis-ci.com/user/uploading-artifacts/ timed out. Ignoring this error and proceeding. Waited for 6997ms.
Request to: https://appveyor.com/ timed out. Ignoring this error and proceeding. Waited for 10187ms.
Request to: https://www.w3.org/TR/html/infrastructure.html#sec-dates timed out. Ignoring this error and proceeding. Waited for 42589ms.
Request to: https://www.docker.com/ timed out. Ignoring this error and proceeding. Waited for 6381ms.
StatusCodeError: 404 - ""
    at new StatusCodeError (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/errors.js:32:15)
    at /home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:97:41
From previous event:
    at Request.plumbing.init (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:36:28)
    at Request.RP$initInterceptor [as init] (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/configure/request2.js:41:27)
    at new Request (/home/admin/repos/cypress-documentation/node_modules/request/request.js:128:8)
    at request (/home/admin/repos/cypress-documentation/node_modules/request/index.js:53:10)
    at validateExternalUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:98:10)
    at Object.validateAndGetUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:273:12)
    at Object.getUrlProps (/home/admin/repos/cypress-documentation/lib/tags/url.js:14:23)
    at Promise.resolve.then (/home/admin/repos/cypress-documentation/lib/tags/url.js:88:24)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
StatusCodeError: 404 - ""
    at new StatusCodeError (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/errors.js:32:15)
    at /home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:97:41
From previous event:
    at Request.plumbing.init (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/lib/plumbing.js:36:28)
    at Request.RP$initInterceptor [as init] (/home/admin/repos/cypress-documentation/node_modules/request-promise-core/configure/request2.js:41:27)
    at new Request (/home/admin/repos/cypress-documentation/node_modules/request/request.js:128:8)
    at request (/home/admin/repos/cypress-documentation/node_modules/request/index.js:53:10)
    at validateExternalUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:98:10)
    at Object.validateAndGetUrl (/home/admin/repos/cypress-documentation/lib/url_generator.js:273:12)
    at Object.getUrlProps (/home/admin/repos/cypress-documentation/lib/tags/url.js:14:23)
    at Promise.resolve.then (/home/admin/repos/cypress-documentation/lib/tags/url.js:88:24)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
Request to: http://socket.io/ timed out. Ignoring this error and proceeding. Waited for 5003ms.
Request to: https://www.w3.org/TR/html/infrastructure.html#valid-week-string timed out. Ignoring this error and proceeding. Waited for 187408ms.
INFO  Hexo is running at http://localhost:2222. Press Ctrl+C to stop.

> [email protected] cypress:run /home/admin/repos/cypress-documentation
> cypress run

No version of Cypress is installed.

Please reinstall Cypress by running: cypress install
----------

Cypress executable not found at: /home/admin/repos/cypress-documentation/node_modules/cypress/dist/Cypress/Cypress
----------

Platform: linux (Centos - 7.4.1708)
Cypress Version: 2.1.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cypress:run: `cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] cypress:run 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!     /home/admin/.npm/_logs/2018-04-20T00_06_45_432Z-debug.log
{ Error: Command failed: npm run cypress:run
    at makeError (/home/admin/repos/cypress-documentation/node_modules/start-server-and-test/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/home/admin/repos/cypress-documentation/node_modules/start-server-and-test/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
  code: 1,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd: 'npm run cypress:run',
  timedOut: false,
  killed: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-e2e: `start-server-and-test start http://localhost:2222 cypress: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!     /home/admin/.npm/_logs/2018-04-20T00_06_45_622Z-debug.log
@jennifer-shehane
Copy link
Member

Oh no! I am not running into this problem running npm run test-e2e.

I have seen this issue though if the Cypress install was interrupted at some point during npm i.

Can you try to run cypress install as described in the error message?

@joshsleeper
Copy link
Author

joshsleeper commented Apr 20, 2018

I did, and it doesn't seem able to find cypress.
which makes sense to me, since my understanding is that cypress should be installed only in the local node_modules, not in my homedir or anywhere that's actually in the path.

is that assumption correct/incorrect?

@jennifer-shehane
Copy link
Member

yeah, it should have been installed when running npm i under the root of this project. Could you try removing your node_modules and running npm i again?

@joshsleeper
Copy link
Author

joshsleeper commented Apr 20, 2018

I've done it already a few times, but it seems to consistently attempt to run cypress directly (as if it's in my PATH somewhere) instead of pathing to the installed one (e.g. ./node_modules/.bin/cypress)

that said, happy to try one more time!
wiping node_modules and I'll post an update shortly

@jennifer-shehane
Copy link
Member

Can you type which cypress to ensure it's trying to use the locally installed one at ./node_modules/.bin/cypress and not attempting to use a globally installed one?

@joshsleeper
Copy link
Author

npm install output

[admin@localhost cypress-documentation]$ npm install

> [email protected] install /home/admin/repos/cypress-documentation/node_modules/node-sass
> node scripts/install.js

Cached binary found at /home/admin/.npm/node-sass/4.7.2/linux-x64-59_binding.node

> [email protected] install /home/admin/repos/cypress-documentation/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/admin/repos/cypress-documentation/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1524249968258/phantomjs-2.1.1-linux-x86_64 -> /home/admin/repos/cypress-documentation/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/admin/repos/cypress-documentation/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs

> [email protected] install /home/admin/repos/cypress-documentation/node_modules/husky
> node lib/installer/bin install

husky > setting up git hooks
husky > done

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/nunjucks
> node postinstall-build.js src


> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/node-sass
> node scripts/build.js

Binary found at /home/admin/repos/cypress-documentation/node_modules/node-sass/vendor/linux-x64-59/binding.node
Testing binary
Binary is fine

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/cwebp-bin
> node lib/install.js

  ✔ cwebp pre-build test passed successfully

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/gifsicle
> node lib/install.js

  ✔ gifsicle pre-build test passed successfully

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/jpeg-recompress-bin
> node lib/install.js

  ✔ jpeg-recompress pre-build test passed successfully

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/jpegtran-bin
> node lib/install.js

  ✔ jpegtran pre-build test passed successfully

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/optipng-bin
> node lib/install.js

  ✔ optipng pre-build test passed successfully
(node:106253) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/cypress
> node index.js --exec install

Installing Cypress (version: 2.1.0)

 ✔  Downloaded Cypress
 ✔  Unzipped Cypress
 ✔  Finished Installation /home/admin/repos/cypress-documentation/node_modules/cypress/dist/Cypress

You can now open Cypress by running: node_modules/.bin/cypress open

https://on.cypress.io/installing-cypress

> [email protected] postinstall /home/admin/repos/cypress-documentation/node_modules/sinon
> node scripts/support-sinon.js

Have some ❤️ for Sinon? You can support the project via Open Collective:
 > https://opencollective.com/sinon/donate

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1682 packages in 107.468s

which cypress output

[admin@localhost cypress-documentation]$ which cypress
/usr/bin/which: no cypress in (/home/admin/.nvm/versions/node/v9.11.1/bin:/home/admin/.cargo/bin:/usr/lib64/qt-3.3/bin:/home/admin/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)

@joshsleeper
Copy link
Author

@jennifer-shehane any new thoughts on this?
I can only assume it works for you because you have cypress installed globally, thus when you run npm run test-e2e it's not actually using the cypress that was just installed

@jennifer-shehane
Copy link
Member

No, I definitely don't have cypress installed globally. It's installed per project since I work on 10+ projects with Cypress.

I have no idea why this is happening. We are using node 8.4.0 on this project, maybe that makes a difference? Although I can't see why that would be the case at all.

@joshsleeper
Copy link
Author

joshsleeper commented Apr 24, 2018

Huh, that is interesting then!

Curious, why would we expect cypress (presumably present at cypress-documentation/node_modules/.bin/cypress) to be a binary on the PATH?
Because that appears to be how it's attempting to call it.

@jennifer-shehane
Copy link
Member

This is just how Cypress install works currently. It downloads the Cypress app binary - no other deps needed to install and run. There has been some requests to allow this to be skipped cypress-io/cypress#1232

@joshsleeper
Copy link
Author

joshsleeper commented Apr 24, 2018

Sorry, maybe I was unclear, so I'll try to rephrase.

I'm aware that it "installs" cypress by downloading the binary, which makes perfect sense to me.

What I'm not clear about is why we would expect typing cypress into the terminal (aka, without a path to the downloaded cypress binary) to find the cypress binary. Without placing the binary on the PATH somewhere, I wouldn't expect any linux system to be able to find cypress.

Phrased differently, if I downloaded some other binary (say, curl) and put it in some random folder, I wouldn't expect calling curl at the terminal to have any clue as to where curl actually is.

What makes cypress any different in this context?
Is there something that's supposed to happen that makes that work different than I expect?

@jennifer-shehane
Copy link
Member

We don't type cypress into the terminal, we run npm run test-e2e command the which runs the npm script cypress:run.

@joshsleeper
Copy link
Author

joshsleeper commented Apr 24, 2018

Right, and that's all I'm doing too, but given that, which cypress (like you suggested I check) should never actually find cypress, given that it's not actually on the PATH at all.
I'm definitely only running npm run test-e2e, but something in the logs totally made it look like it was attempting to call cypress directly.
I'll chalk that up to a misinterpretation on my end, sorry for the wild goose chase~

THAT SAID...

So I switched to node 8.4.0 like you mentioned, did a git clean -ffxd and git reset --hard HEAD, and gave it one more shot.
Worked perfectly.

Cypress is found, tests all pass (as they should for a super minor markdown file edit), and everything is dandy.

Possible conclusion: it really is an issue with the node version I was using!

I'm going to follow the same process as I just did, switch back to the latest node 9.x release, and see if I encounter issues again.
If so, I'll close this issue out and open a new one for some apparent issue with node 9!

@joshsleeper
Copy link
Author

ugh, alright.
from scratch, node 9.11.1, and now everything works just fine.

I'm going to chalk it up to bad luck during install or a dumb error on my part I guess.

Sorry for the hassle/noise, but thanks for helping me recognize that I was the problem this time. ;)

PR is submitted as #547, and I'll go ahead and close this issue that wasn't really an issue at all!

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

Successfully merging a pull request may close this issue.

2 participants