diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index bac943f16..574f3ff7b 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1139,9 +1139,9 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); this.getDefaultDataDir = function () { - // Keep data directory siloed within profile directory for tests + // Use special data directory for tests if (Zotero.test) { - return OS.Path.join(OS.Constants.Path.profileDir, "test-data-dir"); + return OS.Path.join(OS.Path.dirname(OS.Constants.Path.profileDir), "Zotero"); } return OS.Path.join(OS.Constants.Path.homeDir, ZOTERO_CONFIG.CLIENT_NAME); }; diff --git a/test/runtests.sh b/test/runtests.sh index 4cc68f4ac..bdf24da95 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -98,8 +98,9 @@ fi ulimit -n 4096 # Set up profile directory -PROFILE="`mktemp -d 2>/dev/null || mktemp -d -t 'zotero-unit'`" -mkdir "$PROFILE/extensions" +TEMPDIR="`mktemp -d 2>/dev/null || mktemp -d -t 'zotero-unit'`" +PROFILE="$TEMPDIR/profile" +mkdir -p "$PROFILE/extensions" makePath ZOTERO_UNIT_PATH "$CWD" echo "$ZOTERO_UNIT_PATH" > "$PROFILE/extensions/zotero-unit@zotero.org" @@ -108,7 +109,7 @@ makePath ZOTERO_PATH "`dirname "$CWD"`" echo "$ZOTERO_PATH" > "$PROFILE/extensions/zotero@chnm.gmu.edu" # Create data directory -mkdir "$PROFILE/zotero" +mkdir "$TEMPDIR/Zotero" cat < "$PROFILE/prefs.js" user_pref("extensions.autoDisableScopes", 0); @@ -139,7 +140,7 @@ if [ "$TRAVIS" = true ]; then fi # Clean up on exit -trap "{ rm -rf \"$PROFILE\"; }" EXIT +trap "{ rm -rf \"$TEMPDIR\"; }" EXIT makePath FX_PROFILE "$PROFILE" MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$FX_EXECUTABLE" -profile "$FX_PROFILE" \ diff --git a/test/tests/zoteroTest.js b/test/tests/zoteroTest.js index 0bd6289ce..8a8aad504 100644 --- a/test/tests/zoteroTest.js +++ b/test/tests/zoteroTest.js @@ -38,6 +38,8 @@ describe("Zotero Core Functions", function () { }); beforeEach(function* () { + // Trigger a call to setDataDirectory() now to avoid affecting the stub call count + Zotero.getZoteroDirectory(); stub1 = sinon.stub(Zotero, "setDataDirectory"); });