Closed
Description
v3.4.1
CircleCI Mac build https://circleci.com/gh/cypress-io/cypress-example-kitchensink/3565#usage-queue/containers/0 with
executors:
mac:
macos:
xcode: "10.1.0"
environment:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
bash-3.2$ echo $CYPRESS_CACHE_FOLDER
~/.cache/Cypress
bash-3.2$ echo ~
/Users/distiller
But
bash-3.2$ npx cypress cache path
/Users/distiller/project/~/.cache/Cypress
With logs
bash-3.2$ DEBUG=cypress:cli npx cypress cache path
cypress:cli cli starts with arguments ["/usr/local/Cellar/node/11.0.0/bin/node","/Users/distiller/project/node_modules/.bin/cypress","cache","path"] +0ms
cypress:cli NODE_OPTIONS is not set +0ms
cypress:cli program parsing arguments +4ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +2ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +1ms
cypress:cli using environment variable CYPRESS_CACHE_FOLDER ~/.cache/Cypress +0ms
/Users/distiller/project/~/.cache/Cypress
Same with cypress cache list
DEBUG=cypress:cli npx cypress cache list
cypress:cli cli starts with arguments ["/usr/local/Cellar/node/11.0.0/bin/node","/Users/distiller/project/node_modules/.bin/cypress","cache","list"] +0ms
cypress:cli NODE_OPTIONS is not set +0ms
cypress:cli program parsing arguments +4ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +2ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +0ms
cypress:cli using environment variable CYPRESS_CACHE_FOLDER ~/.cache/Cypress +0ms
Unhandled rejection Error: ENOENT: no such file or directory, scandir '/Users/distiller/project/~/.cache/Cypress'
and cypress verify
bash-3.2$ DEBUG=cypress:cli npx cypress verify
cypress:cli cli starts with arguments ["/usr/local/Cellar/node/11.0.0/bin/node","/Users/distiller/project/node_modules/.bin/cypress","verify"] +0ms
cypress:cli NODE_OPTIONS is not set +0ms
cypress:cli program parsing arguments +4ms
cypress:cli parsed cli options {} +2ms
cypress:cli verifying Cypress app +0ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +92ms
cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable +0ms
cypress:cli using environment variable CYPRESS_CACHE_FOLDER ~/.cache/Cypress +0ms
cypress:cli checking environment variables +1ms
cypress:cli checking if executable exists /Users/distiller/project/~/.cache/Cypress/3.4.1/Cypress.app/Contents/MacOS/Cypress +5ms
The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /Users/distiller/project/~/.cache/Cypress/3.4.1/Cypress.app/Contents/MacOS/Cypress
To recreate the problem locally, set the environment variable like this as a string
export CYPRESS_CACHE_FOLDER='~/.cache/Cypress'
We should handle ~/...
in the CYPRESS_CACHE_FOLDER
and resolve it as an absolute path if possible.
Activity
bahmutov commentedon Oct 16, 2019
The problem is that when you say
CYPRESS_CACHE_FOLDER=~/...
in the terminal, the terminal's script resolves~
immediately. When you set it on CI as an environment variable, it is not resolved, and our CLI gets the literal string "~/..." which it thinks is a relative path.bahmutov commentedon Oct 16, 2019
As always, there is Sindre's module for this https://github.com/sindresorhus/untildify
bahmutov commentedon Oct 17, 2019
I had the same problem was initially on GitLab CI where
~
was not expandingcypress-bot commentedon Oct 17, 2019
The code for this is done in cypress-io/cypress#5393, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
5 remaining items