Created
February 7, 2019 19:01
-
-
Save nichoth/49d411b951f12dfdc677a82b426db3a8 to your computer and use it in GitHub Desktop.
Cypress + CI using package.json scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"start": "node-sass src/style/main.scss --source-map-embed > public/style.css && concurrently --kill-others \"npm run serve\" \"npm run sass-watch\"", | |
"serve": "env $(cat .env | xargs) VERSION=`cat package.json | json version` budo src/index.js:bundle.js --pushstate --dir=public --live -- -t babelify -g aliasify -t [ envify --NODE_ENV development ] -dv", | |
"cypress-ci": "start-server-and-test start http://localhost:9966 cy:run", | |
"cy:run": "cypress run --config baseUrl=\"http://localhost:9966\"" | |
}, | |
"devDependencies": { | |
"start-server-and-test": "^1.7.11", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
start-server-and-test
command takes an npm script as the first arg, which is 'start' here. This command should start our server. Once the URL, the next arg is available, then it will run the last arg,cy:run
.start
in this case starts budo, it is the same command we use as a local dev server.start-server-and-test
handles creating and terminating our server and test processes in the right order, and exiting with the right code.