-
Notifications
You must be signed in to change notification settings - Fork 0
Habilita quality checks #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
commit bbe6b9f6946e61c1d1dd53e9a40a5aee7b1ecf75
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:34:42 2026 -0500
Eliminados unused imports
commit 25d2ffb
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:34:13 2026 -0500
Ensure env requiere GITHUB_ENV
commit b9dc3f1
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:30:31 2026 -0500
Forzar que env debe existir
commit 7ce86ec
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:25:30 2026 -0500
Eliminado branches innecesarios, pollForPreview no define writeUrlFn por defecto y no necesita validar si se provee o no expectedSha
commit 8a0b644
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:21:09 2026 -0500
Restore GITHUB_ENV (guardar el fichero para compartir estado)
commit 861f7d7
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 11:11:02 2026 -0500
Purga parseArgs
commit 175f9b6
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 10:56:28 2026 -0500
Eliminado parse de github event workflow debe encargarse de proveer la información que necesita el script
commit 57fb0f8
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 10:14:56 2026 -0500
Verificar que funciona en main
commit dfbe07e
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 10:13:07 2026 -0500
returns null when GITHUB_EVENT_PATH lacks pull_request
commit 85160ca
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 10:04:09 2026 -0500
tests resolveExpectedSha
commit ed406ff
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:58:19 2026 -0500
wait-netlify: validate Netlify API data
split fetch/validation
add robust tests
commit 2fb7ea6
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:54:38 2026 -0500
Ensure env tests
commit b58fb0c
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:50:19 2026 -0500
Validations for deploys to have valid contract
commit 69c0b85
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:37:17 2026 -0500
Validar que list deploy retorne una lista
commit 60bcacc
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:25:12 2026 -0500
Eslint rules ignore coverage
commit 88c07d5
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:17:57 2026 -0500
nuevos tests sobre flujos de error en el script
commit 8b63a44
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:12:20 2026 -0500
EnsureEnv throw vs exit
commit 7571059
Author: Sergio Orozco <scot3004@gmail.com>
Date: Sat Feb 7 09:00:11 2026 -0500
Wait for netlify permite master
* Actualizado wait netlify resolveEnvBranch
* agregados tests previewDeploysForBranch
commit daef629
Author: Sergio Orozco <scot3004@gmail.com>
Date: Fri Feb 6 01:11:49 2026 -0500
Cobertura de pruebas sobre wait-netlify 100%
commit 83a9045
Author: Sergio Orozco <scot3004@gmail.com>
Date: Fri Feb 6 00:57:24 2026 -0500
Removed unnecessary branches wait-netlify
commit 606391d
Author: Sergio Orozco <scot3004@gmail.com>
Date: Fri Feb 6 00:12:22 2026 -0500
Add test scenario for polling where the deploy is never matched
commit c4a155a
Author: Sergio Orozco <scot3004@gmail.com>
Date: Fri Feb 6 00:09:40 2026 -0500
Vitest coverage
commit 8b7fdb8
Author: Sergio Orozco <scot3004@gmail.com>
Date: Thu Feb 5 23:59:22 2026 -0500
Removed unused lastSeen
commit ab93640
Author: Sergio Orozco <scot3004@gmail.com>
Date: Thu Feb 5 23:51:25 2026 -0500
Mejoras en legibilidad de scripts wait-netlify
commit 593d30c
Author: Sergio Orozco <scot3004@gmail.com>
Date: Thu Feb 5 23:28:36 2026 -0500
wait netlify-netlify test no any
commit 4917e80
Author: Sergio Orozco <scot3004@gmail.com>
Date: Thu Feb 5 23:24:42 2026 -0500
Wait netlify tests
commit c8069e8
Author: Sergio Orozco <scot3004@gmail.com>
Date: Thu Feb 5 19:07:10 2026 -0500
eslint refined
commit 5b45488
Author: Sergio C. Orozco Torres <scot3004@gmail.com>
Date: Fri Dec 6 15:30:14 2024 -0500
eslint astro
|
|
✅ Deploy Preview for secorto-astro ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
SeCOrTo web
|
||||||||||||||||||||||||||||
| Project |
SeCOrTo web
|
| Branch Review |
pull/74/head
|
| Run status |
|
| Run duration | 01m 38s |
| Commit |
|
| Committer | Sergio C. Orozco Torres |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
6
|
| View all changes introduced in this branch ↗︎ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Este PR habilita “quality checks” en el proyecto Astro añadiendo linting con ESLint y tests unitarios con Vitest, además de refactorizar el script de CI wait-netlify para hacerlo testeable y con cobertura.
Changes:
- Añade configuración de Vitest y una batería de tests unitarios para
wait-netlify(script + helpers). - Introduce configuración de ESLint (flat config) y agrega scripts de
lint/test:unitenpackage.json. - Ajusta Playwright para ejecutar e2e desde
tests/e2ey actualiza.gitignoreparacoverage/.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.ts |
Configuración principal de Vitest (includes + coverage). |
vitest.config.js |
Segunda config de Vitest (potencialmente conflictiva con la TS). |
tests/unit/wait-netlify.test.ts |
Tests de helpers de integración (sha, URL, filtros). |
tests/unit/wait-netlify.resolve.test.ts |
Tests de resolución del SHA esperado. |
tests/unit/wait-netlify.poll.test.ts |
Tests del polling y casos de error/reintentos. |
tests/unit/wait-netlify.main.test.ts |
Test de integración de main() escribiendo GITHUB_ENV. |
tests/unit/wait-netlify.fetch.test.ts |
Test del guard cuando falta fetch. |
tests/unit/wait-netlify.ensure.test.ts |
Tests de validación de env vars requeridas. |
tests/unit/wait-netlify.branch.test.ts |
Tests de detección de branch desde env. |
tests/unit/wait-netlify-validate.test.ts |
Tests de validación del payload de deploys. |
tests/unit/wait-netlify-api.test.ts |
Tests del wrapper de API Netlify (fetch/validación). |
src/components/PostList.astro |
Ajuste de slot a self-closing (<slot />). |
playwright.config.ts |
Cambia testDir a ./tests/e2e. |
package.json |
Añade scripts de lint/unit tests y campo engines. |
eslint.config.js |
Configuración ESLint (Astro + TS + a11y/import rules). |
.gitignore |
Ignora coverage/. |
.github/scripts/wait-netlify.js |
Refactor del script: inyección de dependencias + exports para tests. |
.github/scripts/README.md |
Documentación adicional sobre PR vs main/master (requiere alineación con el código). |
.github/lib/wait-netlify-integrator.js |
Nueva capa de integración (filtrado/match/URL/summary). |
.github/lib/wait-netlify-git.js |
Helper para extraer SHA desde objetos de deploy. |
.github/lib/wait-netlify-api.js |
Wrapper de API Netlify + validación de respuesta. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ResolveExpected sha tests actualizado workflow para cubrir los escenarios
…lify-runner que si que lo hace
* Test description was not correct * Vitest config was on js and ts keept ts only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 28 out of 31 changed files in this pull request and generated 13 comments.
| const v = process.env.COMMIT_ID | ||
| if (v && /^[0-9a-f]{7,40}$/i.test(v)) return String(v).trim().toLowerCase() |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolveExpectedSha() validates COMMIT_ID before trimming it. If the env var has leading/trailing whitespace/newlines (common when piping values), the regex will fail and return null even for a valid SHA. Trim first, then validate.
| const v = process.env.COMMIT_ID | |
| if (v && /^[0-9a-f]{7,40}$/i.test(v)) return String(v).trim().toLowerCase() | |
| const vRaw = process.env.COMMIT_ID | |
| if (!vRaw) return null | |
| const v = String(vRaw).trim() | |
| if (!v) return null | |
| if (/^[0-9a-f]{7,40}$/i.test(v)) return v.toLowerCase() |
tests/unit/wait-netlify.poll.test.ts
Outdated
| it('accepts a ready deploy even when it has no SHA and no expected provided', async () => { | ||
| const deploy = { id: 'r1', state: 'ready', links: { alias: 'https://alias.netlify.app' }, context: 'deploy-preview', branch: 'feat' } | ||
| const listDeploysFn = vi.fn().mockResolvedValue([deploy]) | ||
| const writeUrlFn = vi.fn() | ||
|
|
||
| const res = await pollForPreview({ | ||
| listDeploysFn, | ||
| site: 's', | ||
| token: 't', | ||
| branch: 'feat', | ||
| expectedSha: 'nomatch2', | ||
| attempts: 1, |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test title says "no expected provided", but the test passes expectedSha: 'nomatch2'. Either pass expectedSha: null to truly test the no-expected case, or rename the test to reflect that it should not match when expected SHA is provided but the deploy has no SHA.
| import { runAndExit } from './wait-netlify.js' | ||
|
|
||
| if (process.argv[1] === fileURLToPath(import.meta.url)) runAndExit() |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The direct-execution check is likely to fail when the script is invoked with a relative path (e.g. node .github/scripts/wait-netlify-runner.js), because process.argv[1] can be relative while fileURLToPath(import.meta.url) is absolute. This would prevent runAndExit() from running in CI. Consider normalizing both sides (e.g., path.resolve(process.argv[1])) or comparing URLs instead of raw paths.
| import { runAndExit } from './wait-netlify.js' | |
| if (process.argv[1] === fileURLToPath(import.meta.url)) runAndExit() | |
| import { resolve } from 'path' | |
| import { runAndExit } from './wait-netlify.js' | |
| if (resolve(process.argv[1]) === fileURLToPath(import.meta.url)) runAndExit() |
| Usage (in workflow) | ||
|
|
||
| - The workflow should call: | ||
|
|
||
| node .github/scripts/wait-netlify.js | ||
|
|
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section says the workflow should call node .github/scripts/wait-netlify.js, but the workflow in this PR was changed to call wait-netlify-runner.js. Update the docs to match the new entrypoint so copy/paste instructions stay correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
tests/unit/wait-netlify.test.ts
Outdated
| it('findMatchingDeploy returns first ready when no expected sha', () => { | ||
| const notReady = { id: 'n', state: 'building', commit_ref: 'b' } | ||
| const ready = { id: 'r', state: 'ready', commit_ref: 'a', sha: 'aaaa1111' } | ||
| // Policy: require expected SHA to match; when none provided, result is null | ||
| const res = findMatchingDeploy([notReady, ready], null) | ||
| expect(res).toBeNull() | ||
| }) |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test name says it "returns first ready when no expected sha", but the assertion (and the comment) expect null when expectedSha is missing. Rename the test to match the actual policy so failures are easier to interpret.
.github/scripts/wait-netlify.js
Outdated
| // If executed directly, run `main()` and exit with its returned code. | ||
| // `runAndExit` accepts an optional `mainFn` so tests can pass a stubbed | ||
| // implementation without needing a mutable exported binding. | ||
| async function runAndExit(mainFn = main) { |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says "If executed directly" this module will run main() and exit, but there is no direct-execution guard in this file anymore (it only defines runAndExit). Either add a guard here or update the comment to indicate that wait-netlify-runner.js is responsible for calling runAndExit() when executed.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* remove unused import fileURLToPath * jsdoc for runAndExit * changed description of test findMatchingDeploy returns null when no expected sha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 27 out of 30 changed files in this pull request and generated 4 comments.
| // stub process.exit to capture exit code without terminating | ||
| vi.spyOn(process, 'exit').mockImplementation(((code?: number) => { (process as any).__exitCode = code; return undefined }) as any) | ||
| }) |
Copilot
AI
Feb 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The process.exit spy is currently forced through multiple as any casts and writes to (process as any).__exitCode. Consider using a small typed helper (e.g., store the captured code in a local let exitCode: number | undefined) to avoid any casts and reduce the risk of leaking state between tests.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Habilita quality checks
Se configura eslint y vite
Se refina el script wait netlify para tener cobertura de pruebas