Massively speed up tests

- Make a copy of the database after first initialization that can be
  swapped in when reinitializing in resetDB()
- Avoid unnecessary one-second delay on every reset

Probably more that can be done, but this should take minutes off the
test runs
This commit is contained in:
Dan Stillman 2021-06-24 06:07:33 -04:00
parent 88280641ac
commit f80ba89971
4 changed files with 20 additions and 15 deletions

View file

@ -623,10 +623,11 @@ async function resetDB(options = {}) {
}
var db = Zotero.DataDirectory.getDatabase();
await Zotero.reinit(
Zotero.Promise.coroutine(function* () {
yield OS.File.remove(db);
async function () {
// Swap in the initial copy we made of the DB
await OS.File.copy(db + '-test-template', db);
_defaultGroup = null;
}),
},
false,
options
);