import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import { quasar, transformAssetUrls } from '@quasar/vite-plugin';
import jsconfigPaths from 'vite-jsconfig-paths';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
    test: {
        environment: 'happy-dom',
        setupFiles: 'test/vitest/setup-file.js',
        include: [
            // Matches vitest tests in any subfolder of 'src' or into 'test/vitest/__tests__'
            // Matches all files with extension 'js', 'jsx', 'ts' and 'tsx'
            'test/vitest/__tests__/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
        ],
    },
    plugins: [
        vue({
            template: {
                transformAssetUrls,
            },
        }),
        quasar({
            autoImportComponentCase: 'pascal',
            sassVariables: 'src/quasar-variables.scss',
        }),
        VueI18nPlugin({
            include: [
                path.resolve(__dirname, 'src/i18n/**'),
                path.resolve(__dirname, 'src/pages/**/locale/**'),
            ],
        }),
        jsconfigPaths(),
    ],
});