knex-timemachine

Knex Timemachine

Usage no npm install needed!

<script type="module">
  import knexTimemachine from 'https://cdn.skypack.dev/knex-timemachine';
</script>

README

knex-timemachine

Simple library for automatically rollbacking knex transactions at the end of an automated test.

Example usage:

let knexTimemachine = new (require('knex-timemachine'));

<...>

var oldKnex = daoObject.getKnex(); beforeEach(function (done) { knexTimemachine.startTransaction(done, oldKnex, [daoObject]); });

afterEach(function (done) { knexTimemachine.rollbackTransaction(done, oldKnex); });