aboutsummaryrefslogtreecommitdiffhomepage
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/commonjs/import_test.js (renamed from js/import_test.js)16
-rw-r--r--js/commonjs/test6/test6.proto (renamed from js/test6/test6.proto)2
-rw-r--r--js/commonjs/test7/test7.proto (renamed from js/test7/test7.proto)2
-rw-r--r--js/gulpfile.js7
4 files changed, 15 insertions, 12 deletions
diff --git a/js/import_test.js b/js/commonjs/import_test.js
index 6655685f..ffa34fea 100644
--- a/js/import_test.js
+++ b/js/commonjs/import_test.js
@@ -30,16 +30,18 @@
// Test suite is written using Jasmine -- see http://jasmine.github.io/
-goog.setTestOnly();
-goog.require('goog.json');
-goog.require('goog.testing.asserts');
-// CommonJS-LoadFromFile: google-protobuf jspb
-goog.require('jspb.Message');
+var googleProtobuf = require('google-protobuf');
+var asserts = require('closure_asserts_commonjs');
+var global = Function('return this')();
-// CommonJS-LoadFromFile: test7/test7_pb proto.jspb.test.framing
-goog.require('proto.jspb.test.framing.FramingMessage');
+// Bring asserts into the global namespace.
+googleProtobuf.object.extend(global, asserts);
+googleProtobuf.exportSymbol('jspb.Message', googleProtobuf.Message, global);
+
+var test7_pb = require('./test7/test7_pb');
+googleProtobuf.exportSymbol('proto.jspb.test.framing.FramingMessage', test7_pb.FramingMessage, global);
describe('Import test suite', function() {
it('testImportedMessage', function() {
diff --git a/js/test6/test6.proto b/js/commonjs/test6/test6.proto
index 60c26f8a..a060925f 100644
--- a/js/test6/test6.proto
+++ b/js/commonjs/test6/test6.proto
@@ -37,4 +37,4 @@ package jspb.test.importing;
message ImportedMessage {
string string_value = 1;
-} \ No newline at end of file
+}
diff --git a/js/test7/test7.proto b/js/commonjs/test7/test7.proto
index 19d563dd..f5574a3d 100644
--- a/js/test7/test7.proto
+++ b/js/commonjs/test7/test7.proto
@@ -39,4 +39,4 @@ import "test6/test6.proto";
message FramingMessage {
jspb.test.importing.ImportedMessage imported_message = 1;
-} \ No newline at end of file
+}
diff --git a/js/gulpfile.js b/js/gulpfile.js
index e8028b4b..36fd9fda 100644
--- a/js/gulpfile.js
+++ b/js/gulpfile.js
@@ -5,7 +5,7 @@ var glob = require('glob');
var protoc = process.env.PROTOC || '../src/protoc';
gulp.task('genproto_closure', function (cb) {
- exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.proto test*/*.proto ../src/google/protobuf/descriptor.proto',
+ exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.proto ../src/google/protobuf/descriptor.proto',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
@@ -14,7 +14,7 @@ gulp.task('genproto_closure', function (cb) {
});
gulp.task('genproto_commonjs', function (cb) {
- exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,binary:commonjs_out -I ../src -I . *.proto test*/*.proto ../src/google/protobuf/descriptor.proto',
+ exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,binary:commonjs_out -I ../src -I commonjs -I . *.proto commonjs/test*/*.proto ../src/google/protobuf/descriptor.proto',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
@@ -56,7 +56,8 @@ gulp.task('make_commonjs_out', ['dist', 'genproto_commonjs', 'commonjs_asserts']
exec(cmd +
'cp commonjs/jasmine.json commonjs_out/jasmine.json && ' +
- 'cp google-protobuf.js commonjs_out/test_node_modules',
+ 'cp google-protobuf.js commonjs_out/test_node_modules && ' +
+ 'cp commonjs/import_test.js commonjs_out/import_test.js',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);