You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into an issue with vows for events that fire multiple times. According to @indexzero's comment in #79, firing callbacks multiple times should be possible, so hopefully I'm correct in thinking firing multiple events should also. I'd like to know whether the behaviour I'm seeing is expected, a bug, or if I'm going about it the wrong way.
Basically I'm doing some testing of hook.io hooks, using the new event support from #109/#145, and in some cases I'm testing events that need to fire multiple times, and I have to verify they fired the correct number of times. So, I use a macro to generate a vow for the event that closes over a counter which is incremented each time the vow fires, and another vow that later on checks the counter. So far so good.
What happens is that the batch.honored counter is incremented each time a duplicate event is fired, and so sometimes in tryEnd (in lib/vows/suite.js) this condition fails:
This didn't break my own tests or the Vows tests, but, it might be better instead to change the way addVow works so that batch.total gets set correctly when dealing with events that fire multiple times.
If this behaviour is supposed to work I can put together a failing test.
The text was updated successfully, but these errors were encountered:
…s#191)
Add failing test for events that fire multiple times.
In `lib/vows/suite.js` add a property `count` to each vow which is incremented
every time the vow is executed.
In `runTest` (in `addVow` in `lib/vows.js`), on each execution increment
`batch.total` if a vow has been executed more than once.
Add failing test for events that fire multiple times.
In `lib/vows/suite.js` add a property `count` to each vow which is incremented
every time the vow is executed.
In `runTest` (in `addVow` in `lib/vows.js`), on each execution increment
`batch.total` if a vow has been executed more than once.
I'm running into an issue with vows for events that fire multiple times. According to @indexzero's comment in #79, firing callbacks multiple times should be possible, so hopefully I'm correct in thinking firing multiple events should also. I'd like to know whether the behaviour I'm seeing is expected, a bug, or if I'm going about it the wrong way.
Basically I'm doing some testing of hook.io hooks, using the new event support from #109/#145, and in some cases I'm testing events that need to fire multiple times, and I have to verify they fired the correct number of times. So, I use a macro to generate a vow for the event that closes over a counter which is incremented each time the vow fires, and another vow that later on checks the counter. So far so good.
What happens is that the
batch.honored
counter is incremented each time a duplicate event is fired, and so sometimes intryEnd
(inlib/vows/suite.js
) this condition fails:because there were more vows honored than
batch.total
(which is incremented once whenaddVow
is called).The result is that the batch, while passing, hangs indefinitely.
I was able to hack around this temporarily by changing the first
===
to>=
and moving the tally,down into
finish()
.This didn't break my own tests or the Vows tests, but, it might be better instead to change the way
addVow
works so thatbatch.total
gets set correctly when dealing with events that fire multiple times.If this behaviour is supposed to work I can put together a failing test.
The text was updated successfully, but these errors were encountered: