Stream is not working, when called over jasmine runner in node

28 views
Skip to first unread message

Andreas Schröpfer

unread,
Jan 18, 2016, 11:02:58 AM1/18/16
to Jasmine
I prepared a simple test code:

fs = require("fs-extra");
console
.log("console log output");
fs
.walk(__dirname)
.on("data", function (item) {
  console
.log (item.path);
})


The problem is that the stream is not called, when that files is executed over the jasmine runner in node.js. When I call that file directly over node.js everything works, but with jasmine just the first console.log is called.

My version of jasmine is 2.3.2

I allready tried beforeAll and beforeEach, because it is an async call, but that also gives no output.

So I ask myself:

Are streams not supported? If they are supported, how do I test streams?


streamSpec.js

Gregg Van Hove

unread,
Feb 23, 2016, 12:57:40 PM2/23/16
to jasmi...@googlegroups.com
By default Jasmine runs all specs synchronously, so if you need to call some async code, you need to tell Jasmine. Jasmine looks at how many parameters your function expects to receive. (Docs are here: http://jasmine.github.io/edge/introduction.html#section-Asynchronous_Support). The short version is: no params means normal synchronous execution, but a single param means it is asynchronous and Jasmine will pass a function that needs to be executed when the test has completed.

Hope this helps. Thanks for using Jasmine!

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages