Skip to content

Instantly share code, notes, and snippets.

@nichoth
Created February 7, 2019 19:01
Show Gist options
  • Save nichoth/49d411b951f12dfdc677a82b426db3a8 to your computer and use it in GitHub Desktop.
Save nichoth/49d411b951f12dfdc677a82b426db3a8 to your computer and use it in GitHub Desktop.
Cypress + CI using package.json scripts
{
"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",
}
}
@nichoth
Copy link
Author

nichoth commented Feb 7, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment