Fix: reduce huge bundle size by adding ADVANCED_OPTIMIZATIONS when compiling protobuf JS by sayjeyhi · Pull Request #128 · protocolbuffers/protobuf-javascript (original) (raw)
@dibenede, Thanks for the review, Yeah I've checked them and even tried to require the assertion library, but it seems
The tests were passing without a reliable reason and broke with our unwanted libs removal.
cuz only this test is failing, because assertThrows used in this test:
it('testCopyInto_notSameType', function() {
var a = new proto.jspb.test.TestClone();
var b = new proto.jspb.test.Simple1(['str', ['s1', 's2']]);
var e = assertThrows(function() {
jspb.Message.copyInto(a, b);
});
assertContains('should have the same type', e.message);
});
and assertThrows is using raiseException internally:
goog.testing.asserts.raiseException = function(comment, opt_message) {
var e = new goog.testing.JsUnitException(comment, opt_message);
var testCase = _getCurrentTestCase();
if (testCase) {
testCase.raiseAssertionException(e);
} else {
goog.global.console.error(
'Failed to save thrown exception: no test case is installed.');
throw e;
}
};
when this _getCurrentTestCase couldn't get the test case else to block fires, and goog.global.console is used without checking if it is imported and it is giving us an error.
IDK, maybe we can ignore this test, or we can rewrite it using other test functions rather than assertThrows