Re: [nodejs] Tips on testing internals w/ mocha

2013-01-22 Thread Boris Egorov
Your tests can talk to third party logging facility, that your app also uses (like winston or Bunyan logs) to ensure that things you anticipate really happens. On Wednesday, January 23, 2013, taterbase wrote: > I've been trying to gear my development to be more test oriented and one > thing I've

[nodejs] Tips on testing internals w/ mocha

2013-01-22 Thread taterbase
I've been trying to gear my development to be more test oriented and one thing I've run into was not being able to test the going-ons of my app that happen internally without effect to the outside world. When a request comes in I would like to make sure certain things happen within the server bu

[nodejs] Re: suggestions for API tests

2013-01-22 Thread tjholowaychuk
https://github.com/visionmedia/supertest is another alternated specific to testing http vs using request/superagent "raw" which gets a bit redundant On Jan 22, 2:55 pm, John Rellis wrote: > Hey Folks, > > New to nodejs so apologies if I offend anyone :) > > Out of the gate, I am hoping to write a

Re: [nodejs] a pakage that exports few modules

2013-01-22 Thread Austin William Wright
On Monday, January 21, 2013 7:46:01 PM UTC-7, Isaac Schlueter wrote: > Who's a wall? You can either put your files in the root of your > package, or you can put "lib/" or whatever in your require() function > calls. You're saying that you want to add complexity to Node that *no > one else wan

[nodejs] Re: Socket.io error

2013-01-22 Thread phj123abc
resuming: any event that interacts with the socket ... io.on("connection" , function(---> this guy <--- ){...}) throws an error -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are

Re: [nodejs] Socket.io error

2013-01-22 Thread phj123abc
take a look at this : io.sockets.on('connection', function (socket) { console.log(socket.id); socket.on('some-event' , function(some_data){ socket.emit(socket.id); }) }); when this error occurs, if i call the event 'some-event' the socket is undefined, so i cant get the id that and i r

Re: [nodejs] Socket.io error

2013-01-22 Thread Guillermo Rauch
This is harmless. It occurs with certain proxies that break the websocket protocol, and can't really be avoided. The client will just fall back to xhr-polling. On Tue, Jan 22, 2013 at 5:52 PM, wrote: > Hello, i made a medium size app, the server was running for 2 days(with > some tests and no h

[nodejs] how to end request and retry - after getting response close

2013-01-22 Thread am_p1
Node and js noobie here so if there's a simple fix for this... I admit my humiliation in advance... I'm receiving millions of xml packets a day using node to pull from a streaming api and it's working great using less than 1% of my server!! But about 0 to 2 times a day "response end" followed b

[nodejs] Socket.io error

2013-01-22 Thread phj123abc
Hello, i made a medium size app, the server was running for 2 days(with some tests and no hard work) and then i started to use it on the company that requested it, but after 4 hours of work(several request from 4 different machines), the following error pops up: warn: websocket parser error:

Re: [nodejs] suggestions for API tests

2013-01-22 Thread Martin Wawrusch
Yeah mocha + request are great for this kind of stuff. Sent from my iPhone On Jan 22, 2013, at 4:55 PM, Boris Egorov wrote: > You can pick `mocha` (http://visionmedia.github.com/mocha/) or `vows` > (http://vowsjs.org/) to write your tests and mikeal's `request` > (https://github.com/mikeal/r

Re: [nodejs] suggestions for API tests

2013-01-22 Thread Boris Egorov
You can pick `mocha` (http://visionmedia.github.com/mocha/) or `vows` ( http://vowsjs.org/) to write your tests and mikeal's `request` ( https://github.com/mikeal/request) to perform actual http requests to your API. May be there are more specific tools for your problem, but you definitely can sol

[nodejs] suggestions for API tests

2013-01-22 Thread John Rellis
Hey Folks, New to nodejs so apologies if I offend anyone :) Out of the gate, I am hoping to write a bunch of tests to test an external REST API. This API is not written by me, I just have access to the endpoints. I would like to write these tests in nodejs and launch them as a test suite and

Re: [nodejs] Running javascript code "safely"

2013-01-22 Thread Gustavo Machado
Jorge, That's an interesting approach, however it does not support windows, am I correct? How about it's stability, I can see that it's in 0.1.4, are you confident running it in production? Thanks, Gustavo Machado machad...@gmail.com On Jan 20, 2013, at 8:32 AM, Jorge Chamorro wrote: > On

[nodejs] Re: New js-yaml coming soon. 20x-100x speed improvenent :)

2013-01-22 Thread Brian Link
Great new, Vitaly! We use yaml for much of our configuration and a snappier app-startup-time can't hurt. On Friday, January 18, 2013 2:34:23 AM UTC-5, Vitaly Puzrin wrote: > > I'd like to boast with rewritten js-yaml, that will be released soon. This > work was inspired by mongodb/redis drivers

[nodejs] Re: New js-yaml coming soon. 20x-100x speed improvenent :)

2013-01-22 Thread nin jin
Good news for yaml, but still very slow, because yaml is too comlex. In example, i converted yaml samples to tree format (https://github.com/nin-jin/node-jin#tree) with type hints (date, number, link to subtree, string is default), and compared perfomance. ==

Re: [nodejs] [Idea]: npm as a dependancy injector.

2013-01-22 Thread Matt Walters
I built a nearly identical module with a nearly identical name. :P https://github.com/mateodelnorte/mockrequire 'npm install mockrequire' will get it. Matt On Tuesday, January 22, 2013 4:57:57 AM UTC-5, José F. Romaniello wrote: > > This doesnt work in practice because you might want to use di

Re: [nodejs] [Idea]: npm as a dependancy injector.

2013-01-22 Thread Daniel Rinehart
Jacob, We've used this same dependency injection approach in our code with great success, both from a runtime and testing standpoint. In your example you make the "light dependencies" distinction which we do as well. For me I usually treat modules that expose pure functions (underscore or async)

Re: [nodejs] [Idea]: npm as a dependancy injector.

2013-01-22 Thread Jacob Groundwater
First, it's awesome that we're talking about dependency injection. Second, I believe *good* dependency injection requires inversion of control . Your modules should not directly require dependencies if possible, rather design them to accept their

Re: [nodejs] Re: How to detect if file is text or binary using Nodejs?

2013-01-22 Thread Nathan Rajlich
Perhaps try node-mmmagic: https://github.com/mscdex/mmmagic On Tue, Jan 22, 2013 at 6:14 AM, greelgorke wrote: > may be this can help you too > http://en.wikipedia.org/wiki/Byte_Order_Mark#Representations_of_byte_order_marks_by_encoding > > Am Dienstag, 22. Januar 2013 15:13:31 UTC+1 schrieb gre

[nodejs] Re: Node.js Domains help

2013-01-22 Thread Ash
the error caught in the domain listener has this { [TypeError: Cannot read property 'durationsec' of undefined] domain_thrown: true, domain: { domain: null, _events: { error: [Function] }, _maxListeners: 10, members: [] } } and the error which leaks out into my program is

[nodejs] Re: Node.js Domains help

2013-01-22 Thread greelgorke
what does the error message say? in line 4: function name: next and in line 12: param named: next is this defined somewhere in scope? if not, then you get a TypeError function next is not defined or something like that in your "error"-event handler which is outside of the domain Am Dienstag, 2

[nodejs] Node.js reports(export some data to pdf/docx/xml)

2013-01-22 Thread Silviu
Hi, I just wanted to know if there are any modules to generate reports in Node.js. I am looking for something similar to Jasper Reports from Java world or similar with PDF Kit . The problem with PDF Kit is that there are not enough options and I need to

[nodejs] Node.js Domains help

2013-01-22 Thread Ash
Hi I am trying to isolate a 3rd party type error using domains here is the code (sorry its in coffeescript) http://pastie.org/private/iexulds93m8fbfpzdbmtoq the d.on "error" catches error fine, but the error still leaks out to my program and crashes it am i doing something wrong here? thanks --

[nodejs] Re: How to detect if file is text or binary using Nodejs?

2013-01-22 Thread greelgorke
may be this can help you too http://en.wikipedia.org/wiki/Byte_Order_Mark#Representations_of_byte_order_marks_by_encoding Am Dienstag, 22. Januar 2013 15:13:31 UTC+1 schrieb greelgorke: > > i guess only by try and error. if you want to put the content of the file > to json, you will use encodin

[nodejs] Re: How to detect if file is text or binary using Nodejs?

2013-01-22 Thread greelgorke
i guess only by try and error. if you want to put the content of the file to json, you will use encoding anyway, because json is a text format. so, i don't know what kind of data is in the files, but i would just use utf8 and see if anything comes out of it. Am Dienstag, 22. Januar 2013 11:54:1

Re: [nodejs] Assertion uv__has_active_reqs(loop) failed

2013-01-22 Thread Michael Wittig
the module node_gc caused the issue... thx for your help! Am 22.01.2013 um 14:06 schrieb Ben Noordhuis : > On Tue, Jan 22, 2013 at 12:43 PM, Michael wrote: >> I did it 3 times, always the same result: >> >> Starting program: /usr/local/bin/node index.js >> [Thread debugging using libthread_db e

Re: [nodejs] Re: dgram sockets and socket options

2013-01-22 Thread Ben Noordhuis
On Tue, Jan 22, 2013 at 1:12 PM, An dreas wrote: > > > On Tuesday, January 22, 2013 12:26:18 PM UTC+1, Ben Noordhuis wrote: >> >> On Tue, Jan 22, 2013 at 10:46 AM, An dreas >> wrote: >> > Currently I need to set SO_RCVBUF way higher on dgram-sockets I use >> > combined >> > with multicast... >> >

Re: [nodejs] Assertion uv__has_active_reqs(loop) failed

2013-01-22 Thread Ben Noordhuis
On Tue, Jan 22, 2013 at 12:43 PM, Michael wrote: > I did it 3 times, always the same result: > > Starting program: /usr/local/bin/node index.js > [Thread debugging using libthread_db enabled] > [New Thread 0x77fef700 (LWP 31807)] > WARNING: ev_io is deprecated, use uv_poll_t > WARNING: ev_time

Re: [nodejs] Re: Data validation

2013-01-22 Thread Dan Milon
It is not about performance, it is about forcefully trying to merge two completely different things. I might be wrong, but I can't think of a pretty and useful API for a validation library that would transparently issue async operations, and then let you get those results if validation passed. Appl

Re: [nodejs] Re: dgram sockets and socket options

2013-01-22 Thread An dreas
On Tuesday, January 22, 2013 12:26:18 PM UTC+1, Ben Noordhuis wrote: > > On Tue, Jan 22, 2013 at 10:46 AM, An dreas > > > wrote: > > Currently I need to set SO_RCVBUF way higher on dgram-sockets I use > combined > > with multicast... > > Why is that? > > If you're experiencing packet loss,

Re: [nodejs] Re: Data validation

2013-01-22 Thread Dan Milon
comments inline. On 01/22/2013 01:56 PM, Alan Hoffmeister wrote: > Well, generaly I don't wait for the db to throw a duplication error to > warn the user that he needs to pick up another username. But of course, > if the form is 100% valid I still need to take care about his username > at the db l

Re: [nodejs] Re: Data validation

2013-01-22 Thread Alan Hoffmeister
Well, generaly I don't wait for the db to throw a duplication error to warn the user that he needs to pick up another username. But of course, if the form is 100% valid I still need to take care about his username at the db layer. Another example: I need to check if a file exists, send a request t

Re: [nodejs] Assertion uv__has_active_reqs(loop) failed

2013-01-22 Thread Michael
I did it 3 times, always the same result: Starting program: /usr/local/bin/node index.js [Thread debugging using libthread_db enabled] [New Thread 0x77fef700 (LWP 31807)] WARNING: ev_io is deprecated, use uv_poll_t WARNING: ev_timer is deprecated, use uv_timer_t [New Thread 0x76f17700 (LWP

Re: [nodejs] Re: dgram sockets and socket options

2013-01-22 Thread Ben Noordhuis
On Tue, Jan 22, 2013 at 10:46 AM, An dreas wrote: > Currently I need to set SO_RCVBUF way higher on dgram-sockets I use combined > with multicast... Why is that? If you're experiencing packet loss, you will want to verify that the issue is really on your side. If packets get lost in transit or

Re: [nodejs] Re: Data validation

2013-01-22 Thread Pedro Teixeira
Duplicate validation should be handled at the persistence layer, not in Node, since you have a concurrency issue there (think of 2 simultaneous requests). -- Pedro On Tuesday, January 22, 2013 at 11:06 AM, Alan Hoffmeister wrote: > So how do you validate duplicated username, e-mail, etc..? A

Re: [nodejs] Re: Data validation

2013-01-22 Thread Alan Hoffmeister
So how do you validate duplicated username, e-mail, etc..? As far as I could see I need to split the validation process for this, and I think that this is fucking up with the validation. -- Att, Alan Hoffmeister 2013/1/22 Jake Verbaten > Your validating logic is only async if it does IO. > > I

[nodejs] Re: dgram sockets and socket options

2013-01-22 Thread An dreas
Is there progress with this "feature" ? Currently I need to set SO_RCVBUF way higher on dgram-sockets I use combined with multicast... -Andy -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message b

[nodejs] How to detect if file is text or binary using Nodejs?

2013-01-22 Thread Vladimir Starkov
How to detect if file is text or binary using Nodejs? I need it to put file content in json and if file is text, I will use encoding parameter in fs.readFile, and if the file is binary, I will read it without encoding -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.c

Re: [nodejs] [Idea]: npm as a dependancy injector.

2013-01-22 Thread José F . Romaniello
This doesnt work in practice because you might want to use different test doubles for different tests, there are several ways to mock module dependencies, on option is to use vm.runInNewContext I did a module for this https://github.com/jfromaniello/mockuire it is like commonjs's require, but yo

[nodejs] Re: [Idea]: npm as a dependancy injector.

2013-01-22 Thread Floby
if your tests live in a test/ subdirectory of your project, then you could place your mocked modules in test/node_modules so that they will be loaded before the "real" dependencies. no need to hack. On Sunday, 20 January 2013 05:15:13 UTC+1, Athan Clark wrote: > > Hello everyone. I'd like to mak

Re: [nodejs] Re: Data validation

2013-01-22 Thread Jake Verbaten
Your validating logic is only async if it does IO. If your validation does IO you fucked up. You don't need async support. On Mon, Jan 21, 2013 at 10:11 AM, Alan Hoffmeister < alanhoffmeis...@gmail.com> wrote: > Katsumoto, thats a nice well known package, but I think that lacks async > support.

[nodejs] Re: [Idea]: npm as a dependancy injector.

2013-01-22 Thread greelgorke
i thought about suggesting it, but i decided not to do it. test are insurance tools, that the cases you've thought about are working and do not contain bugs. but tests are software too and may have bugs in it. so thats why my testing tools and strategy have to be as simple as it could, so i can