You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vitest.config.js 824B

1234567891011121314151617181920212223242526272829303132333435
  1. import {defineConfig} from 'vitest/dist/config.js';
  2. import {readFile} from 'node:fs/promises';
  3. import {dataToEsm} from '@rollup/pluginutils';
  4. import {extname} from 'node:path';
  5. import vue from '@vitejs/plugin-vue';
  6. function stringPlugin() {
  7. return {
  8. name: 'string-plugin',
  9. enforce: 'pre',
  10. async load(id) {
  11. const path = id.split('?')[0];
  12. if (extname(path) !== '.svg') return null;
  13. return dataToEsm(await readFile(path, 'utf8'));
  14. }
  15. };
  16. }
  17. export default defineConfig({
  18. test: {
  19. include: ['web_src/**/*.test.js'],
  20. setupFiles: ['./web_src/js/test/setup.js'],
  21. environment: 'jsdom',
  22. testTimeout: 20000,
  23. open: false,
  24. allowOnly: true,
  25. passWithNoTests: true,
  26. watch: false,
  27. outputDiffLines: Infinity,
  28. },
  29. plugins: [
  30. stringPlugin(),
  31. vue(),
  32. ],
  33. });