2

I have created a few unit tests for my uncompiled code with QUnit and used sinon to mock functions when needed. But the problem is, after the advanced compilation by the Closure Compiler the function names are changed and thus the Unit Test Cases don't apply to the Compiled Code.

I have read here https://groups.google.com/forum/#!topic/closure-library-discuss/uU2t2xbVtlc that its not required to test the compiled code. But still I want to do that.

So, my questions is if I can port these test cases for the Compiled Code. If yes, then how can I do it?

Hariom Balhara
  • 832
  • 8
  • 19

1 Answers1

3

You'll need to compile your unit tests together with your source. To do that, you'll have to create an extern file for QUnit.

If you want your unit tests in a separate file from your source AFTER compilation, use the --module options: How do I split my javascript into modules using Google's Closure Compiler?

Community
  • 1
  • 1
Chad Killingsworth
  • 14,360
  • 2
  • 34
  • 57