@threadbase-sh/scanner 0.14.5 → 0.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3114,8 +3114,18 @@ var IndexQueue = class {
3114
3114
  // src/scanner.ts
3115
3115
  var BATCH_SIZE2 = 12;
3116
3116
  var DEFAULT_CONFIG_PATH = "~/.config/threadbase-scanner";
3117
+ function isTestProcess() {
3118
+ return Boolean(process.env.VITEST) || Boolean(process.env.JEST_WORKER_ID) || process.env.NODE_ENV === "test";
3119
+ }
3117
3120
  function defaultDbPath() {
3118
- return process.env.TB_SCANNER_DB ?? (0, import_path11.join)((0, import_os2.homedir)(), ".config", "threadbase-scanner", "index.db");
3121
+ const override = process.env.TB_SCANNER_DB;
3122
+ if (override) return override;
3123
+ if (isTestProcess()) {
3124
+ throw new Error(
3125
+ "TB_SCANNER_DB must be set under a test runner. Refusing to open the default index at ~/.config/threadbase-scanner/index.db, because test fixtures written there are indistinguishable from real conversations and corrupt every measurement of the index. Point it at a temp directory in your test setup, or pass persistent.dbPath explicitly."
3126
+ );
3127
+ }
3128
+ return (0, import_path11.join)((0, import_os2.homedir)(), ".config", "threadbase-scanner", "index.db");
3119
3129
  }
3120
3130
  function capForMemory(doc, max) {
3121
3131
  const combined = combineSearchContent(doc);