您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

vitest.config.js 793B

12345678910111213141516171819202122232425262728293031323334
  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. },
  28. plugins: [
  29. stringPlugin(),
  30. vue(),
  31. ],
  32. });