i running several loopback tests via mocha (let's call them test1.js, test2.js , test3.js).
when run independently works well. however, when ask mocha run them all, things created in first test in in-memory db collide tests being done later on (test 2 or 3).
is there way ensure start each test empty db? like:
app.datasources.db.reset() thanks lot!
update: ended doing: looked @ datasource code , found can automigrate on memory db.
before("wipe db (if used other tests)", function(done) { app.datasources.db.automigrate(function(err) { done(err); }); });
get hold of db via app.datasources.db , execute automigrate in:
before("wipe db (if used other tests)", function(done) { app.datasources.db.automigrate(function(err) { done(err); }); }); cheers.
Comments
Post a Comment