import path from "node:path";
import { defineConfig } from "vitest/config";

export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "apps/storefront/src"),
    },
  },
  test: {
    environment: "edge-runtime",
    server: { deps: { inline: ["convex-test"] } },
    onUnhandledError(error): boolean | void {
      const msg = error?.message ?? String(error);
      if (
        typeof msg === "string" &&
        msg.includes("Write outside of transaction") &&
        msg.includes("_scheduled_functions")
      ) {
        return false;
      }
    },
  },
});
