Update translatorTester for translation server support

This commit is contained in:
Adomas Venčkauskas 2018-10-19 13:47:44 +03:00
parent 9d98f765b2
commit 5b3b1f0f1b

View file

@ -30,11 +30,7 @@ var EXPORTED_SYMBOLS = ["Zotero_TranslatorTesters"];
// For debugging specific translators by label
var includeTranslators = [];
try {
Zotero;
} catch(e) {
var Zotero;
}
this.Zotero = Zotero;
var Zotero_TranslatorTesters = new function() {
const TEST_TYPES = ["web", "import", "export", "search"];
@ -46,11 +42,13 @@ var Zotero_TranslatorTesters = new function() {
this.runAllTests = function (numConcurrentTests, skipTranslators, writeDataCallback) {
var id = Math.random() * (100000000 - 1) + 1;
waitForDialog();
if (!(typeof process === 'object' && process + '' === '[object process]')){
waitForDialog();
if(!Zotero) {
Zotero = Components.classes["@zotero.org/Zotero;1"]
.getService(Components.interfaces.nsISupports).wrappedJSObject;
if(!Zotero) {
Zotero = Components.classes["@zotero.org/Zotero;1"]
.getService(Components.interfaces.nsISupports).wrappedJSObject;
}
}
var testers = [];
@ -759,4 +757,8 @@ Zotero_TranslatorTester._generateDiff = new function() {
var txt = compare(a, b);
return txt.substr(0, txt.length-1);
};
};
};
if (typeof process === 'object' && process + '' === '[object process]'){
module.exports = Zotero_TranslatorTesters;
}