-
Notifications
You must be signed in to change notification settings - Fork 2
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
Staging env fallback for tests #91
Conversation
@@ -19,6 +19,7 @@ const { exec } = require('child_process'); | |||
const mergedEnv = { ...dotenv.parsed, ...process.env }; | |||
const command = process.argv | |||
.slice(2) | |||
.map((arg) => (arg.includes(' ') && `'${arg}'`) || arg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed as multi-word arguments with quotes are passed into node as a single array element with a space in between. The existence of a space means the argument needs to be re-quoted.
May have some adverse side-effects based on if the argument actually contains its own single quotes...
# Continuous Deployment for staging/production | ||
if [[ $TRAVIS_BRANCH == 'master' ]]; then | ||
if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then | ||
if [[ ! -z $STATIC_PROD_PROJECT ]] && [[ ! -z $STATIC_DEPLOY_KEY ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks are more granular and therefore preferred over the general $TRAVIS_SECURE_ENV_VARS
check removed above.
@@ -19,7 +19,7 @@ | |||
"preview:staging": "cross-env NODE_ENV=production yarn loadenv ./scripts/preview.sh", | |||
"setup": "./scripts/setup.js", | |||
"test": "yarn test:unit && yarn test:cypress", | |||
"test:cypress": "start-server-and-test 'yarn preview:staging > /dev/null' 3000 'cypress run'", | |||
"test:cypress": "yarn loadenv yarn start-server-and-test '[ -z %STATIC_STAGE_PROJECT ] && yarn preview:production > /dev/null || yarn preview:staging > /dev/null' 3000 'cypress run'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is a little messy right now. May be best to migrate into scripts/
as a separate file later on...
Resolves #90