mirror of
https://github.com/jsmorabito/obsidian-commander.git
synced 2026-07-22 06:40:31 +00:00
- 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.
29 lines
639 B
TypeScript
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"),
|
|
},
|
|
],
|
|
},
|
|
});
|