I'm playing around with Typescript and NodeJS and I created a card game service in TS. I wrote Karma tests to test my code and the tests pass and they're easy to debug. I'm happy. Then when I go to integrate with NodeJS I find out that in order to "require" the classes (i.e. var something = require('something_module_path')) I need to add a single line to the end of my TS files: export = something_module. My issue is that this breaks my Karma tests (Uncaught ReferenceError: module is not defined): the TS line export = something_module gets compiled to JS module.exports = something_module.
I've been stuck on this issue for quite a while: I can get Node to run but I can no longer run my Karma tests or I can run my Karma tests but Node doesn't function because the modules aren't exported. I'm wondering if anybody else has been in this situation and how can I remedy it so that I can integrate my TS files into NodeJS without breaking my Karma tests? I'm thinking that there must be a way to configure Karma to know about Node keywords but I'm stumped.