2
0

vitest.config.mts 2.2 KB

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