aboutsummaryrefslogtreecommitdiffstats
path: root/vitest.config.mts
diff options
context:
space:
mode:
authorkj_sh6042026-03-15 16:19:36 -0400
committerkj_sh6042026-03-15 16:19:36 -0400
commit88d38623567eac840acb16e74611a4d850318349 (patch)
tree093cba174bc74d38a41373941f698766b3dba5b3 /vitest.config.mts
parent298cab442c361e30ad7cd976d310156f5ae764bd (diff)
refactor: vitest.config.mts
Diffstat (limited to 'vitest.config.mts')
-rw-r--r--vitest.config.mts57
1 files changed, 57 insertions, 0 deletions
diff --git a/vitest.config.mts b/vitest.config.mts
new file mode 100644
index 0000000..f9d7d25
--- /dev/null
+++ b/vitest.config.mts
@@ -0,0 +1,57 @@
+import path from "path";
+
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+ resolve: {
+ alias: [
+ {
+ find: /^@excalidraw\/excalidraw$/,
+ replacement: path.resolve(__dirname, "./packages/excalidraw/index.tsx"),
+ },
+ {
+ find: /^@excalidraw\/excalidraw\/(.*?)/,
+ replacement: path.resolve(__dirname, "./packages/excalidraw/$1"),
+ },
+ {
+ find: /^@excalidraw\/utils$/,
+ replacement: path.resolve(__dirname, "./packages/utils/index.ts"),
+ },
+ {
+ find: /^@excalidraw\/utils\/(.*?)/,
+ replacement: path.resolve(__dirname, "./packages/utils/$1"),
+ },
+ {
+ find: /^@excalidraw\/math$/,
+ replacement: path.resolve(__dirname, "./packages/math/index.ts"),
+ },
+ {
+ find: /^@excalidraw\/math\/(.*?)/,
+ replacement: path.resolve(__dirname, "./packages/math/$1"),
+ },
+ ],
+ },
+ //@ts-ignore
+ test: {
+ // Since hooks are running in stack in v2, which means all hooks run serially whereas
+ // we need to run them in parallel
+ sequence: {
+ hooks: "parallel",
+ },
+ setupFiles: ["./setupTests.ts"],
+ globals: true,
+ environment: "jsdom",
+ coverage: {
+ reporter: ["text", "json-summary", "json", "html", "lcovonly"],
+ // Since v2, it ignores empty lines by default and we need to disable it as it affects the coverage
+ // Additionally the thresholds also needs to be updated slightly as a result of this change
+ ignoreEmptyLines: false,
+ thresholds: {
+ lines: 60,
+ branches: 70,
+ functions: 63,
+ statements: 60,
+ },
+ },
+ },
+});