I have JS project: source code + tests. For now tests are run on original sources, everything works great.
But then sources are minified and I want to run all my tests on their minified version as well. Notice, all function names are renamed because of minification. Is it resolvable task? Ideally would be don't make much changes in tests / sources.
My configuration for now is: TeamCity, karma.js + mocha, closure compiler (advanced optimization).
our approach is as follows. We use the testing suite that comes with closure, we write our tests as per normal and then we use goog.exportSymbol to get the tests working with advanced compilation via "reflection" example:
product.path.SomethingRegressionTest.prototype.placeInvalidSession = function() {
...
}
goog.exportSymbol('test_placeInvalidSession', function() {
core.inject(product.path.SomethingRegressionTest).placeInvalidSession();
});
We use injection here, and in the teardown we destroy all injected instances, but there are a few approaches you could use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With