Files
plantillas-proyectos/frontend/vite.config.ts
AlexeerCT b8f46d09ae Enhance Jenkinsfile for frontend testing and update Playwright configuration
- Added a new 'E2E (docker compose + Playwright)' stage in the Jenkinsfile to run end-to-end tests using Docker Compose and Playwright.
- Updated the 'Test frontend' stage to utilize the Playwright test image and improved error handling for missing files.
- Modified Playwright configuration to use an environment variable for the base URL, enhancing flexibility in CI environments.
- Expanded TypeScript configuration to include additional test and configuration files for better type checking.
2026-04-24 11:18:57 -05:00

69 lines
1.8 KiB
TypeScript

import { paraglideVitePlugin } from '@inlang/paraglide-js';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vitest/config';
import { sveltekit } from '@sveltejs/kit/vite';
/* En CI, por defecto solo Node (evita Chromium). Con JENKINS_VITEST_FULL=1 o VITEST_FULL=1, también @vitest/browser. */
const inCi = process.env.CI === 'true' || Boolean(process.env.JENKINS_URL);
const vitestFull =
process.env.VITEST_FULL === '1' || process.env.JENKINS_VITEST_FULL === '1';
const skipBrowser = process.env.VITEST_NO_BROWSER === '1';
const vitestNoBrowser = (inCi && !vitestFull) || skipBrowser;
const vitestServerProject = {
extends: './vite.config.ts',
test: {
name: 'server' as const,
environment: 'node' as const,
include: ['src/**/*.{test,spec}.{js,ts}'],
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'],
},
};
const vitestClientProject = {
extends: './vite.config.ts',
test: {
name: 'client' as const,
environment: 'browser' as const,
browser: {
enabled: true,
provider: 'playwright' as const,
instances: [{ browser: 'chromium' as const }],
},
include: ['src/**/*.svelte.{test,spec}.{js,ts}'],
exclude: ['src/lib/server/**'],
setupFiles: ['./vitest-setup-client.ts'],
},
};
export default defineConfig({
server: {
port: 5173, // fija el puerto
host: true, // escucha en 0.0.0.0
allowedHosts: [
'anexo76-dev.aduanasoft.com',
// 'otro-host.com' si necesitas más
],
proxy: {
'/api/uploads': {
target: 'http://backend:8000',
changeOrigin: true
}
}
},
plugins: [
tailwindcss(),
sveltekit(),
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide'
})
],
test: {
expect: { requireAssertions: true },
projects: vitestNoBrowser
? [vitestServerProject]
: [vitestClientProject, vitestServerProject]
}
});