Files
online-energieausweis/cypress.config.ts
Moritz Utcke 71f5093a49 Tests
2025-04-01 13:49:47 -03:00

57 lines
1.6 KiB
TypeScript

import { defineConfig } from "cypress";
import dsv from "@rollup/plugin-dsv"
import { prisma } from "./src/lib/server/prisma"
import { fileURLToPath } from "url";
import vitePreprocessor from "cypress-vite";
export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
viewportHeight: 900,
viewportWidth: 1660,
supportFile: fileURLToPath(new URL("./src/cypress/support/commands.ts", import.meta.url)),
specPattern: "./src/cypress/e2e/**/*.{ts,js}",
setupNodeEvents(on, config) {
on("file:preprocessor", vitePreprocessor({
optimizeDeps: {
exclude: ["@ibcornelsen/database"]
},
resolve: {
alias: {
".prisma/client/index-browser": fileURLToPath(new URL("./node_modules/.prisma/client/index-browser.js", import.meta.url)),
"#": fileURLToPath(new URL("./src", import.meta.url)),
"#components": fileURLToPath(new URL("./src/components", import.meta.url)),
"#lib": fileURLToPath(new URL("./src/lib", import.meta.url))
}
},
base: fileURLToPath(new URL("./src", import.meta.url)),
build: {
commonjsOptions: {
transformMixedEsModules: false
}
},
plugins: [dsv()]
}))
on("task", {
async verbrauchsausweisWohnen(query) {
return await prisma.verbrauchsausweisWohnen.findFirst(query)
},
async plz() {
const total = await prisma.postleitzahlen.count()
const result = await prisma.postleitzahlen.findFirst({
skip: Math.floor(Math.random() * total)
})
return result?.plz
}
})
},
},
component: {
devServer: {
framework: "svelte",
bundler: "vite"
},
}
});