Reset PDF tools path for tests in resetDB()

And include path on error when running PDF tool
This commit is contained in:
Dan Stillman 2018-02-05 23:09:17 -05:00
parent 06fb74aafd
commit 45ddf9827c
4 changed files with 10 additions and 13 deletions

View File

@ -446,7 +446,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
var totalPages = yield getTotalPagesFromFile(itemID); var totalPages = yield getTotalPagesFromFile(itemID);
} }
catch (e) { catch (e) {
Zotero.debug("Error running pdfinfo"); Zotero.debug("Error running " + _pdfInfo.path, 1);
Zotero.logError(e);
} }
@ -468,9 +469,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
yield Zotero.Utilities.Internal.exec(exec, args); yield Zotero.Utilities.Internal.exec(exec, args);
} }
catch (e) { catch (e) {
Components.utils.reportError(e); Zotero.debug("Error running " + exec.path, 1);
Zotero.debug("Error running pdftotext", 1); Zotero.logError(e);
Zotero.debug(e, 1);
return false; return false;
} }

View File

@ -566,7 +566,7 @@ var removeDir = Zotero.Promise.coroutine(function* (dir) {
* @param {Object} [options] - Initialization options, as passed to Zotero.init(), overriding * @param {Object} [options] - Initialization options, as passed to Zotero.init(), overriding
* any that were set at startup * any that were set at startup
*/ */
function resetDB(options = {}) { async function resetDB(options = {}) {
// Hack to avoid CustomizableUI warnings in console from icon.js // Hack to avoid CustomizableUI warnings in console from icon.js
var toolbarIconAdded = Zotero.toolbarIconAdded; var toolbarIconAdded = Zotero.toolbarIconAdded;
resetPrefs(); resetPrefs();
@ -575,18 +575,17 @@ function resetDB(options = {}) {
options.thisArg.timeout(60000); options.thisArg.timeout(60000);
} }
var db = Zotero.DataDirectory.getDatabase(); var db = Zotero.DataDirectory.getDatabase();
return Zotero.reinit( await Zotero.reinit(
Zotero.Promise.coroutine(function* () { Zotero.Promise.coroutine(function* () {
yield OS.File.remove(db); yield OS.File.remove(db);
_defaultGroup = null; _defaultGroup = null;
}), }),
false, false,
options options
) );
.then(() => {
Zotero.toolbarIconAdded = toolbarIconAdded; Zotero.toolbarIconAdded = toolbarIconAdded;
return Zotero.Schema.schemaUpdatePromise; await Zotero.Schema.schemaUpdatePromise;
}); initPDFToolsPath();
} }
/** /**

View File

@ -5,7 +5,6 @@ describe("Zotero.Fulltext", function () {
// Hidden browser, which requires a browser window, needed for charset detection // Hidden browser, which requires a browser window, needed for charset detection
// (until we figure out a better way) // (until we figure out a better way)
win = yield loadBrowserWindow(); win = yield loadBrowserWindow();
initPDFToolsPath();
}); });
after(function () { after(function () {
if (win) { if (win) {

View File

@ -9,7 +9,6 @@ describe("PDF Recognition", function() {
yield Zotero.Promise.all([ yield Zotero.Promise.all([
loadZoteroPane().then(w => win = w) loadZoteroPane().then(w => win = w)
]); ]);
initPDFToolsPath();
}); });
beforeEach(function* () { beforeEach(function* () {