diff --git a/.gitignore b/.gitignore index c89bee5..afb20c5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,9 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* -# Test Coverage +# Test Results tests/coverage +tests/reports node_modules dist diff --git a/tests/config.ts b/tests/config.ts new file mode 100644 index 0000000..25c3b25 --- /dev/null +++ b/tests/config.ts @@ -0,0 +1,9 @@ +import { CoverageV8Options } from "vitest/node"; + +export const coverageV8Options: CoverageV8Options = { + include: ["src"], + skipFull: true, + clean: true, + reporter: ["html", "text"], + reportsDirectory: "./tests/coverage", +}; diff --git a/vite.config.ts b/vite.config.ts index b06e35c..1d8333e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,3 @@ -/// - import path from "path"; import react from "@vitejs/plugin-react"; @@ -7,6 +5,8 @@ import { defineConfig } from "vite"; import svgr, { VitePluginSvgrOptions } from "vite-plugin-svgr"; import { configDefaults } from "vitest/config"; +import { coverageV8Options } from "./tests/config"; + const svgrOptions: VitePluginSvgrOptions["svgrOptions"] = { exportType: "default", ref: true, @@ -22,19 +22,10 @@ export default defineConfig({ globals: true, environment: "jsdom", setupFiles: "./tests/setup.ts", + reporters: ["verbose", "json"], + outputFile: "./tests/reports/results.json", exclude: [...configDefaults.exclude, "./firebase", "./config"], - coverage: { - provider: "v8", - include: ["src"], - skipFull: true, - clean: true, - reporter: ["html", "text"], - reportsDirectory: "./tests/coverage", - }, - }, - resolve: { - alias: { - "@": path.resolve(__dirname, "./src"), - }, + coverage: { provider: "v8", ...coverageV8Options }, }, + resolve: { alias: { "@": path.resolve(__dirname, "./src") } }, });