vitest.config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. sequence: {
  33. groupOrder: 2,
  34. },
  35. exclude: ['**/*.sequential.test.mjs'],
  36. fileParallelism: true,
  37. },
  38. },
  39. {
  40. extends: true,
  41. test: {
  42. name: 'Sequential',
  43. sequence: {
  44. groupOrder: 1,
  45. },
  46. include: [
  47. 'modules/*/test/unit/**/*.sequential.test.mjs',
  48. 'test/unit/src/**/*.sequential.test.mjs',
  49. ],
  50. fileParallelism: false,
  51. },
  52. },
  53. ],
  54. ...reporterOptions,
  55. },
  56. })