Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ericwooley
Last active August 20, 2017 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericwooley/969e2713d329662e1cb013f91fbc9d38 to your computer and use it in GitHub Desktop.
Save ericwooley/969e2713d329662e1cb013f91fbc9d38 to your computer and use it in GitHub Desktop.
scripts for api snapshotting
// package.json
// note that comments aren't typically allowed.
{
"scripts": {
// recreate the dev database
"initDB": "rm dev.sqlite3; knex migrate:latest; knex seed:run",
// recreate the integration database
"initIntegrationDB": "export DATABASE_FILE=integration.sqlite3; rm integration.sqlite3; knex migrate:latest; knex seed:run",
// start the service on port 3000
"start": "node index.js",
// Start the service on port 3200, and use integration.sqlite3
// for the database instead of dev.sqlite3
"start:integration": "export API_PORT=3200 DATABASE_FILE=integration.sqlite3; npm run start",
// run the integration test with jest
"jest:integration": "jest __tests__/api.integration.js",
// start the integration test as a script, which will start the service,
// run the tests, and kill the service, this doesn't exist yet, but it's at the end of the article
"test:integration": "node ./scripts/integrationTest.js"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment