Simple way to write sync functions in node.js
coffeescript, javascript, node.js, tdd
Solution
You can use node-sync for that purpose https://github.com/0ctave/node-sync
But in general I'd recommend you don't. The mocha test framework for example allows you to do async tests. Also async waterfall https://github.com/caolan/async#waterfall is a nice way to pseudo synchronize your code.
I'd say stay in the async mind frame. Even when testing.
Problem
For testing purposes my code would look nicer if I would be able to execute some test functions waiting in sync for their results. I know the principal ideas about event programming in node.js, but during tests which are run synchronously blocking processor is not a problem for me. Is there any simple (one-liner would be best) solution to execute function which returns some values by callback(err, ret) to return that ret by "return", and pretend that execution is synchronous.