Skip to content

Instantly share code, notes, and snippets.

Last active Aug 20, 2017
What would you like to do?
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