I'm having trouble getting an async event emitter test running in mocha v5.0.4. I'm using a typed Rx based event emitter and node.js v8.10. Can anyone point me in the right direction please?
The first and the second it-blocks work fine. However, the third it-block is never invoked. Mocha doesn't give me a test result (no output at all, mocha runs into the timeout which I set to 10 minutes)
describe('xyz', () => {
const xyz : Xyz = new Xyz(config);
describe('make()', () => {
let emitter : Emitter<Status>;
emitter = xyz.make("abc", 0.01);
it('should return an Emitter', () => {
expect(emitter).to.be.a('Object');
});
it('should eventually return a foo', (done) => {
emitter.on('foo').subscribe( foo => {
expect(foo).to.be.a('foo');
done();
})
});
it('should eventually return a bar', (done) => {
emitter.on('bar').subscribe( bar => {
console.log('foobar!');
expect(bar).to.be.a('bar');
done();
});
});
});
});
What strikes me most is that the event is definitely fired. I can see foobar!
as the console output. I'm not using Spies but sticking to the second example from the mocha documents.