vitest.config.mts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import path from "path";
  2. import { defineConfig } from "vitest/config";
  3. export default defineConfig({
  4. resolve: {
  5. alias: [
  6. {
  7. find: /^@excalidraw\/excalidraw$/,
  8. replacement: path.resolve(__dirname, "./packages/excalidraw/index.tsx"),
  9. },
  10. {
  11. find: /^@excalidraw\/excalidraw\/(.*?)/,
  12. replacement: path.resolve(__dirname, "./packages/excalidraw/$1"),
  13. },
  14. {
  15. find: /^@excalidraw\/utils$/,
  16. replacement: path.resolve(__dirname, "./packages/utils/index.ts"),
  17. },
  18. {
  19. find: /^@excalidraw\/utils\/(.*?)/,
  20. replacement: path.resolve(__dirname, "./packages/utils/$1"),
  21. },
  22. {
  23. find: /^@excalidraw\/math$/,
  24. replacement: path.resolve(__dirname, "./packages/math/index.ts"),
  25. },
  26. {
  27. find: /^@excalidraw\/math\/(.*?)/,
  28. replacement: path.resolve(__dirname, "./packages/math/$1"),
  29. },
  30. ],
  31. },
  32. //@ts-ignore
  33. test: {
  34. // Since hooks are running in stack in v2, which means all hooks run serially whereas
  35. // we need to run them in parallel
  36. sequence: {
  37. hooks: "parallel",
  38. },
  39. setupFiles: ["./setupTests.ts"],
  40. globals: true,
  41. environment: "jsdom",
  42. coverage: {
  43. reporter: ["text", "json-summary", "json", "html", "lcovonly"],
  44. // Since v2, it ignores empty lines by default and we need to disable it as it affects the coverage
  45. // Additionally the thresholds also needs to be updated slightly as a result of this change
  46. ignoreEmptyLines: false,
  47. thresholds: {
  48. lines: 60,
  49. branches: 70,
  50. functions: 63,
  51. statements: 60,
  52. },
  53. },
  54. },
  55. });