Skip to content

Commit

Permalink
feat(vite): reference vitest types
Browse files Browse the repository at this point in the history
  • Loading branch information
TotomInc committed Apr 30, 2024
1 parent 3c49eff commit 4d9bf4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="vitest" />
import { URL, fileURLToPath } from "node:url";

import { type UserConfig, defineConfig } from "vite";
Expand All @@ -17,6 +18,13 @@ export default defineConfig((configEnv) => {
},
};

// When running vitest, add the test config.
if (configEnv.mode === "test") {
config.test = {
environment: "happy-dom",
};
}

// Build library when in production mode (npm run build).
if (configEnv.mode === "production") {
return {
Expand Down

0 comments on commit 4d9bf4c

Please sign in to comment.