JavaScript is a difficult language to test with. Unit testing wants to pull each function out to be tested individually, but that extraction can break the amazing implicit structures that nesting can produce. We know how to use closure to obtain privacy, but some advocate the refusal of privacy to favor testability. That is a terrible tradeoff.

So I'm thinking that I want to insert some testing infrastructure directly into my program, delivering direct, explicit access to the private material. But I don't want to have to strip that stuff out when we go into production.

So I want to code that stuff as tagged comments (similar to the /*jslint*/ comments) and have a tool that converts the comments into executable forms automatically at development time. At production time, JSMin removes them along with the other fluff.

The program that does this is a companion to JSMin called JSDev. You give it a list of the tags you want activated. It reads stdin, looking for those tags, and produces on stdout the activated development-mode program.
Shared publiclyView activity