diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js index 934b2970c..7a1905742 100644 --- a/chrome/content/zotero/xpcom/quickCopy.js +++ b/chrome/content/zotero/xpcom/quickCopy.js @@ -38,6 +38,10 @@ Zotero.QuickCopy = new function() { // Load code for selected export translator ahead of time // (in the background, because it requires translator initialization) _initTimeoutID = setTimeout(() => { + // Avoid random translator initialization during tests, which can result in timeouts, + // if an export format is selected + if (Zotero.test) return; + _initTimeoutID = null; _initPromise = _loadOutputFormat().then(() => _initPromise = null); }, 5000); diff --git a/chrome/content/zotero/xpcom/translation/translators.js b/chrome/content/zotero/xpcom/translation/translators.js index cb0b945e5..d8b2d2979 100644 --- a/chrome/content/zotero/xpcom/translation/translators.js +++ b/chrome/content/zotero/xpcom/translation/translators.js @@ -43,11 +43,6 @@ Zotero.Translators = new function() { * available (e.g., in updateBundledFiles()), to avoid unnecesary file reads */ this.reinit = Zotero.Promise.coroutine(function* (options = {}) { - // Travis debugging - Zotero.Debug.init(true); - Zotero.debug(new Error().stack); - Zotero.Debug.init(); - // Wait until bundled files have been updated, except when this is called by the schema update // code itself if (!options.fromSchemaUpdate) { diff --git a/test/tests/quickCopyTest.js b/test/tests/quickCopyTest.js index 63365892c..6f4b7d298 100644 --- a/test/tests/quickCopyTest.js +++ b/test/tests/quickCopyTest.js @@ -1,6 +1,16 @@ describe("Zotero.QuickCopy", function() { - var quickCopyPref = Zotero.Prefs.get("export.quickCopy.setting"); - quickCopyPref = JSON.stringify(Zotero.QuickCopy.unserializeSetting(quickCopyPref)); + var quickCopyPref; + var prefName = "export.quickCopy.setting"; + + before(function () { + Zotero.Prefs.clear(prefName); + quickCopyPref = Zotero.Prefs.get(prefName); + quickCopyPref = JSON.stringify(Zotero.QuickCopy.unserializeSetting(quickCopyPref)); + }); + + afterEach(function () { + Zotero.Prefs.clear(prefName); + }); // TODO: These should set site-specific prefs and test the actual response against it, // but that will need to wait for 5.0. For now, just make sure they don't fail. @@ -44,7 +54,7 @@ describe("Zotero.QuickCopy", function() { var translatorID = '9cb70025-a888-4a29-a210-93ec52da40d4'; // BibTeX var format = 'export=' + translatorID; - Zotero.Prefs.set('export.quickCopy.setting', format); + Zotero.Prefs.set(prefName, format); // Translator code for selected format is loaded automatically, so wait for it var translator = Zotero.Translators.get(translatorID); while (!translator.code) {