devcontainers / devcontainers/cli
[Features][test-lib] Add message arg to the check function
- Lingua principale
- TypeScript
- Stelle
- 3k
- Fork
- 457
- Merge medio
- 13h 17m
- PR unite (30g)
- 6
Descrizione
I would like to propose a change to the check function of the dev-container-features-test-lib script.
The function should take a message to display when the test fails, like other testing frameworks have.
The current function code is:
https://github.com/devcontainers/cli/blob/c246645f97fba402c3b1b95983e573e92bcec464/src/spec-node/featuresCLI/utils.ts#L75-L91
I propose to add a message on $2 or the last argument.
Any thoughts on this?
I would suggest something like this:
```bash
check() {
LABEL=$1
MESSAGE = $2 or ${!#}
#
# the rest of the function
#
}
```
The new function should work like the examples below, and be backwards compatible
```bash
old:
check "java version LTS installed as default" \
grep "LTS" <(java --version)
new:
check "java version LTS installed as default" \
grep "LTS" <(java --version) \
"REASON: The installed version is: $(java --version)"
or
check "java version LTS installed as default" \
"REASON: The installed version is: $(java --version)" \
grep "LTS" <(java --version)
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da src/spec-node/featuresCLI/utils.ts#L75-L91 e analizza come la funzione check viene chiamata dai test delle funzionalità esistenti. Definisci come distinguere il messaggio opzionale dagli argomenti del comando, mantieni la forma di chiamata attuale e verifica che i check falliti visualizzino il messaggio fornito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- shell, typescript
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 50/100