Skip to content

Commit

Permalink
Refactor Test Coverage Configuration & Output Test Results
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCode92 committed Dec 23, 2024
1 parent 61dd645 commit b8294e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Test Coverage
# Test Results
tests/coverage
tests/reports

node_modules
dist
Expand Down
9 changes: 9 additions & 0 deletions tests/config.ts
Original file line number Diff line number Diff line change
@@ -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",
};
21 changes: 6 additions & 15 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// <reference types="vitest" />

import path from "path";

import react from "@vitejs/plugin-react";
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,
Expand All @@ -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") } },
});

0 comments on commit b8294e3

Please sign in to comment.