jasmine-json-stream-reporter
Advanced tools
Comparing version 0.2.0 to 0.3.1
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("JasmineJsonStreamReporter",[],e):"object"==typeof exports?exports.JasmineJsonStreamReporter=e():t.JasmineJsonStreamReporter=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=e.id;return[this.uuid,r,t].filter(Boolean).join(":")}var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=r(1),a=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];n(this,t);var r=e.header,o=void 0===r?t.defaultHeader:r;this.specResults=[],this.uuid=s.v4(),this.print=e.print||function(){var t;(t=console).log.apply(t,arguments)},this.onComplete=e.onComplete||function(){},this.format=e.format||function(t){return""+o+JSON.stringify(t)}}return t.prototype.consoleMessage=function(t){var e={id:o.call(this,"consoleMessage"),message:t};this.print(this.format(e))},t.prototype.coverage=function(t){var e={id:o.call(this,"coverage"),coverage:t};this.print(this.format(e))},t.prototype.suiteStarted=function(t){t=i({},t,{id:o.call(this,"suiteStarted",t)}),this.print(this.format(t))},t.prototype.suiteDone=function(t){t=i({},t,{id:o.call(this,"suiteDone",t),specs:this.specResults}),this.print(this.format(t)),this.specResults=[]},t.prototype.specStarted=function(t){t=i({},t,{id:o.call(this,"specStarted",t)}),this.print(this.format(t))},t.prototype.specDone=function(t){t=i({},t,{id:o.call(this,"specDone",t)}),this.print(this.format(t)),this.specResults.push(t)},t.prototype.jasmineStarted=function(t){t=i({},t,{id:o.call(this,"jasmineStarted")}),this.print(this.format(t))},t.prototype.jasmineDone=function(t){this.onComplete(t)},t}();a.defaultHeader="",t.exports=a},function(t,e,r){function n(t,e,r){var n=e&&r||0,o=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){o<16&&(e[n+o++]=u[t])});o<16;)e[n+o++]=0;return e}function o(t,e){var r=e||0,n=c;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}function i(t,e,r){var n=e&&r||0,i=e||[];t=t||{};var s=void 0!==t.clockseq?t.clockseq:d,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:v+1,u=a-h+(c-v)/1e4;if(u<0&&void 0===t.clockseq&&(s=s+1&16383),(u<0||a>h)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,v=c,d=s,a+=122192928e5;var f=(1e4*(268435455&a)+c)%4294967296;i[n++]=f>>>24&255,i[n++]=f>>>16&255,i[n++]=f>>>8&255,i[n++]=255&f;var p=a/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=255&p,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var m=t.node||l,y=0;y<6;y++)i[n+y]=m[y];return e?e:o(i)}function s(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var i=t.random||(t.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var s=0;s<16;s++)e[n+s]=i[s];return e||o(i)}for(var a=r(2),c=[],u={},f=0;f<256;f++)c[f]=(f+256).toString(16).substr(1),u[c[f]]=f;var p=a(),l=[1|p[0],p[1],p[2],p[3],p[4],p[5]],d=16383&(p[6]<<8|p[7]),h=0,v=0,m=s;m.v1=i,m.v4=s,m.parse=n,m.unparse=o,t.exports=m},function(t,e){(function(e){var r,n=e.crypto||e.msCrypto;if(n&&n.getRandomValues){var o=new Uint8Array(16);r=function(){return n.getRandomValues(o),o}}if(!r){var i=new Array(16);r=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}t.exports=r}).call(e,function(){return this}())}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("JasmineJsonStreamReporter",[],e):"object"==typeof exports?exports.JasmineJsonStreamReporter=e():t.JasmineJsonStreamReporter=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.id;return[this.uuid,r,t].filter(Boolean).join(":")}var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=r(1),a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,t);var r=e.header,o=void 0===r?t.defaultHeader:r;this.specResults=[],this.uuid=s.v4(),this.print=e.print||function(){var t;(t=console).log.apply(t,arguments)},this.onComplete=e.onComplete||function(){},this.format=e.format||function(t){return""+o+JSON.stringify(t)}}return t.prototype.consoleMessage=function(t){var e={id:o.call(this,"consoleMessage"),message:t};this.print(this.format(e))},t.prototype.coverage=function(t){var e={id:o.call(this,"coverage"),coverage:t};this.print(this.format(e))},t.prototype.snapshot=function(t){var e={id:o.call(this,"snapshot"),snapshot:t};this.print(this.format(e))},t.prototype.suiteStarted=function(t){t=i({},t,{id:o.call(this,"suiteStarted",t)}),this.print(this.format(t))},t.prototype.suiteDone=function(t){t=i({},t,{id:o.call(this,"suiteDone",t),specs:this.specResults}),this.print(this.format(t)),this.specResults=[]},t.prototype.specStarted=function(t){t=i({},t,{id:o.call(this,"specStarted",t)}),this.print(this.format(t))},t.prototype.specDone=function(t){t=i({},t,{id:o.call(this,"specDone",t)}),this.print(this.format(t)),this.specResults.push(t)},t.prototype.jasmineStarted=function(t){t=i({},t,{id:o.call(this,"jasmineStarted")}),this.print(this.format(t))},t.prototype.jasmineDone=function(t){this.onComplete(t)},t}();a.defaultHeader="",t.exports=a},function(t,e,r){function n(t,e,r){var n=e&&r||0,o=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){o<16&&(e[n+o++]=u[t])});o<16;)e[n+o++]=0;return e}function o(t,e){var r=e||0,n=c;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}function i(t,e,r){var n=e&&r||0,i=e||[];t=t||{};var s=void 0!==t.clockseq?t.clockseq:h,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:v+1,u=a-d+(c-v)/1e4;if(u<0&&void 0===t.clockseq&&(s=s+1&16383),(u<0||a>d)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=a,v=c,h=s,a+=122192928e5;var p=(1e4*(268435455&a)+c)%4294967296;i[n++]=p>>>24&255,i[n++]=p>>>16&255,i[n++]=p>>>8&255,i[n++]=255&p;var f=a/4294967296*1e4&268435455;i[n++]=f>>>8&255,i[n++]=255&f,i[n++]=f>>>24&15|16,i[n++]=f>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var m=t.node||l,y=0;y<6;y++)i[n+y]=m[y];return e?e:o(i)}function s(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var i=t.random||(t.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var s=0;s<16;s++)e[n+s]=i[s];return e||o(i)}for(var a=r(2),c=[],u={},p=0;p<256;p++)c[p]=(p+256).toString(16).substr(1),u[c[p]]=p;var f=a(),l=[1|f[0],f[1],f[2],f[3],f[4],f[5]],h=16383&(f[6]<<8|f[7]),d=0,v=0,m=s;m.v1=i,m.v4=s,m.parse=n,m.unparse=o,t.exports=m},function(t,e){(function(e){var r,n=e.crypto||e.msCrypto;if(n&&n.getRandomValues){var o=new Uint8Array(16);r=function(){return n.getRandomValues(o),o}}if(!r){var i=new Array(16);r=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}t.exports=r}).call(e,function(){return this}())}])}); |
@@ -10,6 +10,5 @@ 'use strict'; | ||
function generateId(name) { | ||
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
id = _ref.id; | ||
var id = _ref.id; | ||
return [this.uuid, id, name].filter(Boolean).join(':'); | ||
@@ -20,8 +19,8 @@ } | ||
function JsonStreamReporter() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
_classCallCheck(this, JsonStreamReporter); | ||
var _options$header = options.header; | ||
var header = _options$header === undefined ? JsonStreamReporter.defaultHeader : _options$header; | ||
var _options$header = options.header, | ||
header = _options$header === undefined ? JsonStreamReporter.defaultHeader : _options$header; | ||
@@ -55,2 +54,7 @@ | ||
JsonStreamReporter.prototype.snapshot = function snapshot(_snapshot) { | ||
var obj = { id: generateId.call(this, 'snapshot'), snapshot: _snapshot }; | ||
this.print(this.format(obj)); | ||
}; | ||
JsonStreamReporter.prototype.suiteStarted = function suiteStarted(suite) { | ||
@@ -57,0 +61,0 @@ suite = _extends({}, suite, { id: generateId.call(this, 'suiteStarted', suite) }); |
{ | ||
"name": "jasmine-json-stream-reporter", | ||
"version": "0.2.0", | ||
"version": "0.3.1", | ||
"description": "jasmine json stream reporter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict'; | ||
var _require = require('through2'); | ||
var _require = require('through2'), | ||
through = _require.obj; | ||
var through = _require.obj; | ||
function handleFailures(failures, onError) { | ||
@@ -15,13 +13,15 @@ this.emit('error', onError(failures + ' ' + (failures === 1 ? 'failure' : 'failures'))); | ||
module.exports = function (reporters) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (!Array.isArray(reporters)) reporters = [reporters]; | ||
var _options$onError = options.onError; | ||
var onError = _options$onError === undefined ? function (message) { | ||
var _options$onError = options.onError, | ||
onError = _options$onError === undefined ? function (message) { | ||
return new Error(message); | ||
} : _options$onError; | ||
var _options$onConsoleMes = options.onConsoleMessage; | ||
var onConsoleMessage = _options$onConsoleMes === undefined ? noop : _options$onConsoleMes; | ||
var _options$onCoverage = options.onCoverage; | ||
var onCoverage = _options$onCoverage === undefined ? noop : _options$onCoverage; | ||
} : _options$onError, | ||
_options$onConsoleMes = options.onConsoleMessage, | ||
onConsoleMessage = _options$onConsoleMes === undefined ? noop : _options$onConsoleMes, | ||
_options$onCoverage = options.onCoverage, | ||
onCoverage = _options$onCoverage === undefined ? noop : _options$onCoverage, | ||
_options$onSnapshot = options.onSnapshot, | ||
onSnapshot = _options$onSnapshot === undefined ? noop : _options$onSnapshot; | ||
@@ -49,3 +49,9 @@ var failures = 0; | ||
var events = { specStarted: true, specDone: specDone, suiteStarted: true, suiteDone: true, jasmineStarted: true, jasmineDone: true, consoleMessage: consoleMessage, coverage: coverage }; | ||
function snapshot(_ref3) { | ||
var snapshot = _ref3.snapshot; | ||
onSnapshot(snapshot); | ||
} | ||
var events = { specStarted: true, specDone: specDone, suiteStarted: true, suiteDone: true, jasmineStarted: true, jasmineDone: true, consoleMessage: consoleMessage, coverage: coverage, snapshot: snapshot }; | ||
return through(function (chunk, enc, next) { | ||
@@ -52,0 +58,0 @@ Object.keys(events).find(function (key) { |
12655
127