vitest.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const { defineConfig } = require('vitest/config')
  2. let reporterOptions = {}
  3. if (process.env.CI && process.env.MOCHA_ROOT_SUITE_NAME) {
  4. reporterOptions = {
  5. reporters: [
  6. 'default',
  7. [
  8. 'junit',
  9. {
  10. classnameTemplate: `${process.env.MOCHA_ROOT_SUITE_NAME}.{filename}`,
  11. },
  12. ],
  13. ],
  14. outputFile: 'data/reports/junit-vitest.xml',
  15. }
  16. }
  17. module.exports = defineConfig({
  18. test: {
  19. setupFiles: ['./test/unit/bootstrap.mjs'],
  20. globals: true,
  21. isolate: false,
  22. passWithNoTests: true, // in case there are no tests from one project or other in a module
  23. projects: [
  24. {
  25. extends: true,
  26. test: {
  27. name: 'Parallel',
  28. include: [
  29. 'modules/*/test/unit/**/*.test.mjs',
  30. 'test/unit/src/**/*.test.mjs',
  31. ],
  32. exclude: ['**/*.sequential.test.mjs'],
  33. fileParallelism: true,
  34. },
  35. },
  36. {
  37. extends: true,
  38. test: {
  39. name: 'Sequential',
  40. include: [
  41. 'modules/*/test/unit/**/*.sequential.test.mjs',
  42. 'test/unit/src/**/*.sequential.test.mjs',
  43. ],
  44. fileParallelism: false,
  45. },
  46. },
  47. ],
  48. ...reporterOptions,
  49. },
  50. })