Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Set up knex db-manager #130

Open
zkwsk opened this issue Jul 20, 2020 · 2 comments
Open

Set up knex db-manager #130

zkwsk opened this issue Jul 20, 2020 · 2 comments

Comments

@zkwsk
Copy link
Contributor

zkwsk commented Jul 20, 2020

Set up knex-db-manager to make it easy to truncate the database from npm scripts. Replace the db:clean job that is currently relying on migrations with truncating the DB. Alter the test that is using db:clean to test the it is possible to migrate down to use knex db:migrate down instead.

Reason being that while developing migrations locally, you can easily end up in an inconsistent state (your up and down migrations did not actually match) so the recommended practice is to truncate before each run locally.

https://github.com/Vincit/knex-db-manager

@senner007
Copy link

What would be the best approach to do testing with knex? I understand that the knex-manager can clear the database on each setup and teardown, but what about the time penalty after say a 100 tests using this approach. You could create stubs to replace the db, but it wouldn't be the same.

@senner007
Copy link

I made a setup using knex manager and parallel thread testing with docker and jest.
Here
https://github.com/senner007/Simple-api-with-parallel-integration-tests

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants