Martin, 

Sidedoor seems like an elegant solution. I will give this a try.

Thanks,

Jeff

On Sunday, 6 May 2012 10:27:51 UTC-5, Martin Cooper wrote:
>
> On Thu, May 3, 2012 at 8:04 PM, P. Douglas Reeder  wrote: 
> > Writing functional tests for the functions exposed by a module is 
> > straightforward, using any of the many TDD framework for Node. 
> > 
> > However, it's not clear what the best approach is, to writing unit 
> > tests for functions that are not exposed by a module. 
> > 
> > One possibility is to write unit tests as part of the module and 
> > expose one or more test methods.  However, it's not clear how unit 
> > tests could then be excluded from a production module. 
> > 
> > What is the usual approach? is it possible to write a test submodule 
> > and cleanly exclude it from a production module? 
>
> This is exactly why I wrote Sidedoor: 
>
> https://github.com/mfncooper/sidedoor 
>
> It lets you expose secondary APIs from your module that don't pollute 
> the regular 'exports' API. 
>
> Your tests know that they need to access the functions exposed via the 
> "side door", so they use the Sidedoor API to get at those functions. 
> Your main module can choose to always expose the secondary API (safe 
> in the knowledge that someone looking at 'exports' won't see it), or 
> choose to conditionally expose it, if you want it to just not be there 
> outside of tests. 
>
> -- 
> Martin Cooper 
>
>
> > -- 
> > 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 subscribed to the Google 
> > Groups "nodejs" group. 
> > To post to this group, send email to [email protected] 
> > To unsubscribe from this group, send email to 
> > [email protected] 
> > For more options, visit this group at 
> > http://groups.google.com/group/nodejs?hl=en?hl=en 
>

-- 
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 subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to