fix(tests): corregir fallos de tests pre-existentes en entornos Windows#372
fix(tests): corregir fallos de tests pre-existentes en entornos Windows#372Basparin wants to merge 5 commits into
Conversation
- Agregar .gitattributes con eol=lf para evitar conversión CRLF en golden files - Regenerar golden files con terminaciones LF consistentes - Usar filepath.FromSlash() en TestSkillPathForAgent para separadores de ruta - Agregar skipIfNoPkgManager() y disablePluginInstall() para tests de OpenCode que requieren npm/bun — ahora hacen skip en lugar de fallar
These two tests exercised the OpenCode inject path without mocking the package manager lookup, so they failed on Windows environments lacking bun/npm with the same unique-names-generator post-install error that atarico addressed for 15+ sibling tests. Applying the same helper keeps the fix for Gentleman-Programming#103 consistent across the whole test file.
Previous regeneration contaminated the golden with persona.Inject output (Rules, Personality, Engram Protocol) that does not belong to sdd.Inject. Restoring to the baseline resolves TestGoldenSDD_VSCode on Linux CI.
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
La idea puede servir, pero falta ordenar el proceso y revisar solapamiento.
Sumá el label type:*, refrescá CI contra main y compará explícitamente este cambio con #490 para que no revisemos dos fixes de Windows que pisan el mismo problema.
…illReferences Main introduced TestInjectCopiesNestedSDDSkillReferences after this PR opened. It exercises the same opencode-plugin install path as its TestInjectCopiesAllFiles* siblings and fails on Windows for the same reason (no bun/npm to install unique-names-generator inside the test temp dir). Apply the same disablePluginInstall(t) helper this PR already uses for the rest of the family. No behavior change in production code.
|
@Alan-TheGentleman refreshed against current main + addressed the #490 comparison you asked for. RefreshMerge commit: While running the suite against the merged tree I caught a new test introduced by main that the original PR pattern hadn't reached yet:
Extension applied in commit Local validationgo test ./internal/components/sdd/ -run "TestInjectCopiesNestedSDDSkillReferences|TestInjectCopiesAllFiles"
go test ./internal/components/skills/ -run TestSkillPathForAgent
go test ./internal/components/ -run TestGoldenEngram_AntigravityAll 3 previously-failing cases now PASS. The remaining unit-test failure on CI is from Boundary vs #490 (tonyblu331)You asked explicitly for this, so here it is concrete:
Both PRs link
I checked both diffs file-by-file before refreshing — there is no shared symbol, no shared helper, and no shared test name. The two PRs can land in either order without rebase conflicts; whichever lands first the other will merge cleanly. If you'd prefer them landed in a specific order or want me to align helper naming conventions across the two, happy to coordinate with @tonyblu331. Pending maintainer action
|
|
@Basparin — friendly nudge: 10/12 checks green, only 2 failures left. Could you take another pass at the failing jobs and refresh against current |
|
@Basparin — heads-up: this PR's Unit Tests failure is Your branch still expects the old form, so the CI run uses the pre-#660 assertion and fails. Fix: rebase against current Pseudocode: git fetch upstream main
git rebase upstream/main
# resolve any conflicts (likely none for this PR's scope)
git push --force-with-leaseThe other PR you have open (and #371 + #374 + #372) all show the same failure for the same reason — same rebase fixes all three. Thanks for sticking with these. |
🔗 Linked Issue
Closes #103
🏷️ PR Type
type:bug— Bug fix (non-breaking change that fixes an issue)🙏 Credit
Retoma el trabajo de @atarico en #104 (cerrado por un tema de proceso, no técnico — el issue #103 no tenía
status:approvedal momento). El commit originalc765befse preserva con su autoría intacta (Author: atarico); un segundo commit mío (test(sdd): extend disablePluginInstall to TestInjectCopiesAllFiles tests) extiende el mismo patrón a dos tests hermanos que quedaron afuera. Comenté en #104 avisándole antes de abrir este PR.📝 Summary
Al correr
go test ./...en Windows existen tres categorías de fallos pre-existentes causados por incompatibilidades del entorno, no por errores de lógica del proyecto. Este PR cubre las tres:testdata/golden/, haciendo que los testsTestGolden*fallaran porque el código Go escribe LF. Solución:.gitattributescon* text eol=lf.TestSkillPathForAgentcomparaba con paths/home/test/...que en Windows resultan\home\test\.... Solución:filepath.FromSlash()en el valor esperado.bun/npm— varios tests instalan el plugin de background-agents, que falla si el package manager no está. Solución:skipIfNoPkgManager()para skip cuando el entorno no tiene manager, ydisablePluginInstall()para mockear la lookup cuando el test ya no depende del plugin real.📂 Changes
.gitattributes* text eol=lfpara forzar LF en todos los sistemasinternal/components/golden_test.gointernal/components/sdd/inject_test.goskipIfNoPkgManager()+disablePluginInstall()helpers y los aplica a todos los tests afectados (atarico cubrió 15+ tests; este PR extiende a los 2TestInjectCopiesAllFiles*restantes)internal/components/skills/inject_test.gofilepath.FromSlash()enTestSkillPathForAgenttestdata/golden/sdd-vscode-instructions.goldenTotal: 5 files, +218/-3 lines, 2 commits.
🧪 Test Plan
Unit Tests (Windows 11 Pro local)
go test ./internal/components/...TestSkillPathForAgent— PASS (antes FAIL por path separator)TestGoldenEngram_Antigravity— PASS (antes FAIL por CRLF)TestGoldenSkills_Claude/_OpenCode/_Windsurf/_Kiro— PASSTestInjectOpenCodeMultiMode+ 8 tests hermanos — PASS (antes FAIL por bun/unique-names-generator)TestInjectCopiesAllFilesFromSkillDirectory— PASS (extensión de este PR)TestInjectCopiesAllFilesReportedInResult— PASS (extensión de este PR)TestInjectStrictTDDIsIdempotenty el resto del suite — PASSFuera de scope (pre-existing, no relacionado a este issue):
TestInjectVSCodeWritesContext7ToMCPConfigFileeninternal/components/mcpfalla conInject() first changed = falsetanto enorigin/mainlimpio como en esta rama. Es un bug distinto que amerita su propio issue; no lo toco acá para no ampliar scope.E2E Tests (Docker required)
✅ Contributor Checklist
status:approved)Co-Authored-Bytrailers⏳ Pending maintainer actions
type:buglabel to this PR (contributor cannot self-apply; CI validation blocks merge until then)