There is a simple integration test suite that runs against Postgres, MySQL, Maria and sqlite.
It is located at test/integration
. The actual specs live in integration-specs.js
, and each of the database specific suites invoke these specs, passing in their database specific knex config.
Each database specific spec file can also have its own specs, postgres does this to test out array support for example.
sqlite is your friend, gulp test:integration:sqlite
is a quick easy way to run tests that hit an actual database. It should require no setup, just call it.
Docker containers provide the database engines. Getting these running is not too bad, but will take a while the first time.
- Install docker-compose -- these instructions also show how to install Docker, which you will also need.
- from the root of sql-fixtures, run
docker-compose up -d
- go get some coffee, this will take a long time the first time
Once the environment is up, you can run the tests with, where DOCKER_IP is localhost
on linux or whatever boot2docker ip
tells you for OSX (I've never tried any of this on Windows).
DOCKER_IP=<DOCKER_IP> DOCKER_PORT=15432 gulp test:integration:postgres
DOCKER_IP=<DOCKER_IP> DOCKER_PORT=13306 gulp test:integration:mysql
DOCKER_IP=<DOCKER_IP> DOCKER_PORT=13307 gulp test:integration:maria
To clean up the containers docker-compose is managing: docker-compose stop && docker-compose rm
To clean up all Docker containers: docker rm $(docker ps -q -a)
you may need to add -f
flag to force the clean up if some containers are still running.
- docker-compose up -d
node-inspector
DOCKER_IP=<host ip> DOCKER_PORT=<port> node --debug-brk $(which gulp) test:integration:<postgres, mysql or maria>
- see above section for database specific values
- Head to node-inspector and debug as usual.