vitest.config.mts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import path from "path";
  2. import { defineConfig, configDefaults } 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. exclude: [...configDefaults.exclude, "**/playwright/**"],
  51. // Since hooks are running in stack in v2, which means all hooks run serially whereas
  52. // we need to run them in parallel
  53. sequence: {
  54. hooks: "parallel",
  55. },
  56. setupFiles: ["./setupTests.ts"],
  57. globals: true,
  58. environment: "jsdom",
  59. coverage: {
  60. reporter: ["text", "json-summary", "json", "html", "lcovonly"],
  61. // Since v2, it ignores empty lines by default and we need to disable it as it affects the coverage
  62. // Additionally the thresholds also needs to be updated slightly as a result of this change
  63. ignoreEmptyLines: false,
  64. thresholds: {
  65. lines: 60,
  66. branches: 70,
  67. functions: 63,
  68. statements: 60,
  69. },
  70. },
  71. },
  72. });