Yeah, there's no good support for it in the language/module system. I have two ideas:

- make a private module that exports everything needed in the public interface and by the tests, and then make a public module that requires the private module and exports only the public interface
- attach an `_helpers` object to the exports that is only meant to be used by tests (similar to your idea, but with slightly less pollution of the public interface) example: https://github.com/Clever/clever-api/blob/query-engine/apps/query-engine/query-engine.coffee#L79-L80. Maybe it would be better to call it `_only_for_testing` or something.

Also, thinking about this specific case more, it's kind of weird that the regex is part of the implementation and also part of the expected output. It seems like a constant - maybe there should be a module with constants?