Supply AbortController signal to tests
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, node.js
- Área
- testing-qa
Línea de trabajo
Empieza rastreando cómo están implementados el parámetro de flags de prueba y el manejo existente de onCleanup. Revisa las pruebas relevantes para el comportamiento de cleanup, luego añade la señal de AbortController a los flags que se pasan a las pruebas y verifica que lab la aborte cuando se ejecute el cleanup.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Support plan
- is this issue currently blocking your project? (yes/no): no
- is this issue affecting a production system? (yes/no): no
Context
- node version: 14+
- module version: 24.3.2
- environment (e.g. node, browser, native): node 14+
- used with (e.g. hapi application, another framework, standalone, ...):
- any other relevant information:
What problem are you trying to solve?
Simpler cleanup of failed (or time outed) tests.
Do you have a new or modified API suggestion to solve the problem?
Add an AbortController signal property to the flags parameter. This way a test can pass it on, eg.:
it('performs a fetch', async ({ signal }) => {
const req = http.request('http://example.org', { signal });
const [res] = await Events.onceee(req, 'response'); // Crashes since `onceee` does not exist.
expect(res.statusCode).to.equal(200);
});
Without the signal, the code crashes before any event emitters are added, which obviously causes the test to fail. However, the request continues processing. If it errors at any point, it will cause a process uncaughtException, which will cause whatever subsequent test that is running to fail.
With the signal, which lab should trigger at the same time as calling onCleanup, it will be guaranteed to cause a process uncaughtException, but this time it should be an immediate AbortError which can be ignored, causing no further harm. This is on top of the obvious effect of aborting the no longer relevant request.
Note: This feature overlaps with the existing onCleanup flag. Any code using non-async onCleanup, can assign the logic as an event listener:
it('does something', async ({ signal }) => {
signal.addEventListener('abort', () => {
/* onCleanup logic goes here */
});
// or even simpler
signal.onabort = () => {
/* onCleanup logic goes here */
};
});
- Lenguaje dominante
- JavaScript
- Estrellas
- 737
- Forks
- 176
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hapijs/lab
-
remove eslint from dep, add as peer depQuizá libre de nuevo @Marsup la tomó hace 603 días y no hay ningún pull request abierto. Abiertofeature
-
support
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
-
support
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
support
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Todos los issues de hapijs/lab
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 87/100
OWASP/CheatSheetSeries#2905 ·
Los mantenedores suelen responder en 1 día
-
[P2] PCアプリにバージョンと更新情報の表示がないAbiertodesktop enhancement P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
AllTheMods/ATM10-Aeronautics#159 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ComposioHQ/composio#5249 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
zilliztech/memsearch#838 ·
Los mantenedores suelen responder en 1 día