Skip to content

Commit b4da468

Browse files
committed
re-export closure's COMPILED global
Despite the comments, we do in fact rely on closure's COMPILED global in CommonJS tests. This variable signals some tests to skip checking data that has likely been optimized away and is used by things like debug_test.js that do name checking. Previously, this was exported by the (now dead) closure testing asserts export for CommonJS. It has now been re-homed to the testdeps.
1 parent cf834e5 commit b4da468

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

commonjs/export_testdeps.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ goog.require('goog.crypt.base64');
1313
goog.require('goog.testing.PropertyReplacer');
1414

1515
exports.goog = goog;
16+
17+
// The COMPILED variable is set by Closure compiler to "true" when it compiles
18+
// JavaScript, so in practice this is equivalent to "exports.COMPILED = true".
19+
// This will disable some debugging functionality in debug.js, such as
20+
// attempting to check names that have been optimized away.
21+
exports.COMPILED = COMPILED

commonjs/rewrite_tests_for_commonjs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ var pkg = null;
6666
console.log("var global = Function('return this')();");
6767
console.log("var googleProtobuf = require('google-protobuf');");
6868
console.log("var testdeps = require('testdeps_commonjs');");
69+
console.log("global.COMPILED = testdeps.COMPILED;");
6970
console.log("global.goog = testdeps.goog;");
7071
console.log("global.jspb = googleProtobuf;");
7172
console.log("");

0 commit comments

Comments
 (0)