jsmorabito_obsidian-commander/vitest.config.ts
johnny1093 4c18a66984 lint: scope Node/mobile-compat rules off test and config files, tidy up a few regressions
- no-nodejs-modules, no-global-this, and prefer-create-el only exist
  to protect the shipped mobile bundle; scope them off for
  eslint.config.mts, vitest.config.ts, and src/__tests__/** since none
  of that runs inside Obsidian.
- Fix vitest.config.ts's __dirname the same way eslint.config.mts
  already was (fileURLToPath(import.meta.url)), since __dirname isn't
  defined under ESM.
- Disable no-empty-function (with a description) on the two
  intentionally-empty open()/close() mock methods introduced earlier.
- Drop the now-unused `error` catch binding left over from removing
  its console.log in an earlier commit.
2026-07-11 09:55:13 -04:00

29 lines
639 B
TypeScript

import { defineConfig } from "vitest/config";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
test: {
environment: "jsdom",
globals: false,
setupFiles: ["src/__tests__/setup.ts"],
},
resolve: {
alias: [
{
find: "obsidian",
replacement: path.resolve(__dirname, "src/__tests__/__mocks__/obsidian.ts"),
},
{
find: /.*\/l10n$/,
replacement: path.resolve(__dirname, "src/__tests__/__mocks__/l10n.ts"),
},
{
find: "src",
replacement: path.resolve(__dirname, "src"),
},
],
},
});