A Lerna mono repo which contains:
- sql-watch - a command line utility that enables rapid SQL development by watching and automatically running idempotent SQL script on file change.
- sql-watch-lib - a library that supports rapid SQL development by watching and automatically running idempotent SQL script on file change.
See sql-watch for documentation.
Development requirements:
- Node + Yarn
- Docker
- MacOs (TODO: Verify development works for windows)
# init
yarn
# Provides Postgresql instance to run integration tests against
# yarn docker:up --detach
yarn docker:up
# continuously build typescript projects
yarn build:watch
# continuously run integration tests
yarn test:integration:watch
# need to cleanup?
yarn docker:destroy
sql-watch
works closely with Postgresql: executing sql directly in Postgresql. sql-watch
also creates files.
It's essential, then, to test sql-watch
and how it interacts with the operating system file system and Postgresql server (more sql flavors supported in the future). We leverage integration tests to assure feature coverage.
Instead of mocking and unit tests, we prefer integration tests monitoring for the following side effects:
- Check for any created files
- Check logging output
- Check for updates to the
sql-watch
state tables:sql_watch.environment
andsql-watch.run
. - Check for expected changes to the database
Every test has a basic structure:
- Verify the initial state of the test. For example, no file exists
- Run the test
- Verify the final state
That isn't to say we don't value mocking and unit tests. We leverage these tools for robustness.
Licensed under MIT.