Testing response from a call back failure.
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
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- testing-qa
Línea de trabajo
Comienza con la prueba stripReady mostrada y el ciclo de vida de pruebas asíncronas de nodeunit; después, ejecuta la prueba con la configuración de hardware descrita en el issue. Se considera completado cuando se observa el evento ready y su assertion finaliza antes de que nodeunit termine, y el comportamiento es reproducible o está explicado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
So I have some code that requires waiting for a call back and testing the response of it.
For some reason the callback never managed to get called. I've stepped through the code with the debugger but the nodeunit process finishes (with unfinished tests) before the callback can actually fire. I have no doubt I am doing something wrong but no idea what.
This is the test code I'm using:
exports["Strip - Firmata"] = {
setUp: function(done){
this.board = newBoard();
done();
},
tearDown: function(done) {
Board.purge();
restore(this);
done();
},
stripReady: function(test) {
test.expect(1);
var strip = new pixel.Strip({
data: 6,
length: 8,
board: this.board,
controller: "FIRMATA",
});
strip.on("ready", function() {
console.log("strip ready");
test.ok(true);
test.done();
});
},
}
For context: The stripReady test needs to test that a particular event is being emitted by the strip object once it's good to go (this is talking to some hardware behind the scenes). Down the line I'll want to test the appropriate error events as well.
When I trace this with the debugger, the strip constructor gets called, the handler gets bound but right at the moment the handler is bound nodeunit then exits.
As such it doesn't get a chance to drop into the ready handler shown above. I can trace to the point where it emits the message on the Strip side but that event handler never gets called.
So the question is how do I get nodeunit to hang around long enough to get the response back?
FYI the strip constructor is correct and it working properly with the hardware.
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.9k
- Forks
- 359
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 caolan/nodeunit
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
Todos los issues de caolan/nodeunit
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
521xueweihan/HelloGitHub#4025 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
yetone/magpie#2844 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
c1overzz/dsh-bili-scroll#22 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
maproulette/maproulette-frontend#2944 ·
Los mantenedores suelen responder en 1 día