requires: declare commands that must resolve, and report where each landed

Abierto
#54 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli, testing-qa

Línea de trabajo

Empieza rastreando cómo front matter gestiona path: y cómo llega el PATH compuesto a las sesiones; después, inspecciona el comportamiento existente de expansión de env: y el ejecutor de pruebas golden. Añade la resolución de requires: antes de la primera sesión, respetando PATHEXT e indicando los directorios buscados en caso de fallo. Informa sobre cada comando resuelto, su ruta, el número de archivos y el número de sesiones, para que una ejecución muestre qué se ejercitó realmente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

tryscript resolves a command through PATH and says nothing about where it landed. For a
golden suite, that is the difference between a proven result and a green check.

A golden test's whole claim is that a particular program produced particular bytes.
path: prepends to the inherited PATH rather than replacing it, so if a declared entry
fails to resolve — variable unset, build directory cleaned, a typo, a cross-compiled
layout — lookup continues into the inherited PATH and finds whatever is installed there.
The suite then passes while exercising a build nobody selected, with no diagnostic.

That is not hypothetical. It happened in fdu: every golden selected its build with
path: - $TRYSCRIPT_GIT_ROOT/target/debug, and whenever that failed to resolve the
sessions silently fell through to ~/.cargo/bin/fdu — the developer's installed copy —
and passed.

Proposal

requires:
  - fdu

Named commands must resolve before the first session runs. If one does not, abort with a
message naming the command and the directories searched, rather than letting a hundred
confusing diffs appear later.

And report where each landed:

resolved fdu -> /…/target/debug/fdu   (12 files, 129 sessions)

The reporting half is the one that matters. It makes a run legible rather than merely
correct — the same reason a good test harness says what it ran, not just whether it
passed. Today the only way to know which binary a suite exercised is to reason about
PATH composition and hope.

Notes

  • Lookup should respect PATHEXT on Windows rather than assuming a bare name.
  • Resolution should use the same composed PATH the sessions get, including path:
    entries, so it answers the question the sessions will actually ask.
  • Worth failing rather than warning: a suite that runs without the program it is about
    does not produce a weaker result, it produces a meaningless one.

Context

fdu worked around this by naming the binary's directory through a variable and
preflighting it in an external runner script before invoking tryscript. That works, but it
is machinery every project would otherwise have to build for itself, and it cannot report
what tryscript itself resolved.

Related: jlevy/tryscript#51, which made env: expand variables the way path: already
did — the same family of "front matter should be able to say what it means about which
program runs".

Lenguaje dominante
TypeScript
Estrellas
13
Forks
1
Merge medio
3 h 38 min
PR fusionados (30 d)
3

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de jlevy/tryscript

Todos los issues de jlevy/tryscript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.