UNPKG

@mihon/spacejam

Version:

Run your meteor package tinytests and mocha tests from the command line with phantomjs.

62 lines (53 loc) 1.98 kB
// Generated by CoffeeScript 1.8.0 (function() { var Pipe, XunitFilePipe, fs, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; fs = require('fs'); Pipe = require("./Pipe"); XunitFilePipe = (function(_super) { __extends(XunitFilePipe, _super); function XunitFilePipe(stdout, stderr, options) { var outputFile, outputStream; this.stdout = stdout; this.stderr = stderr; this.options = options; this.stdout.setEncoding("utf8"); this.stderr.setEncoding("utf8"); outputFile = this.options.pipeToFile; outputStream = fs.createWriteStream(outputFile, { flags: 'w', encoding: 'utf8' }); this.stdoutBuffer = ''; this.stdout.on("data", (function(_this) { return function(data) { var line, lines, _i, _len, _results; _this.stdoutBuffer += data; lines = _this.stdoutBuffer.split('\n'); if (lines.length === 1) { return; } _this.stdoutBuffer = lines.pop(); _results = []; for (_i = 0, _len = lines.length; _i < _len; _i++) { line = lines[_i]; if (line.indexOf('##_meteor_magic##xunit: ') === 0) { _results.push(outputStream.write(line.substr(24) + '\n')); } else { _results.push(process.stdout.write(line + '\n')); } } return _results; }; })(this)); this.stderr.on("data", (function(_this) { return function(data) { return process.stderr.write(data); }; })(this)); } return XunitFilePipe; })(Pipe); module.exports = XunitFilePipe; }).call(this);