Skip to content

Commit

Permalink
coverage fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed Dec 10, 2024
1 parent 7b89bb5 commit 45dd5c2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ jobs:
# Only works if you set `reportOnFailure: true` in your vite config as specified above
if: always()
uses: davelosert/vitest-coverage-report-action@v2
args:
16 changes: 16 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vitest/config"

export default defineConfig({
plugins: [tsconfigPaths()],
test: {
globals: true,
css: true,
root: "app",
coverage: {
all: false,
reporter: ["text", "json-summary", "json"],
reportOnFailure: true,
},
},
})
81 changes: 31 additions & 50 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,38 @@
import { defineConfig, defineWorkspace } from "vitest/config"
import { defineWorkspace } from "vitest/config"

import tsconfigPaths from "vite-tsconfig-paths"

const serverTestConfig = defineConfig({
plugins: [tsconfigPaths()],
test: {
name: "server tests",
globals: true,
css: true,
environment: "node",
include: ["./app/**/*.server.test.{ts,tsx}"],
coverage: {
include: ["./app/**/*"],
reporter: ["text", "json-summary", "json"],
reportOnFailure: true,
export default defineWorkspace([
{
extends: "./vitest.config.ts",
test: {
name: "server tests",
environment: "node",
include: ["./**/*.server.test.{ts,tsx}"],
},
},
})

const browserTestConfig = defineConfig({
plugins: [tsconfigPaths()],
optimizeDeps: {
include: ["react/jsx-dev-runtime"],
},
server: {
fs: {
strict: false,
{
extends: "./vitest.config.ts",
optimizeDeps: {
include: ["react/jsx-dev-runtime"],
},
},
test: {
globals: true,
css: true,
includeTaskLocation: true,
include: ["./**.test.{ts,tsx}", "!./**.server.test.{ts,tsx}"],
setupFiles: ["./tests/setup.browser.tsx"],
coverage: {
include: ["./app/**/*"],
reporter: ["text", "json-summary", "json"],
reportOnFailure: true,
server: {
fs: {
strict: false,
},
},

name: "browser tests",
browser: {
// biome-ignore lint/nursery/noProcessEnv: we want to use process.env here
headless: !!process.env.CI,
enabled: true,
name: "chromium",
provider: "playwright",

// https://playwright.dev
providerOptions: {},
test: {
includeTaskLocation: true,
include: ["./**.test.{ts,tsx}", "!./**.server.test.{ts,tsx}"],
setupFiles: ["./tests/setup.browser.tsx"],
name: "browser tests",
browser: {
// biome-ignore lint/nursery/noProcessEnv: we want to use process.env here
headless: !!process.env.CI,
enabled: true,
name: "chromium",
provider: "playwright",
// https://playwright.dev
providerOptions: {},
},
},
},
})

export default defineWorkspace([serverTestConfig, browserTestConfig])
])

0 comments on commit 45dd5c2

Please sign in to comment.