import { defineConfig } from 'vitest/config';
import { resolve } from 'path';

// Standalone Vitest config — kept separate from vite.config.js because that
// file validates env vars (APP_DOMAIN etc.) and exits if they're missing,
// which would block tests from running outside the dev environment.
export default defineConfig({
    test: {
        environment: 'jsdom',
        include: [
            'sites/default/js/**/*.test.js',
            'core/js/**/*.test.js',
            'shop/js/**/*.test.js',
        ],
        globals: false,
    },
    resolve: {
        alias: {
            '@site': resolve(__dirname, 'sites/default'),
            '@core': resolve(__dirname, 'core'),
            '@components': resolve(__dirname, 'sites/default/js/components'),
            '@plugins': resolve(__dirname, 'plugins'),
            '@shop': resolve(__dirname, 'shop'),
            '@site_scripts': resolve(__dirname, 'sites/default/js/site_scripts'),
            '@modules': resolve(__dirname, 'modules'),
        },
    },
});
