vitest.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/vitest_bootstrap.mjs'],
  20. globals: true,
  21. isolate: false,
  22. projects: [
  23. {
  24. extends: true,
  25. test: {
  26. name: 'Parallel',
  27. include: [
  28. 'modules/*/test/unit/**/*.test.mjs',
  29. 'test/unit/src/**/*.test.mjs',
  30. ],
  31. exclude: ['**/*.sequential.test.mjs'],
  32. fileParallelism: true,
  33. },
  34. },
  35. {
  36. extends: true,
  37. test: {
  38. name: 'Sequential',
  39. include: [
  40. 'modules/*/test/unit/**/*.sequential.test.mjs',
  41. 'test/unit/src/**/*.sequential.test.mjs',
  42. ],
  43. fileParallelism: false,
  44. },
  45. },
  46. ],
  47. ...reporterOptions,
  48. },
  49. })