THRIFT-4625: Use let/const variable decorators in ES6 Javascript
diff --git a/lib/js/Gruntfile.js b/lib/js/Gruntfile.js
index 1dcead6..fd290d2 100644
--- a/lib/js/Gruntfile.js
+++ b/lib/js/Gruntfile.js
@@ -3,6 +3,7 @@
//Prerequisites:
// Node Setup - nodejs.org
// Grunt Setup - npm install //reads the ./package.json and installs project dependencies
+// Run grunt - npx grunt // uses project-local installed version of grunt (from package.json)
module.exports = function(grunt) {
'use strict';
@@ -38,7 +39,7 @@
},
shell: {
InstallThriftJS: {
- command: 'mkdir test/build; mkdir test/build/js; mkdir test/build/js/lib; cp src/thrift.js test/build/js/thrift.js'
+ command: 'mkdir -p test/build/js/lib; cp src/thrift.js test/build/js/thrift.js'
},
InstallThriftNodeJSDep: {
command: 'cd ../..; npm install'
@@ -47,7 +48,19 @@
command: 'cd test; ant download_jslibs'
},
ThriftGen: {
- command: '../../compiler/cpp/thrift -gen js -gen js:node -o test ../../test/ThriftTest.thrift'
+ command: [
+ 'mkdir -p test/gen-js',
+ '../../compiler/cpp/thrift -gen js --out test/gen-js ../../test/ThriftTest.thrift',
+ '../../compiler/cpp/thrift -gen js --out test/gen-js ../../test/JsDeepConstructorTest.thrift',
+ 'mkdir -p test/gen-js-jquery',
+ '../../compiler/cpp/thrift -gen js:jquery --out test/gen-js-jquery ../../test/ThriftTest.thrift',
+ 'mkdir -p test/gen-nodejs',
+ '../../compiler/cpp/thrift -gen js:node --out test/gen-nodejs ../../test/ThriftTest.thrift',
+ 'mkdir -p test/gen-js-es6',
+ '../../compiler/cpp/thrift -gen js:es6 --out test/gen-js-es6 ../../test/ThriftTest.thrift',
+ 'mkdir -p test/gen-nodejs-es6',
+ '../../compiler/cpp/thrift -gen js:node,es6 --out ./test/gen-nodejs-es6 ../../test/ThriftTest.thrift',
+ ].join(' && ')
},
ThriftGenJQ: {
command: '../../compiler/cpp/thrift -gen js:jquery -gen js:node -o test ../../test/ThriftTest.thrift'
@@ -58,9 +71,6 @@
ThriftGenDoubleConstants: {
command: '../../compiler/cpp/thrift -gen js -o test ../../test/DoubleConstantsTest.thrift'
},
- ThriftGenES6: {
- command: '../../compiler/cpp/thrift -gen js -gen js:es6 -o test ../../test/ThriftTest.thrift'
- },
ThriftTestServer: {
options: {
async: true,
@@ -71,6 +81,16 @@
},
command: "node server_http.js",
},
+ ThriftTestServerES6: {
+ options: {
+ async: true,
+ execOptions: {
+ cwd: "./test",
+ env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
+ }
+ },
+ command: "node server_http.js --es6",
+ },
ThriftTestServer_TLS: {
options: {
async: true,
@@ -81,88 +101,151 @@
},
command: "node server_https.js",
},
+ ThriftTestServerES6_TLS: {
+ options: {
+ async: true,
+ execOptions: {
+ cwd: "./test",
+ env: {NODE_PATH: "../../nodejs/lib:../../../node_modules"}
+ }
+ },
+ command: "node server_https.js --es6",
+ },
},
qunit: {
ThriftJS: {
options: {
urls: [
- 'http://localhost:8088/test-nojq.html'
- ]
+ 'http://localhost:8089/test-nojq.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ },
}
},
ThriftJSJQ: {
options: {
urls: [
- 'http://localhost:8088/test.html'
- ]
+ 'http://localhost:8089/test.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ },
}
},
ThriftJS_DoubleRendering: {
options: {
- '--ignore-ssl-errors': true,
urls: [
- 'http://localhost:8088/test-double-rendering.html'
- ]
+ 'http://localhost:8089/test-double-rendering.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ ignoreHTTPSErrors: true,
+ },
}
},
ThriftWS: {
options: {
urls: [
- 'http://localhost:8088/testws.html'
- ]
+ 'http://localhost:8089/testws.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ },
}
},
ThriftJS_TLS: {
options: {
- '--ignore-ssl-errors': true,
urls: [
- 'https://localhost:8089/test-nojq.html'
- ]
+ 'https://localhost:8091/test-nojq.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ ignoreHTTPSErrors: true,
+ },
}
},
ThriftJSJQ_TLS: {
options: {
- '--ignore-ssl-errors': true,
urls: [
- 'https://localhost:8089/test.html'
- ]
+ 'https://localhost:8091/test.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ ignoreHTTPSErrors: true,
+ },
}
},
ThriftWS_TLS: {
options: {
- '--ignore-ssl-errors': true,
urls: [
- 'https://localhost:8089/testws.html'
- ]
+ 'https://localhost:8091/testws.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ ignoreHTTPSErrors: true,
+ },
}
},
ThriftDeepConstructor: {
options: {
urls: [
- 'http://localhost:8088/test-deep-constructor.html'
- ]
+ 'http://localhost:8089/test-deep-constructor.html'
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ },
}
},
ThriftWSES6: {
options: {
urls: [
'http://localhost:8088/test-es6.html'
- ]
+ ],
+ puppeteer: {
+ headless: true,
+ args: ['--no-sandbox'],
+ },
}
}
},
jshint: {
- files: ['Gruntfile.js', 'src/**/*.js', 'test/*.js'],
- options: {
- // options here to override JSHint defaults
- globals: {
- jQuery: true,
- console: true,
- module: true,
- document: true
+ // The main thrift library file. not es6 yet :(
+ lib: {
+ src: ['src/**/*.js'],
+ options: {
+ // options here to override JSHint defaults
+ globals: {
+ jQuery: true,
+ console: true,
+ module: true,
+ document: true,
+ },
}
- }
- },
+ },
+ // The test files use es6
+ test: {
+ src: ['Gruntfile.js', 'test/*.js'],
+ options: {
+ // options here to override JSHint defaults
+ globals: {
+ jQuery: true,
+ console: true,
+ module: true,
+ document: true,
+ },
+ esversion: 6,
+ }
+ },
+ }
});
grunt.loadNpmTasks('grunt-contrib-uglify');
@@ -179,16 +262,25 @@
}, 1000);
});
- grunt.registerTask('test', ['jshint', 'shell:InstallThriftJS', 'shell:InstallThriftNodeJSDep', 'shell:ThriftGen',
- 'shell:InstallTestLibs',
- 'shell:ThriftTestServer', 'shell:ThriftTestServer_TLS',
- 'wait',
- 'shell:ThriftGenDeepConstructor', 'qunit:ThriftDeepConstructor',
- 'qunit:ThriftJS', 'qunit:ThriftJS_TLS',
- 'qunit:ThriftWS',
- 'shell:ThriftGenJQ', 'qunit:ThriftJSJQ', 'qunit:ThriftJSJQ_TLS',
- 'shell:ThriftGenES6', 'qunit:ThriftWSES6',
- 'shell:ThriftTestServer:kill', 'shell:ThriftTestServer_TLS:kill',
- ]);
+ grunt.registerTask('installAndGenerate', [
+ 'shell:InstallThriftJS', 'shell:InstallThriftNodeJSDep', 'shell:ThriftGen',
+ 'shell:ThriftGenDeepConstructor',
+ 'shell:InstallTestLibs',
+ ]);
+
+ grunt.registerTask('test', [
+ 'jshint',
+ 'installAndGenerate',
+ 'shell:ThriftTestServer', 'shell:ThriftTestServer_TLS',
+ 'shell:ThriftTestServerES6', 'shell:ThriftTestServerES6_TLS',
+ 'wait',
+ 'qunit:ThriftDeepConstructor',
+ 'qunit:ThriftJS', 'qunit:ThriftJS_TLS',
+ 'qunit:ThriftWS',
+ 'qunit:ThriftJSJQ', 'qunit:ThriftJSJQ_TLS',
+ 'qunit:ThriftWSES6',
+ 'shell:ThriftTestServer:kill', 'shell:ThriftTestServer_TLS:kill',
+ 'shell:ThriftTestServerES6:kill', 'shell:ThriftTestServerES6_TLS:kill',
+ ]);
grunt.registerTask('default', ['test', 'concat', 'uglify', 'jsdoc']);
};
diff --git a/lib/js/README.md b/lib/js/README.md
index dfa6e82..9d51e2a 100644
--- a/lib/js/README.md
+++ b/lib/js/README.md
@@ -38,19 +38,12 @@
sources from the internet. To build the JavaScript branch
of Apache Thrift execute the command:
- grunt
+ npx grunt
-This runs the grunt build tool, linting all of the source
-files, setting up and running the tests, concatenating and
-minifying the main libraries and generating the html
-documentation.
-
-If grunt is not installed you can install it with npm
-like this:
-
- sudo npm install -g grunt-cli
- npm install grunt --save-dev
-
+This runs the grunt build tool (from within `./node_modules/.bin/`),
+linting all of the source files, setting up and running the
+tests, concatenating and minifying the main libraries and
+generating the html documentation.
Tree
----
diff --git a/lib/js/package-lock.json b/lib/js/package-lock.json
index 02347cf..f0943b0 100644
--- a/lib/js/package-lock.json
+++ b/lib/js/package-lock.json
@@ -9,16 +9,13 @@
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg="
},
- "ajv": {
- "version": "5.5.2",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
- "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
+ "agent-base": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
+ "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
"dev": true,
"requires": {
- "co": "4.6.0",
- "fast-deep-equal": "1.1.0",
- "fast-json-stable-stringify": "2.0.0",
- "json-schema-traverse": "0.3.1"
+ "es6-promisify": "5.0.0"
}
},
"align-text": {
@@ -67,40 +64,16 @@
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
"dev": true
},
- "asn1": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
- "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
- "dev": true
- },
- "assert-plus": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
- "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
- "dev": true
- },
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
"dev": true
},
- "asynckit": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
- "dev": true
- },
- "aws-sign2": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
- "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
- "dev": true
- },
- "aws4": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
- "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
+ "async-limiter": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
+ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true
},
"babylon": {
@@ -114,30 +87,11 @@
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
- "bcrypt-pbkdf": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
- "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
- "dev": true,
- "optional": true,
- "requires": {
- "tweetnacl": "0.14.5"
- }
- },
"bluebird": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
"integrity": "sha1-2VUfnemPH82h5oPRfukaBgLuLrk="
},
- "boom": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
- "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
- "dev": true,
- "requires": {
- "hoek": "4.2.1"
- }
- },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -157,6 +111,12 @@
"pako": "0.2.9"
}
},
+ "buffer-from": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
+ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
+ "dev": true
+ },
"buffer-shims": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
@@ -185,12 +145,6 @@
"map-obj": "1.0.1"
}
},
- "caseless": {
- "version": "0.12.0",
- "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
- "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
- "dev": true
- },
"catharsis": {
"version": "0.8.9",
"resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz",
@@ -268,12 +222,6 @@
"wordwrap": "0.0.2"
}
},
- "co": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
- "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
- "dev": true
- },
"coffeescript": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.10.0.tgz",
@@ -286,15 +234,6 @@
"integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=",
"dev": true
},
- "combined-stream": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
- "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
- "dev": true,
- "requires": {
- "delayed-stream": "1.0.0"
- }
- },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -390,26 +329,6 @@
}
}
},
- "cryptiles": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
- "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
- "dev": true,
- "requires": {
- "boom": "5.2.0"
- },
- "dependencies": {
- "boom": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
- "integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=",
- "dev": true,
- "requires": {
- "hoek": "4.2.1"
- }
- }
- }
- },
"currently-unhandled": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
@@ -419,15 +338,6 @@
"array-find-index": "1.0.2"
}
},
- "dashdash": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
- "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
- "dev": true,
- "requires": {
- "assert-plus": "1.0.0"
- }
- },
"date-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@@ -445,9 +355,9 @@
}
},
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
@@ -459,12 +369,6 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
- "delayed-stream": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
- "dev": true
- },
"dom-serializer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
@@ -514,16 +418,6 @@
"domelementtype": "1.3.0"
}
},
- "ecc-jsbn": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
- "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
- "dev": true,
- "optional": true,
- "requires": {
- "jsbn": "0.1.1"
- }
- },
"entities": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz",
@@ -545,6 +439,15 @@
"integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==",
"dev": true
},
+ "es6-promisify": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
+ "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
+ "dev": true,
+ "requires": {
+ "es6-promise": "4.2.4"
+ }
+ },
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -568,53 +471,71 @@
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"dev": true
},
- "extend": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
- "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=",
- "dev": true
- },
"extract-zip": {
- "version": "1.6.6",
- "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
- "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
+ "version": "1.6.7",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz",
+ "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=",
"dev": true,
"requires": {
- "concat-stream": "1.6.0",
+ "concat-stream": "1.6.2",
"debug": "2.6.9",
- "mkdirp": "0.5.0",
+ "mkdirp": "0.5.1",
"yauzl": "2.4.1"
},
"dependencies": {
- "mkdirp": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
- "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=",
+ "concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
- "minimist": "0.0.8"
+ "buffer-from": "1.1.1",
+ "inherits": "2.0.3",
+ "readable-stream": "2.3.6",
+ "typedarray": "0.0.6"
+ }
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "dev": true,
+ "requires": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "isarray": "1.0.0",
+ "process-nextick-args": "2.0.0",
+ "safe-buffer": "5.1.1",
+ "string_decoder": "1.1.1",
+ "util-deprecate": "1.0.2"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.1"
}
}
}
},
- "extsprintf": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
- "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
- "dev": true
- },
- "fast-deep-equal": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
- "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=",
- "dev": true
- },
- "fast-json-stable-stringify": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
- "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
- "dev": true
- },
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
@@ -668,45 +589,6 @@
}
}
},
- "forever-agent": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
- "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
- "dev": true
- },
- "form-data": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
- "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
- "dev": true,
- "requires": {
- "asynckit": "0.4.0",
- "combined-stream": "1.0.6",
- "mime-types": "2.1.18"
- }
- },
- "fs-extra": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
- "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=",
- "dev": true,
- "requires": {
- "graceful-fs": "4.1.11",
- "jsonfile": "2.4.0",
- "klaw": "1.3.1"
- },
- "dependencies": {
- "klaw": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
- "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
- "dev": true,
- "requires": {
- "graceful-fs": "4.1.11"
- }
- }
- }
- },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -725,15 +607,6 @@
"integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=",
"dev": true
},
- "getpass": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
- "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
- "dev": true,
- "requires": {
- "assert-plus": "1.0.0"
- }
- },
"glob": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
@@ -864,12 +737,22 @@
}
},
"grunt-contrib-qunit": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/grunt-contrib-qunit/-/grunt-contrib-qunit-1.3.0.tgz",
- "integrity": "sha1-naxijP1OyBWZhjPbc7Ur2z3byZ4=",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/grunt-contrib-qunit/-/grunt-contrib-qunit-3.0.1.tgz",
+ "integrity": "sha512-s994+ipKwc+oUUIWaGIw1soyID4pExSGMd/cHQN5h0p8KbIjR1Le3ZC3giSDDKXtZFE0i+Obf0uIjNvjftX2Cw==",
"dev": true,
"requires": {
- "grunt-lib-phantomjs": "1.1.0"
+ "eventemitter2": "5.0.1",
+ "p-each-series": "1.0.0",
+ "puppeteer": "1.7.0"
+ },
+ "dependencies": {
+ "eventemitter2": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-5.0.1.tgz",
+ "integrity": "sha1-YZegldX7a1folC9v1+qtY6CclFI=",
+ "dev": true
+ }
}
},
"grunt-contrib-uglify": {
@@ -970,53 +853,6 @@
}
}
},
- "grunt-lib-phantomjs": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/grunt-lib-phantomjs/-/grunt-lib-phantomjs-1.1.0.tgz",
- "integrity": "sha1-np7c3Z/S3UDgwYHJQ3HVcqpe6tI=",
- "dev": true,
- "requires": {
- "eventemitter2": "0.4.14",
- "phantomjs-prebuilt": "2.1.16",
- "rimraf": "2.6.2",
- "semver": "5.5.0",
- "temporary": "0.0.8"
- },
- "dependencies": {
- "glob": {
- "version": "7.1.2",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
- "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=",
- "dev": true,
- "requires": {
- "fs.realpath": "1.0.0",
- "inflight": "1.0.6",
- "inherits": "2.0.3",
- "minimatch": "3.0.4",
- "once": "1.4.0",
- "path-is-absolute": "1.0.1"
- }
- },
- "minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
- "dev": true,
- "requires": {
- "brace-expansion": "1.1.11"
- }
- },
- "rimraf": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
- "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=",
- "dev": true,
- "requires": {
- "glob": "7.1.2"
- }
- }
- }
- },
"grunt-shell-spawn": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/grunt-shell-spawn/-/grunt-shell-spawn-0.3.10.tgz",
@@ -1037,22 +873,6 @@
"concat-stream": "1.6.0"
}
},
- "har-schema": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
- "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
- "dev": true
- },
- "har-validator": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
- "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
- "dev": true,
- "requires": {
- "ajv": "5.5.2",
- "har-schema": "2.0.0"
- }
- },
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
@@ -1062,34 +882,6 @@
"ansi-regex": "2.1.1"
}
},
- "hasha": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz",
- "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=",
- "dev": true,
- "requires": {
- "is-stream": "1.1.0",
- "pinkie-promise": "2.0.1"
- }
- },
- "hawk": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
- "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=",
- "dev": true,
- "requires": {
- "boom": "4.3.1",
- "cryptiles": "3.1.2",
- "hoek": "4.2.1",
- "sntp": "2.1.0"
- }
- },
- "hoek": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
- "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==",
- "dev": true
- },
"hooker": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz",
@@ -1115,15 +907,14 @@
"readable-stream": "1.1.14"
}
},
- "http-signature": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
- "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "https-proxy-agent": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
+ "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==",
"dev": true,
"requires": {
- "assert-plus": "1.0.0",
- "jsprim": "1.4.1",
- "sshpk": "1.13.1"
+ "agent-base": "4.2.1",
+ "debug": "3.1.0"
}
},
"iconv-lite": {
@@ -1187,18 +978,6 @@
"number-is-nan": "1.0.1"
}
},
- "is-stream": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
- "dev": true
- },
- "is-typedarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
- "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
- "dev": true
- },
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
@@ -1217,12 +996,6 @@
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
- "isstream": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
- "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
- "dev": true
- },
"js-yaml": {
"version": "3.5.5",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz",
@@ -1241,13 +1014,6 @@
"xmlcreate": "1.0.2"
}
},
- "jsbn": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
- "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
- "dev": true,
- "optional": true
- },
"jsdoc": {
"version": "3.5.5",
"resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz",
@@ -1370,51 +1136,6 @@
}
}
},
- "json-schema": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
- "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
- "dev": true
- },
- "json-schema-traverse": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
- "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
- "dev": true
- },
- "json-stringify-safe": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
- "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
- "dev": true
- },
- "jsonfile": {
- "version": "2.4.0",
- "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
- "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
- "dev": true,
- "requires": {
- "graceful-fs": "4.1.11"
- }
- },
- "jsprim": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
- "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
- "dev": true,
- "requires": {
- "assert-plus": "1.0.0",
- "extsprintf": "1.3.0",
- "json-schema": "0.2.3",
- "verror": "1.10.0"
- }
- },
- "kew": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz",
- "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=",
- "dev": true
- },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -1522,21 +1243,12 @@
}
}
},
- "mime-db": {
- "version": "1.33.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
- "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==",
+ "mime": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz",
+ "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==",
"dev": true
},
- "mime-types": {
- "version": "2.1.18",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
- "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
- "dev": true,
- "requires": {
- "mime-db": "1.33.0"
- }
- },
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@@ -1592,12 +1304,6 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
- "oauth-sign": {
- "version": "0.8.2",
- "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
- "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=",
- "dev": true
- },
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -1632,10 +1338,19 @@
"os-tmpdir": "1.0.2"
}
},
- "package": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz",
- "integrity": "sha1-0lofmeJQbcsn1nBLg9yooxLk7cw=",
+ "p-each-series": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz",
+ "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=",
+ "dev": true,
+ "requires": {
+ "p-reduce": "1.0.0"
+ }
+ },
+ "p-reduce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
+ "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
"dev": true
},
"pako": {
@@ -1685,40 +1400,6 @@
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
"dev": true
},
- "performance-now": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
- "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
- "dev": true
- },
- "phantomjs-prebuilt": {
- "version": "2.1.16",
- "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz",
- "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=",
- "dev": true,
- "requires": {
- "es6-promise": "4.2.4",
- "extract-zip": "1.6.6",
- "fs-extra": "1.0.0",
- "hasha": "2.2.0",
- "kew": "0.7.0",
- "progress": "1.1.8",
- "request": "2.83.0",
- "request-progress": "2.0.1",
- "which": "1.3.0"
- },
- "dependencies": {
- "which": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
- "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=",
- "dev": true,
- "requires": {
- "isexe": "2.0.0"
- }
- }
- }
- },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
@@ -1757,9 +1438,15 @@
"dev": true
},
"progress": {
- "version": "1.1.8",
- "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz",
- "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
+ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
+ "dev": true
+ },
+ "proxy-from-env": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
+ "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=",
"dev": true
},
"pseudomap": {
@@ -1768,17 +1455,32 @@
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true
},
- "punycode": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
- "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
- "dev": true
- },
- "qs": {
- "version": "6.5.1",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
- "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=",
- "dev": true
+ "puppeteer": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0.tgz",
+ "integrity": "sha512-f+1DxKHPqce6CXUBz2eVO2WcATeVeQSOPG9GYaGObEZDCiCEUwG+gogjMsrvn7he2wHTqNVb5p6RUrwmr8XFBA==",
+ "dev": true,
+ "requires": {
+ "debug": "3.1.0",
+ "extract-zip": "1.6.7",
+ "https-proxy-agent": "2.2.1",
+ "mime": "2.3.1",
+ "progress": "2.0.0",
+ "proxy-from-env": "1.0.0",
+ "rimraf": "2.6.2",
+ "ws": "5.2.2"
+ },
+ "dependencies": {
+ "rimraf": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
+ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "dev": true,
+ "requires": {
+ "glob": "7.0.6"
+ }
+ }
+ }
},
"read-pkg": {
"version": "1.1.0",
@@ -1838,45 +1540,6 @@
"is-finite": "1.0.2"
}
},
- "request": {
- "version": "2.83.0",
- "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
- "integrity": "sha1-ygtl2gLtYpNYh4COb1EDgQNOM1Y=",
- "dev": true,
- "requires": {
- "aws-sign2": "0.7.0",
- "aws4": "1.6.0",
- "caseless": "0.12.0",
- "combined-stream": "1.0.6",
- "extend": "3.0.1",
- "forever-agent": "0.6.1",
- "form-data": "2.3.2",
- "har-validator": "5.0.3",
- "hawk": "6.0.2",
- "http-signature": "1.2.0",
- "is-typedarray": "1.0.0",
- "isstream": "0.1.2",
- "json-stringify-safe": "5.0.1",
- "mime-types": "2.1.18",
- "oauth-sign": "0.8.2",
- "performance-now": "2.1.0",
- "qs": "6.5.1",
- "safe-buffer": "5.1.1",
- "stringstream": "0.0.5",
- "tough-cookie": "2.3.4",
- "tunnel-agent": "0.6.0",
- "uuid": "3.2.1"
- }
- },
- "request-progress": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz",
- "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=",
- "dev": true,
- "requires": {
- "throttleit": "1.0.0"
- }
- },
"requizzle": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz",
@@ -1937,15 +1600,6 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true
},
- "sntp": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
- "integrity": "sha1-LGzsFP7cIiJznK+bXD2F0cxaLMg=",
- "dev": true,
- "requires": {
- "hoek": "4.2.1"
- }
- },
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@@ -1990,34 +1644,12 @@
"integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=",
"dev": true
},
- "sshpk": {
- "version": "1.13.1",
- "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
- "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=",
- "dev": true,
- "requires": {
- "asn1": "0.2.3",
- "assert-plus": "1.0.0",
- "bcrypt-pbkdf": "1.0.1",
- "dashdash": "1.14.1",
- "ecc-jsbn": "0.1.1",
- "getpass": "0.1.7",
- "jsbn": "0.1.1",
- "tweetnacl": "0.14.5"
- }
- },
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
},
- "stringstream": {
- "version": "0.0.5",
- "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
- "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=",
- "dev": true
- },
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
@@ -2067,52 +1699,12 @@
"resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz",
"integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg="
},
- "temporary": {
- "version": "0.0.8",
- "resolved": "https://registry.npmjs.org/temporary/-/temporary-0.0.8.tgz",
- "integrity": "sha1-oYqYHSi6jKNgJ/s8MFOMPst0CsA=",
- "dev": true,
- "requires": {
- "package": "1.0.1"
- }
- },
- "throttleit": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
- "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
- "dev": true
- },
- "tough-cookie": {
- "version": "2.3.4",
- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
- "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
- "dev": true,
- "requires": {
- "punycode": "1.4.1"
- }
- },
"trim-newlines": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
"integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=",
"dev": true
},
- "tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
- "dev": true,
- "requires": {
- "safe-buffer": "5.1.1"
- }
- },
- "tweetnacl": {
- "version": "0.14.5",
- "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
- "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
- "dev": true,
- "optional": true
- },
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -2187,12 +1779,6 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
},
- "uuid": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
- "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==",
- "dev": true
- },
"validate-npm-package-license": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz",
@@ -2203,17 +1789,6 @@
"spdx-expression-parse": "3.0.0"
}
},
- "verror": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
- "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
- "dev": true,
- "requires": {
- "assert-plus": "1.0.0",
- "core-util-is": "1.0.2",
- "extsprintf": "1.3.0"
- }
- },
"which": {
"version": "1.2.14",
"resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz",
@@ -2241,6 +1816,15 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
+ "ws": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
+ "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
+ "dev": true,
+ "requires": {
+ "async-limiter": "1.0.0"
+ }
+ },
"xmlcreate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-1.0.2.tgz",
diff --git a/lib/js/package.json b/lib/js/package.json
index f3ed3e1..a59cdc4 100644
--- a/lib/js/package.json
+++ b/lib/js/package.json
@@ -6,7 +6,7 @@
"grunt-cli": "^1.2.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
- "grunt-contrib-qunit": "^1.2.0",
+ "grunt-contrib-qunit": "^3.0.1",
"grunt-contrib-uglify": "^1.0.1",
"grunt-jsdoc": "^2.2.1",
"grunt-shell-spawn": "^0.3.10",
diff --git a/lib/js/test/build.xml b/lib/js/test/build.xml
index 0ba3828..04c1360 100755
--- a/lib/js/test/build.xml
+++ b/lib/js/test/build.xml
@@ -100,9 +100,8 @@
<target name="download_jslibs">
<get src="http://code.jquery.com/jquery-1.11.3.min.js" dest="${build}/js/lib/jquery.js" usetimestamp="true"/>
- <get src="http://code.jquery.com/qunit/qunit-1.18.0.js" dest="${build}/js/lib/qunit.js" usetimestamp="true"/>
- <get src="http://code.jquery.com/qunit/qunit-1.18.0.css" dest="${build}/js/lib/qunit.css" usetimestamp="true"/>
- <get src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js" dest="${build}/js/lib/es6-promise.js" usetimestamp="true"/>
+ <get src="http://code.jquery.com/qunit/qunit-2.6.2.js" dest="${build}/js/lib/qunit.js" usetimestamp="true"/>
+ <get src="http://code.jquery.com/qunit/qunit-2.6.2.css" dest="${build}/js/lib/qunit.css" usetimestamp="true"/>
</target>
<target name="jslibs" depends="init, proxy, download_jslibs">
diff --git a/lib/js/test/deep-constructor.test.js b/lib/js/test/deep-constructor.test.js
index f349e46..82d3a1e 100644
--- a/lib/js/test/deep-constructor.test.js
+++ b/lib/js/test/deep-constructor.test.js
@@ -1,6 +1,6 @@
function serialize(data) {
- var transport = new Thrift.Transport('/service');
- var protocol = new Thrift.Protocol(transport);
+ const transport = new Thrift.Transport('/service');
+ const protocol = new Thrift.Protocol(transport);
protocol.writeMessageBegin('', 0, 0);
data.write(protocol);
protocol.writeMessageEnd();
@@ -8,11 +8,11 @@
}
function deserialize(serialized, type) {
- var transport = new Thrift.Transport('/service');
+ const transport = new Thrift.Transport('/service');
transport.setRecvBuffer(serialized);
- var protocol = new Thrift.Protocol(transport);
+ const protocol = new Thrift.Protocol(transport);
protocol.readMessageBegin();
- var data = new type();
+ const data = new type();
data.read(protocol);
protocol.readMessageEnd();
return data;
@@ -145,36 +145,36 @@
assert.equal(obj.list_of_list_field[2][1], 'six');
}
-var cases = {
+const cases = {
'Serialize/deserialize simple struct should return equal object': function(assert) {
- var tObj = new Simple({value: 'a'});
- var received = deserialize(serialize(tObj), Simple);
+ const tObj = new Simple({value: 'a'});
+ const received = deserialize(serialize(tObj), Simple);
assert.ok(tObj !== received);
assert.deepEqual(received, tObj);
},
'Serialize/deserialize should return equal object': function(assert) {
- var tObj = createThriftObj();
- var received = deserialize(serialize(tObj), Complex);
+ const tObj = createThriftObj();
+ const received = deserialize(serialize(tObj), Complex);
assert.ok(tObj !== received);
assert.deepEqual(received, tObj);
},
'Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects': function(assert) {
- var tObj1 = createThriftObj();
- var tObj2 = new Complex(createJsObj());
+ const tObj1 = createThriftObj();
+ const tObj2 = new Complex(createJsObj());
assertValues(tObj2, assert);
assert.equal(serialize(tObj2), serialize(tObj1));
},
'Modifications to args object should not affect constructed Thrift object': function(assert) {
- var args = createJsObj();
+ const args = createJsObj();
assertValues(args, assert);
- var tObj = new Complex(args);
+ const tObj = new Complex(args);
assertValues(tObj, assert);
args.struct_field.value = 'ZZZ';
@@ -193,7 +193,7 @@
},
'nulls are ok': function(assert) {
- var tObj = new Complex({
+ const tObj = new Complex({
struct_field: null,
struct_list_field: null,
struct_set_field: null,
@@ -201,7 +201,7 @@
struct_nested_containers_field: null,
struct_nested_containers_field2: null
});
- var received = deserialize(serialize(tObj), Complex);
+ const received = deserialize(serialize(tObj), Complex);
assert.ok(tObj !== received);
assert.deepEqual(tObj, received);
}
@@ -209,5 +209,5 @@
};
Object.keys(cases).forEach(function(caseName) {
- test(caseName, cases[caseName]);
+ QUnit.test(caseName, cases[caseName]);
});
diff --git a/lib/js/test/server_http.js b/lib/js/test/server_http.js
index 1115474..d04f578 100644
--- a/lib/js/test/server_http.js
+++ b/lib/js/test/server_http.js
@@ -17,33 +17,39 @@
* under the License.
*/
-//This HTTP server is designed to serve the test.html browser
+// This HTTP server is designed to serve the test.html browser
// based JavaScript test page (which must be in the current directory).
// This server also supplies the Thrift based test service, which depends
// on the standard ThriftTest.thrift IDL service (which must be compiled
// for Node and browser based JavaScript in ./gen-nodejs and ./gen-js
// respectively).
+//
+// Using the command flag --es6, this server can be run using nodejs code built
+// for the es6 environment or for pre-es6 environment.
+//
-var thrift = require('../../nodejs/lib/thrift');
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
+const thrift = require('../../nodejs/lib/thrift');
+const es6Mode = process.argv.includes('--es6');
+const genFolder = es6Mode ? 'gen-nodejs-es6' : 'gen-nodejs';
+const ThriftTestSvc = require(`./${genFolder}/ThriftTest.js`);
+const ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-var ThriftTestSvcOpt = {
+const ThriftTestSvcOpt = {
transport: thrift.TBufferedTransport,
protocol: thrift.TJSONProtocol,
processor: ThriftTestSvc,
handler: ThriftTestHandler
};
-var ThriftWebServerOptions = {
+const ThriftWebServerOptions = {
files: '.',
services: {
'/service': ThriftTestSvcOpt
}
};
-var server = thrift.createWebServer(ThriftWebServerOptions);
-var port = 8088;
+const server = thrift.createWebServer(ThriftWebServerOptions);
+const port = es6Mode ? 8088 : 8089;
server.listen(port);
-console.log('Serving files from: ' + __dirname);
-console.log('Http/Thrift Server running on port: ' + port);
+console.log(`Serving files from: ${__dirname}`);
+console.log(`Http/Thrift Server (ES6 mode ${es6Mode}) running on port: ${port}`);
diff --git a/lib/js/test/server_https.js b/lib/js/test/server_https.js
index 7e78d9e..504f3b5 100644
--- a/lib/js/test/server_https.js
+++ b/lib/js/test/server_https.js
@@ -26,20 +26,22 @@
// support libraries for test.html (jquery.js, qunit.js and qunit.css
// in ./build/js/lib).
-var fs = require('fs');
-var thrift = require('../../nodejs/lib/thrift');
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
+const fs = require('fs');
+const thrift = require('../../nodejs/lib/thrift');
+const es6Mode = process.argv.includes('--es6');
+const genFolder = es6Mode ? 'gen-nodejs-es6' : 'gen-nodejs';
+const ThriftTestSvc = require(`./${genFolder}/ThriftTest.js`);
+const ThriftTestHandler = require('./test_handler').ThriftTestHandler;
//Setup the I/O stack options for the ThriftTest service
-var ThriftTestSvcOpt = {
+const ThriftTestSvcOpt = {
transport: thrift.TBufferedTransport,
protocol: thrift.TJSONProtocol,
processor: ThriftTestSvc,
handler: ThriftTestHandler
};
-var ThriftWebServerOptions = {
+const ThriftWebServerOptions = {
files: '.',
tls: {
key: fs.readFileSync('../../../test/keys/server.key'),
@@ -50,8 +52,8 @@
}
};
-var server = thrift.createWebServer(ThriftWebServerOptions);
-var port = 8089;
+const server = thrift.createWebServer(ThriftWebServerOptions);
+const port = es6Mode ? 8090 : 8091;
server.listen(port);
-console.log('Serving files from: ' + __dirname);
-console.log('Http/Thrift Server running on port: ' + port);
+console.log(`Serving files from: ${__dirname}`);
+console.log(`Http/Thrift Server (ES6 mode ${es6Mode}) running on port: ${port}`);
diff --git a/lib/js/test/test-async.js b/lib/js/test/test-async.js
index b4e9854..8c6b13e 100644
--- a/lib/js/test/test-async.js
+++ b/lib/js/test/test-async.js
@@ -30,128 +30,130 @@
// all Languages in UTF-8
-var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
+const stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
-function checkRecursively(map1, map2) {
+function checkRecursively(assert, map1, map2) {
if (typeof map1 !== 'function' && typeof map2 !== 'function') {
if (!map1 || typeof map1 !== 'object') {
- equal(map1, map2);
+ assert.equal(map1, map2);
} else {
- for (var key in map1) {
- checkRecursively(map1[key], map2[key]);
+ for (let key in map1) {
+ checkRecursively(assert, map1[key], map2[key]);
}
}
}
}
-module('Base Types');
+QUnit.module('Base Types');
- asyncTest('Void', function() {
- expect(1);
+ QUnit.test('Void', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
client.testVoid(function(result) {
- equal(result, undefined);
- QUnit.start();
+ assert.equal(result, undefined);
+ done();
});
});
- asyncTest('String', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('String', function(assert) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testString('', function(result) {
- equal(result, '');
- QUnit.start();
+ assert.equal(result, '');
+ done();
});
client.testString(stringTest, function(result) {
- equal(result, stringTest);
- QUnit.start();
+ assert.equal(result, stringTest);
+ done();
});
- var specialCharacters = 'quote: \" backslash:' +
+ const specialCharacters = 'quote: \" backslash:' +
' forwardslash-escaped: \/ ' +
' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
' now-all-of-them-together: "\\\/\b\n\r\t' +
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
client.testString(specialCharacters, function(result) {
- equal(result, specialCharacters);
- QUnit.start();
+ assert.equal(result, specialCharacters);
+ done();
});
});
- asyncTest('Double', function() {
- expect(4);
- QUnit.stop(3);
+ QUnit.test('Double', function(assert) {
+ assert.expect(4);
+ const done = assert.async(4);
client.testDouble(0, function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testDouble(-1, function(result) {
- equal(result, -1);
- QUnit.start();
+ assert.equal(result, -1);
+ done();
});
client.testDouble(3.14, function(result) {
- equal(result, 3.14);
- QUnit.start();
+ assert.equal(result, 3.14);
+ done();
});
client.testDouble(Math.pow(2, 60), function(result) {
- equal(result, Math.pow(2, 60));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 60));
+ done();
});
});
// TODO: add testBinary()
- asyncTest('Byte', function() {
- expect(2);
- QUnit.stop();
+ QUnit.test('Byte', function(assert) {
+ assert.expect(2);
+ const done = assert.async(2);
client.testByte(0, function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testByte(0x01, function(result) {
- equal(result, 0x01);
- QUnit.start();
+ assert.equal(result, 0x01);
+ done();
});
});
- asyncTest('I32', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('I32', function(assert) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testI32(0, function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testI32(Math.pow(2, 30), function(result) {
- equal(result, Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 30));
+ done();
});
client.testI32(-Math.pow(2, 30), function(result) {
- equal(result, -Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, -Math.pow(2, 30));
+ done();
});
});
- asyncTest('I64', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('I64', function(assert) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testI64(0, function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(2, 52), function(result) {
- equal(result, Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 52));
+ done();
});
client.testI64(-Math.pow(2, 52), function(result) {
- equal(result, -Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, -Math.pow(2, 52));
+ done();
});
});
-module('Structured Types');
+QUnit.module('Structured Types');
- asyncTest('Struct', function() {
- expect(5);
- var structTestInput = new ThriftTest.Xtruct();
+ QUnit.test('Struct', function(assert) {
+ assert.expect(5);
+ const done = assert.async();
+ const structTestInput = new ThriftTest.Xtruct();
structTestInput.string_thing = 'worked';
structTestInput.byte_thing = 0x01;
structTestInput.i32_thing = Math.pow(2, 30);
@@ -159,148 +161,159 @@
structTestInput.i64_thing = Math.pow(2, 52);
client.testStruct(structTestInput, function(result) {
- equal(result.string_thing, structTestInput.string_thing);
- equal(result.byte_thing, structTestInput.byte_thing);
- equal(result.i32_thing, structTestInput.i32_thing);
- equal(result.i64_thing, structTestInput.i64_thing);
- equal(JSON.stringify(result), JSON.stringify(structTestInput));
- QUnit.start();
+ assert.equal(result.string_thing, structTestInput.string_thing);
+ assert.equal(result.byte_thing, structTestInput.byte_thing);
+ assert.equal(result.i32_thing, structTestInput.i32_thing);
+ assert.equal(result.i64_thing, structTestInput.i64_thing);
+ assert.equal(JSON.stringify(result), JSON.stringify(structTestInput));
+ done();
});
});
- asyncTest('Nest', function() {
- expect(7);
- var xtrTestInput = new ThriftTest.Xtruct();
+ QUnit.test('Nest', function(assert) {
+ assert.expect(7);
+ const done = assert.async();
+ const xtrTestInput = new ThriftTest.Xtruct();
xtrTestInput.string_thing = 'worked';
xtrTestInput.byte_thing = 0x01;
xtrTestInput.i32_thing = Math.pow(2, 30);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
xtrTestInput.i64_thing = Math.pow(2, 52);
- var nestTestInput = new ThriftTest.Xtruct2();
+ const nestTestInput = new ThriftTest.Xtruct2();
nestTestInput.byte_thing = 0x02;
nestTestInput.struct_thing = xtrTestInput;
nestTestInput.i32_thing = Math.pow(2, 15);
client.testNest(nestTestInput, function(result) {
- equal(result.byte_thing, nestTestInput.byte_thing);
- equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
- equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
- equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
- equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
- equal(result.i32_thing, nestTestInput.i32_thing);
- equal(JSON.stringify(result), JSON.stringify(nestTestInput));
- QUnit.start();
+ assert.equal(result.byte_thing, nestTestInput.byte_thing);
+ assert.equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
+ assert.equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
+ assert.equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
+ assert.equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
+ assert.equal(result.i32_thing, nestTestInput.i32_thing);
+ assert.equal(JSON.stringify(result), JSON.stringify(nestTestInput));
+ done();
});
});
- asyncTest('Map', function() {
- expect(3);
- var mapTestInput = {7: 77, 8: 88, 9: 99};
+ QUnit.test('Map', function(assert) {
+ assert.expect(3);
+ const done = assert.async();
+ const mapTestInput = {7: 77, 8: 88, 9: 99};
client.testMap(mapTestInput, function(result) {
- for (var key in result) {
- equal(result[key], mapTestInput[key]);
+ for (let key in result) {
+ assert.equal(result[key], mapTestInput[key]);
}
- QUnit.start();
+ done();
});
});
- asyncTest('StringMap', function() {
- expect(6);
- var mapTestInput = {
+ QUnit.test('StringMap', function(assert) {
+ assert.expect(6);
+ const done = assert.async();
+ const mapTestInput = {
'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
'longValue': stringTest, stringTest: 'long key'
};
client.testStringMap(mapTestInput, function(result) {
- for (var key in result) {
- equal(result[key], mapTestInput[key]);
+ for (let key in result) {
+ assert.equal(result[key], mapTestInput[key]);
}
- QUnit.start();
+ done();
});
});
- asyncTest('Set', function() {
- expect(1);
- var setTestInput = [1, 2, 3];
+ QUnit.test('Set', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
+ const setTestInput = [1, 2, 3];
client.testSet(setTestInput, function(result) {
- ok(result, setTestInput);
- QUnit.start();
+ assert.ok(result, setTestInput);
+ done();
});
});
- asyncTest('List', function() {
- expect(1);
- var listTestInput = [1, 2, 3];
+ QUnit.test('List', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
+ const listTestInput = [1, 2, 3];
client.testList(listTestInput, function(result) {
- ok(result, listTestInput);
- QUnit.start();
+ assert.ok(result, listTestInput);
+ done();
});
});
- asyncTest('Enum', function() {
- expect(1);
+ QUnit.test('Enum', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
client.testEnum(ThriftTest.Numberz.ONE, function(result) {
- equal(result, ThriftTest.Numberz.ONE);
- QUnit.start();
+ assert.equal(result, ThriftTest.Numberz.ONE);
+ done();
});
});
- asyncTest('TypeDef', function() {
- expect(1);
+ QUnit.test('TypeDef', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
client.testTypedef(69, function(result) {
- equal(result, 69);
- QUnit.start();
+ assert.equal(result, 69);
+ done();
});
});
-module('deeper!');
+QUnit.module('deeper!');
- asyncTest('MapMap', function() {
- expect(16);
- var mapMapTestExpectedResult = {
+ QUnit.test('MapMap', function(assert) {
+ assert.expect(16);
+ const done = assert.async();
+ const mapMapTestExpectedResult = {
'4': {'1': 1, '2': 2, '3': 3, '4': 4},
'-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
};
client.testMapMap(1, function(result) {
- for (var key in result) {
- for (var key2 in result[key]) {
- equal(result[key][key2], mapMapTestExpectedResult[key][key2]);
+ for (let key in result) {
+ for (let key2 in result[key]) {
+ assert.equal(result[key][key2], mapMapTestExpectedResult[key][key2]);
}
}
- checkRecursively(result, mapMapTestExpectedResult);
- QUnit.start();
+ checkRecursively(assert, result, mapMapTestExpectedResult);
+ done();
});
});
-module('Exception');
+QUnit.module('Exception');
- asyncTest('Xception', function() {
- expect(2);
+ QUnit.test('Xception', function(assert) {
+ assert.expect(2);
+ const done = assert.async();
client.testException('Xception', function(e) {
- equal(e.errorCode, 1001);
- equal(e.message, 'Xception');
- QUnit.start();
+ assert.equal(e.errorCode, 1001);
+ assert.equal(e.message, 'Xception');
+ done();
});
});
- asyncTest('no Exception', 0, function() {
- expect(1);
+ QUnit.test('no Exception', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
client.testException('no Exception', function(e) {
- ok(!e);
- QUnit.start();
+ assert.ok(!e);
+ done();
});
});
-module('Insanity');
+QUnit.module('Insanity');
- asyncTest('testInsanity', function() {
- expect(24);
- var insanity = {
+ QUnit.test('testInsanity', function(assert) {
+ assert.expect(24);
+ const done = assert.async();
+ const insanity = {
'1': {
'2': {
'userMap': { '5': 5, '8': 8 },
@@ -338,19 +351,20 @@
'2': { '6': { 'userMap': null, 'xtructs': null } }
};
client.testInsanity(new ThriftTest.Insanity(), function(res) {
- ok(res, JSON.stringify(res));
- ok(insanity, JSON.stringify(insanity));
- checkRecursively(res, insanity);
- QUnit.start();
+ assert.ok(res, JSON.stringify(res));
+ assert.ok(insanity, JSON.stringify(insanity));
+ checkRecursively(assert, res, insanity);
+ done();
});
});
-module('Oneway');
+QUnit.module('Oneway');
- asyncTest('testOneway', function() {
- expect(1);
+ QUnit.test('testOneway', function(assert) {
+ assert.expect(1);
+ const done = assert.async();
client.testOneway(1, function(result) {
- equal(result, undefined);
- QUnit.start();
+ assert.equal(result, undefined);
+ done();
});
- });
\ No newline at end of file
+ });
diff --git a/lib/js/test/test-double-rendering.js b/lib/js/test/test-double-rendering.js
index 5d9cd2a..b4b79b8 100644
--- a/lib/js/test/test-double-rendering.js
+++ b/lib/js/test/test-double-rendering.js
@@ -46,7 +46,7 @@
*/
// double assertion threshold
-var EPSILON = 0.0000001;
+const EPSILON = 0.0000001;
// Work around for old API used by QUnitAdapter of jsTestDriver
if (typeof QUnit.log == 'function') {
@@ -67,17 +67,17 @@
QUnit.test('Double (rendering)', function(assert) {
console.log('Double rendering test -- starts');
- var EXPECTED_DOUBLE_ASSIGNED_TO_INT_CONSTANT = 1;
- var EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_INT_CONSTANT = -100;
- var EXPECTED_DOUBLE_ASSIGNED_TO_LARGEST_INT_CONSTANT = 9223372036854775807;
- var EXPECTED_DOUBLE_ASSIGNED_TO_SMALLEST_INT_CONSTANT = -9223372036854775807;
- var EXPECTED_DOUBLE_ASSIGNED_TO_DOUBLE_WITH_MANY_DECIMALS = 3.14159265359;
- var EXPECTED_DOUBLE_ASSIGNED_TO_FRACTIONAL_DOUBLE = 1000000.1;
- var EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_FRACTIONAL_DOUBLE = -1000000.1;
- var EXPECTED_DOUBLE_ASSIGNED_TO_LARGE_DOUBLE = 1.7e+308;
- var EXPECTED_DOUBLE_ASSIGNED_TO_LARGE_FRACTIONAL_DOUBLE = 9223372036854775816.43;
- var EXPECTED_DOUBLE_ASSIGNED_TO_SMALL_DOUBLE = -1.7e+308;
- var EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_BUT_LARGE_FRACTIONAL_DOUBLE = -9223372036854775816.43;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_INT_CONSTANT = 1;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_INT_CONSTANT = -100;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_LARGEST_INT_CONSTANT = 9223372036854775807;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_SMALLEST_INT_CONSTANT = -9223372036854775807;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_DOUBLE_WITH_MANY_DECIMALS = 3.14159265359;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_FRACTIONAL_DOUBLE = 1000000.1;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_FRACTIONAL_DOUBLE = -1000000.1;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_LARGE_DOUBLE = 1.7e+308;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_LARGE_FRACTIONAL_DOUBLE = 9223372036854775816.43;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_SMALL_DOUBLE = -1.7e+308;
+ const EXPECTED_DOUBLE_ASSIGNED_TO_NEGATIVE_BUT_LARGE_FRACTIONAL_DOUBLE = -9223372036854775816.43;
assert.ok(
Math.abs(EXPECTED_DOUBLE_ASSIGNED_TO_INT_CONSTANT - DOUBLE_ASSIGNED_TO_INT_CONSTANT_TEST) <= EPSILON);
assert.ok(
@@ -131,11 +131,11 @@
assert.equal(typeof DOUBLE_ASSIGNED_TO_LARGE_FRACTIONAL_DOUBLE_TEST, 'number');
assert.equal(typeof DOUBLE_ASSIGNED_TO_SMALL_DOUBLE_TEST, 'number');
assert.equal(typeof DOUBLE_ASSIGNED_TO_NEGATIVE_BUT_LARGE_FRACTIONAL_DOUBLE_TEST, 'number');
- var EXPECTED_DOUBLE_LIST =
+ const EXPECTED_DOUBLE_LIST =
[1,-100,100,9223372036854775807,-9223372036854775807,3.14159265359,1000000.1,-1000000.1,1.7e+308,-1.7e+308,
9223372036854775816.43,-9223372036854775816.43];
assert.equal(DOUBLE_LIST_TEST.length, EXPECTED_DOUBLE_LIST.length);
- for (var i = 0; i < EXPECTED_DOUBLE_LIST.length; ++i) {
+ for (let i = 0; i < EXPECTED_DOUBLE_LIST.length; ++i) {
assert.ok(Math.abs(EXPECTED_DOUBLE_LIST[i] - DOUBLE_LIST_TEST[i]) <= EPSILON);
}
console.log('Double rendering test -- ends');
diff --git a/lib/js/test/test-es6.html b/lib/js/test/test-es6.html
index 92d0738..5f55da7 100644
--- a/lib/js/test/test-es6.html
+++ b/lib/js/test/test-es6.html
@@ -23,11 +23,8 @@
<title>Thrift Javascript Bindings: Unit Test</title>
<script src="build/js/thrift.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest_types.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest.js" type="text/javascript" charset="utf-8"></script>
-
- <!-- ES6 Promise Polyfill -->
- <script type="text/javascript" src="build/js/lib/es6-promise.js" charset="utf-8"></script>
+ <script src="gen-js-es6/ThriftTest_types.js" type="text/javascript" charset="utf-8"></script>
+ <script src="gen-js-es6/ThriftTest.js" type="text/javascript" charset="utf-8"></script>
<!-- jQuery -->
<script type="text/javascript" src="build/js/lib/jquery.js" charset="utf-8"></script>
@@ -38,12 +35,12 @@
<!-- the Test Suite-->
<script>
- var loc = window.location;
- var ws_uri = ((loc.protocol === "https:") ? "wss://" : "ws://") +
+ const loc = window.location;
+ const ws_uri = ((loc.protocol === "https:") ? "wss://" : "ws://") +
loc.hostname + ":" + loc.port + loc.pathname;
- var transport = new Thrift.TWebSocketTransport(ws_uri);
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ const transport = new Thrift.TWebSocketTransport(ws_uri);
+ const protocol = new Thrift.Protocol(transport);
+ const client = new ThriftTest.ThriftTestClient(protocol);
transport.open();
</script>
<script type="text/javascript" src="test-es6.js" charset="utf-8"></script>
diff --git a/lib/js/test/test-es6.js b/lib/js/test/test-es6.js
index a3a31dc..845171b 100644
--- a/lib/js/test/test-es6.js
+++ b/lib/js/test/test-es6.js
@@ -24,46 +24,48 @@
* (which is exclusively async).
*
* To compile client code for this test use:
- * $ thrift -gen js ThriftTest.thrift
+ * $ thrift -gen js:es6 ThriftTest.thrift
*/
// all Languages in UTF-8
-var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
-function checkRecursively(map1, map2) {
+const stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
+
+function checkRecursively(assert, map1, map2) {
if (typeof map1 !== 'function' && typeof map2 !== 'function') {
if (!map1 || typeof map1 !== 'object') {
- equal(map1, map2);
+ assert.equal(map1, map2);
} else {
for (var key in map1) {
- checkRecursively(map1[key], map2[key]);
+ checkRecursively(assert, map1[key], map2[key]);
}
}
}
}
-module('Base Types');
+QUnit.module('Base Types');
- asyncTest('Void', function() {
- expect(1);
+ QUnit.test('Void', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
client.testVoid().then(function(result) {
- equal(result, undefined);
- QUnit.start();
+ assert.equal(result, undefined);
+ done();
});
});
- asyncTest('String', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('String', function( assert ) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testString('').then(function(result) {
- equal(result, '');
- QUnit.start();
+ assert.equal(result, '');
+ done();
});
client.testString(stringTest).then(function(result) {
- equal(result, stringTest);
- QUnit.start();
+ assert.equal(result, stringTest);
+ done();
});
var specialCharacters = 'quote: \" backslash:' +
' forwardslash-escaped: \/ ' +
@@ -71,83 +73,84 @@
' now-all-of-them-together: "\\\/\b\n\r\t' +
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
client.testString(specialCharacters).then(function(result) {
- equal(result, specialCharacters);
- QUnit.start();
+ assert.equal(result, specialCharacters);
+ done();
});
});
- asyncTest('Double', function() {
- expect(4);
- QUnit.stop(3);
+ QUnit.test('Double', function( assert ) {
+ assert.expect(4);
+ const done = assert.async(4);
client.testDouble(0).then(function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testDouble(-1).then(function(result) {
- equal(result, -1);
- QUnit.start();
+ assert.equal(result, -1);
+ done();
});
client.testDouble(3.14).then(function(result) {
- equal(result, 3.14);
- QUnit.start();
+ assert.equal(result, 3.14);
+ done();
});
client.testDouble(Math.pow(2, 60)).then(function(result) {
- equal(result, Math.pow(2, 60));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 60));
+ done();
});
});
// TODO: add testBinary()
- asyncTest('Byte', function() {
- expect(2);
- QUnit.stop();
+ QUnit.test('Byte', function( assert ) {
+ assert.expect(2);
+ const done = assert.async(2);
client.testByte(0).then(function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testByte(0x01).then(function(result) {
- equal(result, 0x01);
- QUnit.start();
+ assert.equal(result, 0x01);
+ done();
});
});
- asyncTest('I32', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('I32', function( assert ) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testI32(0).then(function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
client.testI32(Math.pow(2, 30)).then(function(result) {
- equal(result, Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 30));
+ done();
});
client.testI32(-Math.pow(2, 30)).then(function(result) {
- equal(result, -Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, -Math.pow(2, 30));
+ done();
});
});
- asyncTest('I64', function() {
- expect(3);
- QUnit.stop(2);
+ QUnit.test('I64', function( assert ) {
+ assert.expect(3);
+ const done = assert.async(3);
client.testI64(0).then(function(result) {
- equal(result, 0);
- QUnit.start();
+ assert.equal(result, 0);
+ done();
});
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(2, 52)).then(function(result) {
- equal(result, Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 52));
+ done();
});
client.testI64(-Math.pow(2, 52)).then(function(result) {
- equal(result, -Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, -Math.pow(2, 52));
+ done();
});
});
-module('Structured Types');
+QUnit.module('Structured Types');
- asyncTest('Struct', function() {
- expect(5);
+ QUnit.test('Struct', function( assert ) {
+ assert.expect(5);
+ const done = assert.async();
var structTestInput = new ThriftTest.Xtruct();
structTestInput.string_thing = 'worked';
structTestInput.byte_thing = 0x01;
@@ -156,17 +159,18 @@
structTestInput.i64_thing = Math.pow(2, 52);
client.testStruct(structTestInput).then(function(result) {
- equal(result.string_thing, structTestInput.string_thing);
- equal(result.byte_thing, structTestInput.byte_thing);
- equal(result.i32_thing, structTestInput.i32_thing);
- equal(result.i64_thing, structTestInput.i64_thing);
- equal(JSON.stringify(result), JSON.stringify(structTestInput));
- QUnit.start();
+ assert.equal(result.string_thing, structTestInput.string_thing);
+ assert.equal(result.byte_thing, structTestInput.byte_thing);
+ assert.equal(result.i32_thing, structTestInput.i32_thing);
+ assert.equal(result.i64_thing, structTestInput.i64_thing);
+ assert.equal(JSON.stringify(result), JSON.stringify(structTestInput));
+ done();
});
});
- asyncTest('Nest', function() {
- expect(7);
+ QUnit.test('Nest', function( assert ) {
+ assert.expect(7);
+ const done = assert.async();
var xtrTestInput = new ThriftTest.Xtruct();
xtrTestInput.string_thing = 'worked';
xtrTestInput.byte_thing = 0x01;
@@ -180,31 +184,33 @@
nestTestInput.i32_thing = Math.pow(2, 15);
client.testNest(nestTestInput).then(function(result) {
- equal(result.byte_thing, nestTestInput.byte_thing);
- equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
- equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
- equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
- equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
- equal(result.i32_thing, nestTestInput.i32_thing);
- equal(JSON.stringify(result), JSON.stringify(nestTestInput));
- QUnit.start();
+ assert.equal(result.byte_thing, nestTestInput.byte_thing);
+ assert.equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
+ assert.equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
+ assert.equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
+ assert.equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
+ assert.equal(result.i32_thing, nestTestInput.i32_thing);
+ assert.equal(JSON.stringify(result), JSON.stringify(nestTestInput));
+ done();
});
});
- asyncTest('Map', function() {
- expect(3);
+ QUnit.test('Map', function( assert ) {
+ assert.expect(3);
+ const done = assert.async();
var mapTestInput = {7: 77, 8: 88, 9: 99};
client.testMap(mapTestInput).then(function(result) {
for (var key in result) {
- equal(result[key], mapTestInput[key]);
+ assert.equal(result[key], mapTestInput[key]);
}
- QUnit.start();
+ done();
});
});
- asyncTest('StringMap', function() {
- expect(6);
+ QUnit.test('StringMap', function( assert ) {
+ assert.expect(6);
+ const done = assert.async();
var mapTestInput = {
'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
'longValue': stringTest, stringTest: 'long key'
@@ -212,51 +218,56 @@
client.testStringMap(mapTestInput).then(function(result) {
for (var key in result) {
- equal(result[key], mapTestInput[key]);
+ assert.equal(result[key], mapTestInput[key]);
}
- QUnit.start();
+ done();
});
});
- asyncTest('Set', function() {
- expect(1);
+ QUnit.test('Set', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
var setTestInput = [1, 2, 3];
client.testSet(setTestInput).then(function(result) {
- ok(result, setTestInput);
- QUnit.start();
+ assert.ok(result, setTestInput);
+ done();
});
});
- asyncTest('List', function() {
- expect(1);
+ QUnit.test('List', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
var listTestInput = [1, 2, 3];
client.testList(listTestInput).then(function(result) {
- ok(result, listTestInput);
- QUnit.start();
+ assert.ok(result, listTestInput);
+ done();
});
});
- asyncTest('Enum', function() {
- expect(1);
+ QUnit.test('Enum', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
client.testEnum(ThriftTest.Numberz.ONE).then(function(result) {
- equal(result, ThriftTest.Numberz.ONE);
- QUnit.start();
+ assert.equal(result, ThriftTest.Numberz.ONE);
+ done();
});
});
- asyncTest('TypeDef', function() {
- expect(1);
+ QUnit.test('TypeDef', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
client.testTypedef(69).then(function(result) {
- equal(result, 69);
- QUnit.start();
+ assert.equal(result, 69);
+ done();
});
});
-module('deeper!');
+QUnit.module('deeper!');
- asyncTest('MapMap', function() {
- expect(16);
+ QUnit.test('MapMap', function( assert ) {
+ assert.expect(16);
+ const done = assert.async();
var mapMapTestExpectedResult = {
'4': {'1': 1, '2': 2, '3': 3, '4': 4},
'-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
@@ -265,40 +276,48 @@
client.testMapMap(1).then(function(result) {
for (var key in result) {
for (var key2 in result[key]) {
- equal(result[key][key2], mapMapTestExpectedResult[key][key2]);
+ assert.equal(result[key][key2], mapMapTestExpectedResult[key][key2]);
}
}
- checkRecursively(result, mapMapTestExpectedResult);
- QUnit.start();
+ checkRecursively(assert, result, mapMapTestExpectedResult);
+ done();
});
});
-module('Exception');
+QUnit.module('Exception');
- asyncTest('Xception', function() {
- expect(2);
+ QUnit.test('Xception', function( assert ) {
+ assert.expect(2);
+ const done = assert.async();
client.testException('Xception').then(function(res) {
- ok(false);
+ assert.ok(false);
}).catch(function(e) {
- equal(e.errorCode, 1001);
- equal(e.message, 'Xception');
- QUnit.start();
+
+ console.log(`Exception exception e`);
+ console.log(e);
+ console.log(JSON.stringify(e, null, 2));
+
+ assert.equal(e.errorCode, 1001);
+ assert.equal(e.message, 'Xception');
+ done();
});
});
- asyncTest('no Exception', 0, function() {
- expect(1);
+ QUnit.test('no Exception', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
client.testException('no Exception').then(function(e) {
- ok(!e);
- QUnit.start();
+ assert.ok(!e);
+ done();
});
});
-module('Insanity');
+QUnit.module('Insanity');
- asyncTest('testInsanity', function() {
- expect(24);
+ QUnit.test('testInsanity', function( assert ) {
+ assert.expect(24);
+ const done = assert.async();
var insanity = {
'1': {
'2': {
@@ -337,18 +356,19 @@
'2': { '6': { 'userMap': null, 'xtructs': null } }
};
client.testInsanity(new ThriftTest.Insanity()).then(function(res) {
- ok(res, JSON.stringify(res));
- ok(insanity, JSON.stringify(insanity));
- checkRecursively(res, insanity);
- QUnit.start();
+ assert.ok(res, JSON.stringify(res));
+ assert.ok(insanity, JSON.stringify(insanity));
+ checkRecursively(assert, res, insanity);
+ done();
});
});
-module('Oneway');
- asyncTest('testOneway', function() {
- expect(1);
+QUnit.module('Oneway');
+ QUnit.test('testOneway', function( assert ) {
+ assert.expect(1);
+ const done = assert.async();
client.testOneway(1).then(function(result) {
- equal(result, undefined);
- QUnit.start();
+ assert.equal(result, undefined);
+ done();
});
- });
\ No newline at end of file
+ });
diff --git a/lib/js/test/test-jq.js b/lib/js/test/test-jq.js
index d8649a0..f62bb95 100644
--- a/lib/js/test/test-jq.js
+++ b/lib/js/test/test-jq.js
@@ -33,19 +33,18 @@
//////////////////////////////////
//jQuery asynchronous tests
jQuery.ajaxSetup({ timeout: 0 });
-$(document).ajaxError(function() { QUnit.start(); });
-module('jQ Async Manual');
+QUnit.module('jQ Async Manual');
- test('testI32', function() {
- expect(2);
- QUnit.stop();
+ QUnit.test('testI32', function(assert) {
+ assert.expect(2);
+ const done = assert.async(2);
- var transport = new Thrift.Transport();
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ const transport = new Thrift.Transport();
+ const protocol = new Thrift.Protocol(transport);
+ const client = new ThriftTest.ThriftTestClient(protocol);
- var jqxhr = jQuery.ajax({
+ const jqxhr = jQuery.ajax({
url: '/service',
data: client.send_testI32(Math.pow(-2, 31)),
type: 'POST',
@@ -53,23 +52,24 @@
dataType: 'text',
success: function(res) {
transport.setRecvBuffer(res);
- equal(client.recv_testI32(), Math.pow(-2, 31));
+ assert.equal(client.recv_testI32(), Math.pow(-2, 31));
+ done();
},
- error: function() { ok(false); },
+ error: function() { assert.ok(false); },
complete: function() {
- ok(true);
- QUnit.start();
+ assert.ok(true);
+ done();
}
});
});
- test('testI64', function() {
- expect(2);
- QUnit.stop();
+ QUnit.test('testI64', function(assert) {
+ assert.expect(2);
+ const done = assert.async(2);
- var transport = new Thrift.Transport();
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ const transport = new Thrift.Transport();
+ const protocol = new Thrift.Protocol(transport);
+ const client = new ThriftTest.ThriftTestClient(protocol);
jQuery.ajax({
url: '/service',
@@ -81,78 +81,79 @@
success: function(res) {
transport.setRecvBuffer(res);
//This is usually 2^61 but JS cannot represent anything over 2^52 accurately
- equal(client.recv_testI64(), Math.pow(-2, 52));
+ assert.equal(client.recv_testI64(), Math.pow(-2, 52));
+ done();
},
- error: function() { ok(false); },
+ error: function() { assert.ok(false); },
complete: function() {
- ok(true);
- QUnit.start();
+ assert.ok(true);
+ done();
}
});
});
-module('jQ Async');
- test('I32', function() {
- expect(3);
+QUnit.module('jQ Async');
+ QUnit.test('I32', function(assert) {
+ assert.expect(3);
- QUnit.stop();
+ const done = assert.async(3);
client.testI32(Math.pow(2, 30), function(result) {
- equal(result, Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 30));
+ done();
});
- QUnit.stop();
- var jqxhr = client.testI32(Math.pow(-2, 31), function(result) {
- equal(result, Math.pow(-2, 31));
+ const jqxhr = client.testI32(Math.pow(-2, 31), function(result) {
+ assert.equal(result, Math.pow(-2, 31));
+ done();
});
jqxhr.success(function(result) {
- equal(result, Math.pow(-2, 31));
- QUnit.start();
+ assert.equal(result, Math.pow(-2, 31));
+ done();
});
});
- test('I64', function() {
- expect(4);
+ QUnit.test('I64', function(assert) {
+ assert.expect(4);
- QUnit.stop();
+ const done = assert.async(4);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(2, 52), function(result) {
- equal(result, Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 52));
+ done();
});
- QUnit.stop();
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(-2, 52), function(result) {
- equal(result, Math.pow(-2, 52));
+ assert.equal(result, Math.pow(-2, 52));
+ done();
})
- .error(function(xhr, status, e) { ok(false, e.message); })
+ .error(function(xhr, status, e) { assert.ok(false, e.message); })
.success(function(result) {
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
- equal(result, Math.pow(-2, 52));
+ assert.equal(result, Math.pow(-2, 52));
+ done();
})
.complete(function() {
- ok(true);
- QUnit.start();
+ assert.ok(true);
+ done();
});
});
- test('Xception', function() {
- expect(2);
+ QUnit.test('Xception', function(assert) {
+ assert.expect(2);
- QUnit.stop();
+ const done = assert.async(2);
- var dfd = client.testException('Xception', function(result) {
- ok(false);
- QUnit.start();
+ const dfd = client.testException('Xception', function(result) {
+ assert.ok(false);
+ done();
})
.error(function(xhr, status, e) {
- equal(e.errorCode, 1001);
- equal(e.message, 'Xception');
- //QUnit.start();
- //Note start is not required here because:
- //$(document).ajaxError( function() { QUnit.start(); } );
+ assert.equal(e.errorCode, 1001);
+ assert.equal(e.message, 'Xception');
+ done();
+ $(document).ajaxError( function() { done(); } );
});
});
diff --git a/lib/js/test/test-nojq.html b/lib/js/test/test-nojq.html
index 541bffe..9eec7fc 100644
--- a/lib/js/test/test-nojq.html
+++ b/lib/js/test/test-nojq.html
@@ -29,7 +29,7 @@
<!-- QUnit Test framework-->
<script type="text/javascript" src="build/js/lib/qunit.js" charset="utf-8"></script>
<link rel="stylesheet" href="build/js/lib/qunit.css" type="text/css" media="screen" />
-
+
<!-- the Test Suite-->
<script type="text/javascript" src="test.js" charset="utf-8"></script>
<script type="text/javascript" src="test-nojq.js" charset="utf-8"></script>
@@ -37,7 +37,7 @@
<body>
<h1 id="qunit-header">Thrift Javascript Bindings: Unit Test (<a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=test/ThriftTest.thrift;hb=HEAD">ThriftTest.thrift</a>)</h1>
<h2 id="qunit-banner"></h2>
- <div id="qunit-testrunner-toolbar"></div>
+ <div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"><li><!-- get valid xhtml strict--></li></ol>
<!-- Uncomment this to check the validity. This significantly slows down the test.
diff --git a/lib/js/test/test-nojq.js b/lib/js/test/test-nojq.js
index c4f3cf7..2b801d2 100644
--- a/lib/js/test/test-nojq.js
+++ b/lib/js/test/test-nojq.js
@@ -33,17 +33,16 @@
//////////////////////////////////
//Async exception tests
-module('NojQ Async');
+QUnit.module('NojQ Async');
- test('Xception', function() {
- expect(2);
-
- QUnit.stop();
+QUnit.test('Xception', function(assert) {
+ assert.expect(2);
+ const done = assert.async();
client.testException('Xception', function(result) {
- equal(result.errorCode, 1001);
- equal(result.message, 'Xception');
- QUnit.start();
+ assert.equal(result.errorCode, 1001);
+ assert.equal(result.message, 'Xception');
+ done();
});
});
diff --git a/lib/js/test/test.html b/lib/js/test/test.html
index edec3a3..af035b6 100755
--- a/lib/js/test/test.html
+++ b/lib/js/test/test.html
@@ -23,8 +23,8 @@
<title>Thrift Javascript Bindings: Unit Test</title>
<script src="build/js/thrift.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest_types.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest.js" type="text/javascript" charset="utf-8"></script>
+ <script src="gen-js-jquery/ThriftTest_types.js" type="text/javascript" charset="utf-8"></script>
+ <script src="gen-js-jquery/ThriftTest.js" type="text/javascript" charset="utf-8"></script>
<!-- jQuery -->
<script type="text/javascript" src="build/js/lib/jquery.js" charset="utf-8"></script>
@@ -34,11 +34,6 @@
<link rel="stylesheet" href="build/js/lib/qunit.css" type="text/css" media="screen" />
<!-- the Test Suite-->
- <script>
- var transport = new Thrift.Transport("/service");
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
- </script>
<script type="text/javascript" src="test.js" charset="utf-8"></script>
<script type="text/javascript" src="test-jq.js" charset="utf-8"></script>
</head>
diff --git a/lib/js/test/test.js b/lib/js/test/test.js
index e3b8d51..a86a509 100755
--- a/lib/js/test/test.js
+++ b/lib/js/test/test.js
@@ -47,9 +47,9 @@
* ++ test-jq.js for "-gen js:jquery" only tests
*/
-var transport = new Thrift.Transport('/service');
-var protocol = new Thrift.Protocol(transport);
-var client = new ThriftTest.ThriftTestClient(protocol);
+const transport = new Thrift.Transport('/service');
+const protocol = new Thrift.Protocol(transport);
+const client = new ThriftTest.ThriftTestClient(protocol);
// Work around for old API used by QUnitAdapter of jsTestDriver
if (typeof QUnit.log == 'function') {
@@ -67,170 +67,170 @@
}
// all Languages in UTF-8
-var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
+const stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
-function checkRecursively(map1, map2) {
+function checkRecursively(assert, map1, map2) {
if (typeof map1 !== 'function' && typeof map2 !== 'function') {
if (!map1 || typeof map1 !== 'object') {
- equal(map1, map2);
+ assert.equal(map1, map2);
} else {
- for (var key in map1) {
- checkRecursively(map1[key], map2[key]);
+ for (let key in map1) {
+ checkRecursively(assert, map1[key], map2[key]);
}
}
}
}
-module('Base Types');
+QUnit.module('Base Types');
- test('Void', function() {
- equal(client.testVoid(), undefined);
+ QUnit.test('Void', function(assert) {
+ assert.equal(client.testVoid(), undefined);
});
- test('Binary (String)', function() {
- var binary = '';
- for (var v = 255; v >= 0; --v) {
+ QUnit.test('Binary (String)', function(assert) {
+ let binary = '';
+ for (let v = 255; v >= 0; --v) {
binary += String.fromCharCode(v);
}
- equal(client.testBinary(binary), binary);
+ assert.equal(client.testBinary(binary), binary);
});
- test('Binary (Uint8Array)', function() {
- var binary = '';
- for (var v = 255; v >= 0; --v) {
+ QUnit.test('Binary (Uint8Array)', function(assert) {
+ let binary = '';
+ for (let v = 255; v >= 0; --v) {
binary += String.fromCharCode(v);
}
- var arr = new Uint8Array(binary.length);
- for (var i = 0; i < binary.length; ++i) {
+ const arr = new Uint8Array(binary.length);
+ for (let i = 0; i < binary.length; ++i) {
arr[i] = binary[i].charCodeAt();
}
- equal(client.testBinary(arr), binary);
+ assert.equal(client.testBinary(arr), binary);
});
- test('String', function() {
- equal(client.testString(''), '');
- equal(client.testString(stringTest), stringTest);
+ QUnit.test('String', function(assert) {
+ assert.equal(client.testString(''), '');
+ assert.equal(client.testString(stringTest), stringTest);
- var specialCharacters = 'quote: \" backslash:' +
+ const specialCharacters = 'quote: \" backslash:' +
' forwardslash-escaped: \/ ' +
' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
' now-all-of-them-together: "\\\/\b\n\r\t' +
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
- equal(client.testString(specialCharacters), specialCharacters);
+ assert.equal(client.testString(specialCharacters), specialCharacters);
});
- test('Double', function() {
- equal(client.testDouble(0), 0);
- equal(client.testDouble(-1), -1);
- equal(client.testDouble(3.14), 3.14);
- equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
+ QUnit.test('Double', function(assert) {
+ assert.equal(client.testDouble(0), 0);
+ assert.equal(client.testDouble(-1), -1);
+ assert.equal(client.testDouble(3.14), 3.14);
+ assert.equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
});
- test('Byte', function() {
- equal(client.testByte(0), 0);
- equal(client.testByte(0x01), 0x01);
+ QUnit.test('Byte', function(assert) {
+ assert.equal(client.testByte(0), 0);
+ assert.equal(client.testByte(0x01), 0x01);
});
- test('I32', function() {
- equal(client.testI32(0), 0);
- equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
- equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
+ QUnit.test('I32', function(assert) {
+ assert.equal(client.testI32(0), 0);
+ assert.equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
+ assert.equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
});
- test('I64', function() {
- equal(client.testI64(0), 0);
+ QUnit.test('I64', function(assert) {
+ assert.equal(client.testI64(0), 0);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
- equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
- equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
+ assert.equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
+ assert.equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
});
-module('Structured Types');
+QUnit.module('Structured Types');
- test('Struct', function() {
- var structTestInput = new ThriftTest.Xtruct();
+ QUnit.test('Struct', function(assert) {
+ const structTestInput = new ThriftTest.Xtruct();
structTestInput.string_thing = 'worked';
structTestInput.byte_thing = 0x01;
structTestInput.i32_thing = Math.pow(2, 30);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
structTestInput.i64_thing = Math.pow(2, 52);
- var structTestOutput = client.testStruct(structTestInput);
+ const structTestOutput = client.testStruct(structTestInput);
- equal(structTestOutput.string_thing, structTestInput.string_thing);
- equal(structTestOutput.byte_thing, structTestInput.byte_thing);
- equal(structTestOutput.i32_thing, structTestInput.i32_thing);
- equal(structTestOutput.i64_thing, structTestInput.i64_thing);
+ assert.equal(structTestOutput.string_thing, structTestInput.string_thing);
+ assert.equal(structTestOutput.byte_thing, structTestInput.byte_thing);
+ assert.equal(structTestOutput.i32_thing, structTestInput.i32_thing);
+ assert.equal(structTestOutput.i64_thing, structTestInput.i64_thing);
- equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
+ assert.equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
});
- test('Nest', function() {
- var xtrTestInput = new ThriftTest.Xtruct();
+ QUnit.test('Nest', function(assert) {
+ const xtrTestInput = new ThriftTest.Xtruct();
xtrTestInput.string_thing = 'worked';
xtrTestInput.byte_thing = 0x01;
xtrTestInput.i32_thing = Math.pow(2, 30);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
xtrTestInput.i64_thing = Math.pow(2, 52);
- var nestTestInput = new ThriftTest.Xtruct2();
+ const nestTestInput = new ThriftTest.Xtruct2();
nestTestInput.byte_thing = 0x02;
nestTestInput.struct_thing = xtrTestInput;
nestTestInput.i32_thing = Math.pow(2, 15);
- var nestTestOutput = client.testNest(nestTestInput);
+ const nestTestOutput = client.testNest(nestTestInput);
- equal(nestTestOutput.byte_thing, nestTestInput.byte_thing);
- equal(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
- equal(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
- equal(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
- equal(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
- equal(nestTestOutput.i32_thing, nestTestInput.i32_thing);
+ assert.equal(nestTestOutput.byte_thing, nestTestInput.byte_thing);
+ assert.equal(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
+ assert.equal(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
+ assert.equal(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
+ assert.equal(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
+ assert.equal(nestTestOutput.i32_thing, nestTestInput.i32_thing);
- equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
+ assert.equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
});
- test('Map', function() {
- var mapTestInput = {7: 77, 8: 88, 9: 99};
+ QUnit.test('Map', function(assert) {
+ const mapTestInput = {7: 77, 8: 88, 9: 99};
- var mapTestOutput = client.testMap(mapTestInput);
+ const mapTestOutput = client.testMap(mapTestInput);
- for (var key in mapTestOutput) {
- equal(mapTestOutput[key], mapTestInput[key]);
+ for (let key in mapTestOutput) {
+ assert.equal(mapTestOutput[key], mapTestInput[key]);
}
});
- test('StringMap', function() {
- var mapTestInput = {
+ QUnit.test('StringMap', function(assert) {
+ const mapTestInput = {
'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
'longValue': stringTest, stringTest: 'long key'
};
- var mapTestOutput = client.testStringMap(mapTestInput);
+ const mapTestOutput = client.testStringMap(mapTestInput);
- for (var key in mapTestOutput) {
- equal(mapTestOutput[key], mapTestInput[key]);
+ for (let key in mapTestOutput) {
+ assert.equal(mapTestOutput[key], mapTestInput[key]);
}
});
- test('Set', function() {
- var setTestInput = [1, 2, 3];
- ok(client.testSet(setTestInput), setTestInput);
+ QUnit.test('Set', function(assert) {
+ const setTestInput = [1, 2, 3];
+ assert.ok(client.testSet(setTestInput), setTestInput);
});
- test('List', function() {
- var listTestInput = [1, 2, 3];
- ok(client.testList(listTestInput), listTestInput);
+ QUnit.test('List', function(assert) {
+ const listTestInput = [1, 2, 3];
+ assert.ok(client.testList(listTestInput), listTestInput);
});
- test('Enum', function() {
- equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
+ QUnit.test('Enum', function(assert) {
+ assert.equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
});
- test('TypeDef', function() {
- equal(client.testTypedef(69), 69);
+ QUnit.test('TypeDef', function(assert) {
+ assert.equal(client.testTypedef(69), 69);
});
- test('Skip', function() {
- var structTestInput = new ThriftTest.Xtruct();
- var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
+ QUnit.test('Skip', function(assert) {
+ const structTestInput = new ThriftTest.Xtruct();
+ const modifiedClient = new ThriftTest.ThriftTestClient(protocol);
modifiedClient.recv_testStruct = function() {
- var input = modifiedClient.input;
- var xtruct3 = new ThriftTest.Xtruct3();
+ const input = modifiedClient.input;
+ const xtruct3 = new ThriftTest.Xtruct3();
input.readMessageBegin();
input.readStructBegin();
@@ -254,74 +254,79 @@
structTestInput.i32_thing = Math.pow(2, 30);
structTestInput.i64_thing = Math.pow(2, 52);
- var structTestOutput = modifiedClient.testStruct(structTestInput);
+ const structTestOutput = modifiedClient.testStruct(structTestInput);
- equal(structTestOutput instanceof ThriftTest.Xtruct3, true);
- equal(structTestOutput.string_thing, structTestInput.string_thing);
- equal(structTestOutput.changed, null);
- equal(structTestOutput.i32_thing, structTestInput.i32_thing);
- equal(structTestOutput.i64_thing, structTestInput.i64_thing);
+ assert.equal(structTestOutput instanceof ThriftTest.Xtruct3, true);
+ assert.equal(structTestOutput.string_thing, structTestInput.string_thing);
+ assert.equal(structTestOutput.changed, null);
+ assert.equal(structTestOutput.i32_thing, structTestInput.i32_thing);
+ assert.equal(structTestOutput.i64_thing, structTestInput.i64_thing);
});
-module('deeper!');
+QUnit.module('deeper!');
- test('MapMap', function() {
- var mapMapTestExpectedResult = {
+ QUnit.test('MapMap', function(assert) {
+ const mapMapTestExpectedResult = {
'4': {'1': 1, '2': 2, '3': 3, '4': 4},
'-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
};
- var mapMapTestOutput = client.testMapMap(1);
+ const mapMapTestOutput = client.testMapMap(1);
- for (var key in mapMapTestOutput) {
- for (var key2 in mapMapTestOutput[key]) {
- equal(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
+ for (let key in mapMapTestOutput) {
+ for (let key2 in mapMapTestOutput[key]) {
+ assert.equal(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
}
}
- checkRecursively(mapMapTestOutput, mapMapTestExpectedResult);
+ checkRecursively(assert, mapMapTestOutput, mapMapTestExpectedResult);
});
-module('Exception');
+QUnit.module('Exception');
- test('Xception', function() {
- expect(2);
+ QUnit.test('Xception', function(assert) {
+ assert.expect(2);
+ const done = assert.async();
try {
client.testException('Xception');
+ assert.ok(false);
}catch (e) {
- equal(e.errorCode, 1001);
- equal(e.message, 'Xception');
+ assert.equal(e.errorCode, 1001);
+ assert.equal(e.message, 'Xception');
+ done();
}
});
- test('no Exception', 0, function() {
+ QUnit.test('no Exception', function(assert) {
+ assert.expect(1);
try {
client.testException('no Exception');
+ assert.ok(true);
}catch (e) {
- ok(false);
+ assert.ok(false);
}
});
- test('TException', function() {
+ QUnit.test('TException', function(assert) {
//ThriftTest does not list TException as a legal exception so it will
// generate an exception on the server that does not propagate back to
// the client. This test has been modified to equate to "no exception"
- expect(1);
+ assert.expect(1);
try {
client.testException('TException');
} catch (e) {
- //ok(false);
+ //assert.ok(false);
}
- ok(true);
+ assert.ok(true);
});
-module('Insanity');
+QUnit.module('Insanity');
- var crazy = {
+ const crazy = {
'userMap': { '5': 5, '8': 8 },
'xtructs': [{
'string_thing': 'Goodbye4',
@@ -336,77 +341,75 @@
'i64_thing': 2
}]
};
- test('testInsanity', function() {
- var insanity = {
+ QUnit.test('testInsanity', function(assert) {
+ const insanity = {
'1': {
'2': crazy,
'3': crazy
},
'2': { '6': { 'userMap': null, 'xtructs': null } }
};
- var res = client.testInsanity(new ThriftTest.Insanity(crazy));
- ok(res, JSON.stringify(res));
- ok(insanity, JSON.stringify(insanity));
+ const res = client.testInsanity(new ThriftTest.Insanity(crazy));
+ assert.ok(res, JSON.stringify(res));
+ assert.ok(insanity, JSON.stringify(insanity));
- checkRecursively(res, insanity);
+ checkRecursively(assert, res, insanity);
});
//////////////////////////////////
//Run same tests asynchronously
-module('Async');
+QUnit.module('Async');
- test('Double', function() {
- expect(1);
+ QUnit.test('Double', function(assert) {
+ assert.expect(1);
- QUnit.stop();
+ const done = assert.async();
client.testDouble(3.14159265, function(result) {
- equal(result, 3.14159265);
- QUnit.start();
+ assert.equal(result, 3.14159265);
+ done();
});
});
- test('Byte', function() {
- expect(1);
+ QUnit.test('Byte', function(assert) {
+ assert.expect(1);
- QUnit.stop();
+ const done = assert.async();
client.testByte(0x01, function(result) {
- equal(result, 0x01);
- QUnit.start();
+ assert.equal(result, 0x01);
+ done();
});
});
- test('I32', function() {
- expect(2);
+ QUnit.test('I32', function(assert) {
+ assert.expect(2);
- QUnit.stop();
+ const done = assert.async(2);
client.testI32(Math.pow(2, 30), function(result) {
- equal(result, Math.pow(2, 30));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 30));
+ done();
});
- QUnit.stop();
client.testI32(Math.pow(-2, 31), function(result) {
- equal(result, Math.pow(-2, 31));
- QUnit.start();
+ assert.equal(result, Math.pow(-2, 31));
+ done();
});
});
- test('I64', function() {
- expect(2);
+ QUnit.test('I64', function(assert) {
+ assert.expect(2);
- QUnit.stop();
+ const done = assert.async(2);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(2, 52), function(result) {
- equal(result, Math.pow(2, 52));
- QUnit.start();
+ assert.equal(result, Math.pow(2, 52));
+ done();
});
- QUnit.stop();
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
client.testI64(Math.pow(-2, 52), function(result) {
- equal(result, Math.pow(-2, 52));
- QUnit.start();
+ assert.equal(result, Math.pow(-2, 52));
+ done();
});
});
diff --git a/lib/js/test/test_handler.js b/lib/js/test/test_handler.js
index 496b5e0..af5f7bd 100644
--- a/lib/js/test/test_handler.js
+++ b/lib/js/test/test_handler.js
@@ -20,10 +20,12 @@
//This is the server side Node test handler for the standard
// Apache Thrift test service.
-var ttypes = require('./gen-nodejs/ThriftTest_types');
-var TException = require('../../nodejs/lib/thrift').TException;
+const es6Mode = process.argv.includes('--es6');
+const genFolder = es6Mode ? 'gen-nodejs-es6' : 'gen-nodejs';
+const ttypes = require(`./${genFolder}/ThriftTest_types`);
+const TException = require('../../nodejs/lib/thrift').TException;
-var ThriftTestHandler = exports.ThriftTestHandler = {
+exports.ThriftTestHandler = {
testVoid: function(result) {
console.log('testVoid()');
result(null);
@@ -99,10 +101,10 @@
testMapMap: function(hello, result) {
console.log('testMapMap(' + hello + ')');
- var mapmap = [];
- var pos = [];
- var neg = [];
- for (var i = 1; i < 5; i++) {
+ const mapmap = [];
+ const pos = [];
+ const neg = [];
+ for (let i = 1; i < 5; i++) {
pos[i] = i;
neg[-i] = -i;
}
@@ -116,34 +118,34 @@
console.log(argument);
console.log(')');
- var hello = new ttypes.Xtruct();
+ const hello = new ttypes.Xtruct();
hello.string_thing = 'Hello2';
hello.byte_thing = 2;
hello.i32_thing = 2;
hello.i64_thing = 2;
- var goodbye = new ttypes.Xtruct();
+ const goodbye = new ttypes.Xtruct();
goodbye.string_thing = 'Goodbye4';
goodbye.byte_thing = 4;
goodbye.i32_thing = 4;
goodbye.i64_thing = 4;
- var crazy = new ttypes.Insanity();
+ const crazy = new ttypes.Insanity();
crazy.userMap = [];
crazy.userMap[ttypes.Numberz.EIGHT] = 8;
crazy.userMap[ttypes.Numberz.FIVE] = 5;
crazy.xtructs = [goodbye, hello];
- var first_map = [];
- var second_map = [];
+ const first_map = [];
+ const second_map = [];
first_map[ttypes.Numberz.TWO] = crazy;
first_map[ttypes.Numberz.THREE] = crazy;
- var looney = new ttypes.Insanity();
+ const looney = new ttypes.Insanity();
second_map[ttypes.Numberz.SIX] = looney;
- var insane = [];
+ const insane = [];
insane[1] = first_map;
insane[2] = second_map;
@@ -154,7 +156,7 @@
testMulti: function(arg0, arg1, arg2, arg3, arg4, arg5, result) {
console.log('testMulti()');
- var hello = new ttypes.Xtruct();
+ const hello = new ttypes.Xtruct();
hello.string_thing = 'Hello2';
hello.byte_thing = arg0;
hello.i32_thing = arg1;
@@ -164,7 +166,7 @@
testException: function(arg, result) {
console.log('testException(' + arg + ')');
if (arg === 'Xception') {
- var x = new ttypes.Xception();
+ const x = new ttypes.Xception();
x.errorCode = 1001;
x.message = arg;
result(x);
@@ -177,19 +179,19 @@
testMultiException: function(arg0, arg1, result) {
console.log('testMultiException(' + arg0 + ', ' + arg1 + ')');
if (arg0 === ('Xception')) {
- var x = new ttypes.Xception();
+ const x = new ttypes.Xception();
x.errorCode = 1001;
x.message = 'This is an Xception';
result(x);
} else if (arg0 === ('Xception2')) {
- var x2 = new ttypes.Xception2();
+ const x2 = new ttypes.Xception2();
x2.errorCode = 2002;
x2.struct_thing = new ttypes.Xtruct();
x2.struct_thing.string_thing = 'This is an Xception2';
result(x2);
}
- var res = new ttypes.Xtruct();
+ const res = new ttypes.Xtruct();
res.string_thing = arg1;
result(null, res);
},
diff --git a/lib/js/test/testws.html b/lib/js/test/testws.html
index f99a146..1edf0e0 100644
--- a/lib/js/test/testws.html
+++ b/lib/js/test/testws.html
@@ -35,12 +35,12 @@
<!-- the Test Suite-->
<script>
- var loc = window.location;
- var ws_uri = ((loc.protocol === "https:") ? "wss://" : "ws://") +
+ const loc = window.location;
+ const ws_uri = ((loc.protocol === "https:") ? "wss://" : "ws://") +
loc.hostname + ":" + loc.port + loc.pathname;
- var transport = new Thrift.TWebSocketTransport(ws_uri);
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
+ const transport = new Thrift.TWebSocketTransport(ws_uri);
+ const protocol = new Thrift.Protocol(transport);
+ const client = new ThriftTest.ThriftTestClient(protocol);
transport.open();
</script>
<script type="text/javascript" src="test-async.js" charset="utf-8"></script>