2025-02-28 16:49:09 +01:00
|
|
|
import path from "path";
|
|
|
|
|
2023-07-27 23:50:11 +05:30
|
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
|
|
|
|
export default defineConfig({
|
2025-02-28 16:49:09 +01:00
|
|
|
resolve: {
|
|
|
|
alias: [
|
2025-03-26 15:24:59 +01:00
|
|
|
{
|
|
|
|
find: /^@excalidraw\/common$/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/common/src/index.ts"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: /^@excalidraw\/common\/(.*?)/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/common/src/$1"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: /^@excalidraw\/element$/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/element/src/index.ts"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: /^@excalidraw\/element\/(.*?)/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/element/src/$1"),
|
|
|
|
},
|
2025-02-28 16:49:09 +01:00
|
|
|
{
|
|
|
|
find: /^@excalidraw\/excalidraw$/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/excalidraw/index.tsx"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: /^@excalidraw\/excalidraw\/(.*?)/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/excalidraw/$1"),
|
|
|
|
},
|
|
|
|
{
|
2025-03-26 15:24:59 +01:00
|
|
|
find: /^@excalidraw\/math$/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/math/src/index.ts"),
|
2025-02-28 16:49:09 +01:00
|
|
|
},
|
|
|
|
{
|
2025-03-26 15:24:59 +01:00
|
|
|
find: /^@excalidraw\/math\/(.*?)/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/math/src/$1"),
|
2025-02-28 16:49:09 +01:00
|
|
|
},
|
|
|
|
{
|
2025-03-26 15:24:59 +01:00
|
|
|
find: /^@excalidraw\/utils$/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/utils/src/index.ts"),
|
2025-02-28 16:49:09 +01:00
|
|
|
},
|
|
|
|
{
|
2025-03-26 15:24:59 +01:00
|
|
|
find: /^@excalidraw\/utils\/(.*?)/,
|
|
|
|
replacement: path.resolve(__dirname, "./packages/utils/src/$1"),
|
2025-02-28 16:49:09 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2024-09-05 18:35:36 +05:30
|
|
|
//@ts-ignore
|
2023-07-27 23:50:11 +05:30
|
|
|
test: {
|
2024-09-05 18:35:36 +05:30
|
|
|
// Since hooks are running in stack in v2, which means all hooks run serially whereas
|
|
|
|
// we need to run them in parallel
|
|
|
|
sequence: {
|
2024-09-12 12:56:45 +02:00
|
|
|
hooks: "parallel",
|
2024-09-05 18:35:36 +05:30
|
|
|
},
|
2023-12-12 11:32:51 +05:30
|
|
|
setupFiles: ["./setupTests.ts"],
|
2023-07-27 23:50:11 +05:30
|
|
|
globals: true,
|
|
|
|
environment: "jsdom",
|
2023-08-01 16:13:04 +05:30
|
|
|
coverage: {
|
2024-05-06 17:35:23 +02:00
|
|
|
reporter: ["text", "json-summary", "json", "html", "lcovonly"],
|
2024-09-05 18:35:36 +05:30
|
|
|
// 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,
|
2023-12-07 15:30:08 +05:30
|
|
|
thresholds: {
|
2024-09-24 14:01:28 +02:00
|
|
|
lines: 60,
|
2023-12-07 15:30:08 +05:30
|
|
|
branches: 70,
|
2024-09-05 18:35:36 +05:30
|
|
|
functions: 63,
|
2024-09-24 14:01:28 +02:00
|
|
|
statements: 60,
|
2023-12-07 15:30:08 +05:30
|
|
|
},
|
2023-08-01 16:13:04 +05:30
|
|
|
},
|
2023-07-27 23:50:11 +05:30
|
|
|
},
|
|
|
|
});
|