Testing response from a call back failure.
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- javascript
- Domínio
- testing-qa
Direção de pesquisa
Comece com o teste stripReady mostrado e com o ciclo de vida de testes assíncronos do nodeunit; em seguida, execute o teste com a configuração de hardware descrita na issue. O trabalho estará concluído quando o evento ready for observado e sua assertion for concluída antes que o nodeunit termine, com o comportamento reproduzível ou explicado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 1.9k
- Forks
- 359
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de caolan/nodeunit
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 42/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
Todas as issues de caolan/nodeunit
Issues semelhantes
-
fix(套件): test_bundle 往仓库的 preset/skills 写哨兵,并发跑的 test_installer 拷贝时撞 ENOENT(CI 红)Talvez já em andamento @Miaotofu01 assumiu hoje. Abertaneeds-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Miaotofu01/Study-Mate#216 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
-
beginner-friendly category:fixtures community enhancement first-timers-only good first issue hacktoberfest help wanted low hanging fruit micro-contribution type: task up-for-grabs
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
Berserk-hub150/skillhawk#229 · 1 comentário ·
Mantenedores costumam responder em até 8 dias
-
WlanConfUpdateSensor falsely reports wifi interface appearing when sysfs inode cache is reclaimedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
firewalla/firerouter#2180 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
andromarces/agent-loops#976 ·
Mantenedores costumam responder em até 1 dia