cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.66k stars 3.16k forks source link

Invoke binary directly warning showing always from `cypress verify` (debug mode) #6101

Open tohjustin opened 4 years ago

tohjustin commented 4 years ago

While trying to debug an issue w/ cypress verify getting stuck occasionally (related #6082), I'm getting the following stdout message from running cypress verify in debug mode (via DEBUG=cypress:* yarn cypress verify)

"It looks like you are running the Cypress binary directly. This is not the recommended approach, and Cypress may not work correctly."

Is this is an expected output from the smoke-test?

Current behavior:

❯ DEBUG=cypress:* npx cypress@latest verify
  cypress:cli installing Cypress from NPM +0ms
  cypress:cli installing with options {} +0ms
  cypress:cli version in package.json is 3.8.1 +1ms
  cypress:cli Reading binary package.json from: /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/package.json +0ms
  cypress:cli no binary installed under cli version +4ms
  cypress:cli checking local file /Users/*********/.npm/_npx/47203/lib/3.8.1 cwd /Users/*********/.npm/_npx/47203/lib/node_modules/cypress +0ms
  cypress:cli preparing to download and unzip version  3.8.1 to path /Users/*********/Library/Caches/Cypress/3.8.1 +0ms
  cypress:cli needed Cypress version: 3.8.1 +0ms
  cypress:cli source url https://download.cypress.io/desktop/3.8.1?platform=darwin&arch=x64 +0ms
  cypress:cli downloading cypress.zip to "/var/folders/ds/cwtxfpmd76z4r_g__8r94tbc0000gn/T/cypress.zip" +0ms
  cypress:cli Downloading package { url:
   'https://download.cypress.io/desktop/3.8.1?platform=darwin&arch=x64',
  proxy: null,
  downloadDestination:
   '/var/folders/ds/cwtxfpmd76z4r_g__8r94tbc0000gn/T/cypress.zip' } +1ms
  cypress:cli redirect version: 3.8.1 +341ms
  cypress:cli expected checksum 64ba19b0fe70e5b4eda6dad53c16a8de0234a09871462c510f8e44e5226e5bf17bcbbb87051117aba114bca0f1e875be3ebe1331d4376e8c9f30dac9e11c3c5e +136ms
  cypress:cli expected file size 167102535 +0ms
  cypress:cli downloading finished +6s
  cypress:cli verifying checksum and file size +1ms
  cypress:cli downloaded file has the expected checksum and size ✅ +505ms
  cypress:cli finished downloading file: /var/folders/ds/cwtxfpmd76z4r_g__8r94tbc0000gn/T/cypress.zip +7s
  cypress:cli:unzip unzipping from /var/folders/ds/cwtxfpmd76z4r_g__8r94tbc0000gn/T/cypress.zip +0ms
  cypress:cli:unzip into /Users/*********/Library/Caches/Cypress/3.8.1 +0ms
  cypress:cli:unzip zipFile entries count 40147 +7ms
  cypress:cli:unzip unzipping via `ditto` +0ms
  cypress:cli:unzip unzip completed { yauzlMs: 7, unzipMs: 26116 } +26s
  cypress:cli removing zip file /var/folders/ds/cwtxfpmd76z4r_g__8r94tbc0000gn/T/cypress.zip +26s
  cypress:cli finished installation in /Users/*********/Library/Caches/Cypress/3.8.1 +17ms
  cypress:cli:cli cli starts with arguments ["/usr/local/bin/node","/Users/*********/.npm/_npx/47203/bin/cypress","verify"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +3ms
  cypress:cli parsed cli options {} +3ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app/Contents/MacOS/Cypress +2ms
  cypress:cli Binary is executable? : true +1ms
  cypress:cli binaryDir is  /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app +0ms
  cypress:cli Reading binary package.json from: /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/package.json +0ms
  cypress:cli Found binary version 3.8.1 installed in: /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app +3ms
  cypress:cli could not read binary_state.json file +3ms
  cypress:cli {} +0ms
  cypress:cli is Verified ? undefined +1ms
  cypress:cli force verify +0ms
  cypress:cli running binary verification check 3.8.1 +0ms
It looks like this is your first time using Cypress: 3.8.1
  cypress:cli clearing out the verified version +3ms
  cypress:cli needs Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +1ms
  cypress:cli disabling Electron sandbox +0ms
  cypress:cli running smoke test +0ms
  cypress:cli using Cypress executable /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app/Contents/MacOS/Cypress +0ms
  cypress:cli smoke test command: /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=965 +0ms
  cypress:cli smoke test timeout 30000 ms +0ms
 ⠴  Verifying Cypress can run /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app
  cypress:cli smoke test stdout "It looks like you are running the Cypress binary directly.

This is not the recommended approach, and Cypress may not work correctly.

Please install the 'cypress' NPM package and follow the instructions here:

https://on.cypress.io/installing-cypress
965" +2s
  cypress:cli write verified: true +1ms
 ✔  Verified Cypress! /Users/*********/Library/Caches/Cypress/3.8.1/Cypress.app

Desired behavior:

I did a little digging myself & here what I've found:

Based on the findings above, I "believe" this is what's happening under the hood:

Steps to reproduce:

  1. Open a terminal
  2. Run DEBUG=cypress:* npx cypress@latest verify (getting the same output if one were to run DEBUG=cypress:* yarn cypress verify in their project directory)

Versions

Node@LTS (v12.14.0) Cypress@latest (v3.8.1) macOS High Sierra (v10.13.6)

jennifer-shehane commented 4 years ago

Yeah, this message is harmless, but nonetheless confusing in this context. We shouldn't show this message when we know we are running our own smoke test.

tohjustin commented 4 years ago

Okay, thanks for clarifying this! 🙏

letthepandacode commented 2 years ago

I tried this command after the error.

npx cypress open

Cypress opened successfully

MikeMcC399 commented 1 year ago