feat(test): implementazione infrastruttura completa (Unit, Integration, E2E) con Vitest e Playwright

- Introduce Vitest per Unit e Integration Test.
- Introduce Playwright per End-to-End Test.
- Aggiuge documentazione dettagliata in tests/README.md.
- Aggiorna .gitignore per escludere i report di coverage
This commit is contained in:
2026-02-12 15:13:04 +01:00
parent 331ab0bbeb
commit 71119da727
12 changed files with 2579 additions and 13 deletions

View File

@@ -0,0 +1,22 @@
import { describe, it, expect } from 'vitest'
import { printServerInfo } from '../../src/server-utils.js'
// Mocking console.log per evitare output sporchi durante i test
import { vi } from 'vitest'
describe('Server Utils', () => {
it('printServerInfo dovrebbe stampare le porte corrette', () => {
const consoleSpy = vi.spyOn(console, 'log')
printServerInfo(3000, 3001)
expect(consoleSpy).toHaveBeenCalled()
// Unisce tutti i messaggi loggati in un'unica stringa per facilitare la ricerca
const allLogs = consoleSpy.mock.calls.map(args => args[0]).join('\n')
expect(allLogs).toContain('3000')
expect(allLogs).toContain('3001')
consoleSpy.mockRestore()
})
})