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 744B

1234567891011121314151617181920212223242526272829303132
  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. function stringPlugin() {
  6. return {
  7. name: 'string-plugin',
  8. enforce: 'pre',
  9. async load(id) {
  10. const path = id.split('?')[0];
  11. if (extname(path) !== '.svg') return null;
  12. return dataToEsm(await readFile(path, 'utf8'));
  13. }
  14. };
  15. }
  16. export default defineConfig({
  17. test: {
  18. include: ['web_src/**/*.test.js'],
  19. setupFiles: ['./web_src/js/test/setup.js'],
  20. environment: 'jsdom',
  21. testTimeout: 20000,
  22. open: false,
  23. allowOnly: true,
  24. passWithNoTests: true,
  25. watch: false,
  26. },
  27. plugins: [
  28. stringPlugin(),
  29. ],
  30. });