Skip to content

Conversation

@Scot3004
Copy link
Contributor

@Scot3004 Scot3004 commented Feb 7, 2026

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

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
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for secorto-astro ready!

Name Link
🔨 Latest commit e7d8565
🔍 Latest deploy log https://app.netlify.com/projects/secorto-astro/deploys/6987b42f5cef9e000806a5b0
😎 Deploy Preview https://deploy-preview-74--secorto-astro.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100
Accessibility: 100
Best Practices: 100
SEO: 100
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@cypress
Copy link

cypress bot commented Feb 7, 2026

SeCOrTo web    Run #193

Run Properties:  status check passed Passed #193  •  git commit e7d8565823: Apply suggestions from code review
Project SeCOrTo web
Branch Review pull/74/head
Run status status check passed Passed #193
Run duration 01m 38s
Commit git commit e7d8565823: Apply suggestions from code review
Committer Sergio C. Orozco Torres
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 6
View all changes introduced in this branch ↗︎

Copy link
Contributor

Copilot AI left a 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:unit en package.json.
  • Ajusta Playwright para ejecutar e2e desde tests/e2e y actualiza .gitignore para coverage/.

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.

* Test description was not correct
* Vitest config was on js and ts keept ts only
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +78 to +79
const v = process.env.COMMIT_ID
if (v && /^[0-9a-f]{7,40}$/i.test(v)) return String(v).trim().toLowerCase()
Copy link

Copilot AI Feb 7, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines 188 to 199
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,
Copy link

Copilot AI Feb 7, 2026

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.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +2 to +4
import { runAndExit } from './wait-netlify.js'

if (process.argv[1] === fileURLToPath(import.meta.url)) runAndExit()
Copy link

Copilot AI Feb 7, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 29
Usage (in workflow)

- The workflow should call:

node .github/scripts/wait-netlify.js

Copy link

Copilot AI Feb 7, 2026

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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

Comment on lines 43 to 49
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()
})
Copy link

Copilot AI Feb 7, 2026

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.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 130 to 133
// 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) {
Copy link

Copilot AI Feb 7, 2026

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.

Copilot uses AI. Check for mistakes.
Scot3004 and others added 2 commits February 7, 2026 16:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Feb 7, 2026

@Scot3004 I've opened a new pull request, #75, to work on those changes. Once the pull request is ready, I'll request review from you.

* remove unused import fileURLToPath
* jsdoc for runAndExit
* changed description of test findMatchingDeploy returns null when no expected sha
Copy link
Contributor

Copilot AI left a 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.

Comment on lines +10 to +12
// 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)
})
Copy link

Copilot AI Feb 7, 2026

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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Scot3004 Scot3004 merged commit 32cce1a into master Feb 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants