From d5f5a890905b65e2b1719108228ea999cfd08a94 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 23 Sep 2026 16:40:42 +0000 Subject: [PATCH] fix(ci): restaura tests del portal y frontend en Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El job test fallaba con 404 en / y /admin porque public/index.html está gitignored y no se construye el frontend. El job test-frontend fallaba porque Vitest 5/jsdom 30 requieren Node 22+ y CI usaba 20. Co-authored-by: Alexendros · Alejandro Domingo Agustí --- .github/workflows/ci.yml | 8 ++++---- portal/tests/app.test.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 632473a..f8cd71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm cache-dependency-path: portal/package-lock.json @@ -34,7 +34,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm cache-dependency-path: portal/package-lock.json @@ -91,7 +91,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm cache-dependency-path: portal/frontend/package-lock.json @@ -110,7 +110,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm cache-dependency-path: portal/frontend/package-lock.json diff --git a/portal/tests/app.test.js b/portal/tests/app.test.js index 1ae28bc..6316f2a 100644 --- a/portal/tests/app.test.js +++ b/portal/tests/app.test.js @@ -1,12 +1,30 @@ 'use strict'; +const fs = require('fs'); +const path = require('path'); const request = require('supertest'); const app = require('../server'); const db = require('../lib/db'); +const publicIndex = path.join(__dirname, '..', 'public', 'index.html'); +const frontendIndex = path.join(__dirname, '..', 'frontend', 'index.html'); +let wroteStubIndex = false; + describe('app integration', () => { beforeAll(async () => { await db.initStorage(); + // public/index.html es artefacto de Vite (gitignored); el job test no lo genera. + if (!fs.existsSync(publicIndex)) { + fs.mkdirSync(path.dirname(publicIndex), { recursive: true }); + fs.copyFileSync(frontendIndex, publicIndex); + wroteStubIndex = true; + } + }); + + afterAll(() => { + if (wroteStubIndex && fs.existsSync(publicIndex)) { + fs.unlinkSync(publicIndex); + } }); test('flujo completo: crear → descargar → completar', async () => {