var recast = require('recast'); var stream = require('stream'); var util = require('util'); var transformer = require('./unreachableBranchTransformer'); module.exports = UBT; util.inherits(UBT, stream.Transform); function UBT(file, opts) { if (!(this instanceof UBT)) { return UBT.configure(opts)(file); } stream.Transform.call(this); this._data = ''; } UBT.prototype._transform = function(buf, enc, cb) { this._data += buf; cb(); }; UBT.prototype._flush = function(cb) { try { var code = UBT.transform(this._data); this.push(code); } catch(err) { this.emit('error', err); return; } cb(); }; UBT.configure = function(opts) { var ignores = ['.json'].concat(opts && opts.ignore || []); return function(file) { for (var i = 0; i < ignores.length; i++) { if (endsWith(file, ignores[i])) { return stream.PassThrough(); } } return new UBT(file); } }; UBT.transform = function(code) { var ast = transformer(recast.parse(code)); return recast.print(ast).code; }; function endsWith(str, suffix) { if (typeof str !== 'string' || typeof suffix !== 'string') { return false; } return str.indexOf(suffix, str.length - suffix.length) !== -1; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19553 | swellard | Move and rename clients | ||
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/node_modules/unreachable-branch-transform/index.js | |||||
#1 | 19053 | tjuricek |
Rebuild JavaScript Client SDK. The JavaScript client now is a "typed" approach that tends to be similar in approach to the other clients, based on the swagger definition for the platform version. Importantly, client SDK tests are individual scripts (that run under node) that are actually controlled via TestNG. This approach now lets us use a consistent test reporting format so we can at least collect reports from each of the jobs. The documentation is still in progress, that I want to validate as the tests are generated. |