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);
}
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);
}
catch (e) {
Components.utils.reportError(e);
Zotero.debug("Error running pdftotext", 1);
Zotero.debug(e, 1);
Zotero.debug("Error running " + exec.path, 1);
Zotero.logError(e);
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
* any that were set at startup
*/
function resetDB(options = {}) {
async function resetDB(options = {}) {
// Hack to avoid CustomizableUI warnings in console from icon.js
var toolbarIconAdded = Zotero.toolbarIconAdded;
resetPrefs();
@ -575,18 +575,17 @@ function resetDB(options = {}) {
options.thisArg.timeout(60000);
}
var db = Zotero.DataDirectory.getDatabase();
return Zotero.reinit(
await Zotero.reinit(
Zotero.Promise.coroutine(function* () {
yield OS.File.remove(db);
_defaultGroup = null;
}),
false,
options
)
.then(() => {
);
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
// (until we figure out a better way)
win = yield loadBrowserWindow();
initPDFToolsPath();
});
after(function () {
if (win) {

View file

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