config.cjs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
  4. const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
  5. const defaultCoverageExcludes = [
  6. "coverage/**",
  7. "dist/**",
  8. "packages/*/test{,s}/**",
  9. "**/*.d.ts",
  10. "cypress/**",
  11. "test{,s}/**",
  12. "test{,-*}.{js,cjs,mjs,ts,tsx,jsx}",
  13. "**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}",
  14. "**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}",
  15. "**/__tests__/**",
  16. "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}",
  17. "**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
  18. ];
  19. const coverageConfigDefaults = {
  20. provider: "c8",
  21. enabled: false,
  22. clean: true,
  23. cleanOnRerun: false,
  24. reportsDirectory: "./coverage",
  25. excludeNodeModules: true,
  26. exclude: defaultCoverageExcludes,
  27. reporter: ["text", "html", "clover", "json"],
  28. allowExternal: false,
  29. extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
  30. };
  31. const fakeTimersDefaults = {
  32. loopLimit: 1e4,
  33. shouldClearNativeTimers: true,
  34. toFake: [
  35. "setTimeout",
  36. "clearTimeout",
  37. "setInterval",
  38. "clearInterval",
  39. "setImmediate",
  40. "clearImmediate",
  41. "Date"
  42. ]
  43. };
  44. const config = {
  45. allowOnly: !process.env.CI,
  46. watch: !process.env.CI,
  47. globals: false,
  48. environment: "node",
  49. threads: true,
  50. clearMocks: false,
  51. restoreMocks: false,
  52. mockReset: false,
  53. include: defaultInclude,
  54. exclude: defaultExclude,
  55. testTimeout: 5e3,
  56. hookTimeout: 1e4,
  57. teardownTimeout: 1e3,
  58. isolate: true,
  59. watchExclude: ["**/node_modules/**", "**/dist/**"],
  60. forceRerunTriggers: [
  61. "**/package.json/**",
  62. "**/vitest.config.*/**",
  63. "**/vite.config.*/**"
  64. ],
  65. update: false,
  66. reporters: [],
  67. silent: false,
  68. api: false,
  69. ui: false,
  70. uiBase: "/__vitest__/",
  71. open: true,
  72. css: {
  73. include: []
  74. },
  75. coverage: coverageConfigDefaults,
  76. fakeTimers: fakeTimersDefaults,
  77. maxConcurrency: 5,
  78. dangerouslyIgnoreUnhandledErrors: false
  79. };
  80. const configDefaults = Object.freeze(config);
  81. function defineConfig(config) {
  82. return config;
  83. }
  84. exports.configDefaults = configDefaults;
  85. exports.defaultExclude = defaultExclude;
  86. exports.defaultInclude = defaultInclude;
  87. exports.defineConfig = defineConfig;