Last active
August 20, 2017 20:33
-
-
Save ericwooley/969e2713d329662e1cb013f91fbc9d38 to your computer and use it in GitHub Desktop.
scripts for api snapshotting
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
// 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