Allow overriding startup options in Zotero.reinit()

And use it in resetDB() test support function, mainly to allow
skipBundledFiles for resetDB calls. Translator installation and
initialization can take a long time, but tests that need a clean DB
don't necessarily rely on translators. Without this, running resetDB()
in beforeEach() for many tests is prohibitively slow.
This commit is contained in:
Dan Stillman 2015-07-19 17:58:58 -04:00
parent 9d0d79c9c2
commit 02cd71ebb5
2 changed files with 10 additions and 4 deletions

View file

@ -186,13 +186,16 @@ ZoteroContext.prototype = {
* then reinitializes Zotero. Returns a promise that is resolved
* when this process completes.
*/
"reinit":function(cb, isConnector) {
"reinit":function(cb, isConnector, options = {}) {
Services.obs.notifyObservers(zContext.Zotero, "zotero-before-reload", isConnector ? "connector" : "full");
return zContext.Zotero.shutdown().then(function() {
return cb ? cb() : false;
}).finally(function() {
makeZoteroContext(isConnector);
zContext.Zotero.init(zInitOptions);
var o = {};
Object.assign(o, zInitOptions);
Object.assign(o, options);
zContext.Zotero.init(o);
});
}
};