@suitest/smst-to-text
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -1,1 +0,1 @@ | ||
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e}).apply(this,arguments)},__read=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,a,o=t.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i},__values=this&&this.__values||function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")},__spread=this&&this.__spread||function(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(__read(arguments[r]));return e};!function(e){if("object"==typeof module&&"object"==typeof module.exports){var r=e(require,exports);void 0!==r&&(module.exports=r)}else"function"==typeof define&&define.amd&&define(["require","exports","@suitest/smst"],e)}((function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toText=r.wrapTextNodes=r.escapeControlChars=void 0;var t=e("@suitest/smst"),n=new RegExp([[0,8],[11,12],[14,31],[127,159]].map((function(e){var r=__read(e,2),t=r[0],n=r[1];return"["+String.fromCharCode(t)+"-"+String.fromCharCode(n)+"]"})).join("|"),"g"),a=function(e,r){return void 0===r&&(r=String),null==e?"[NOT DEFINED]":""===e?"[EMPTY STRING]":r(e)};r.escapeControlChars=function(e){return e.replace(n,"�")};var o={cancel:"[0m",subject:"[32m",code:"[36m",input:"[4m",success:"[32m",fail:"[31m",fatal:"[31m",warning:"[33m",exit:"[34m",excluded:"[34m"},i=function(e){return(null==e?void 0:e.value)?r.escapeControlChars(e.value):""},s=function(e){return(null==e?void 0:e.value)?(t=r.escapeControlChars(e.value),(n=e.type)in o?o[n]+t+o.cancel:t):"";var t,n},u=function(e){var r="";switch(e){case"success":r="✔ ";break;case"fail":case"fatal":r="✖ ";break;case"warning":r="‼ ";break;case"excluded":case"exit":r="» "}return{type:e,value:r}};r.wrapTextNodes=function(e,r,t){var n,a;void 0===t&&(t=60);var o=[];try{for(var i=__values(e),s=i.next();!s.done;s=i.next()){var u=s.value,l=u.value.split(/\r\n|\r|\n/);if(1===l.length)o.push(u);else for(var c=0;c<l.length;c++)0!==c&&o.push({type:"newline"}),o.push({type:u.type,value:l[c]})}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}for(var v,f,p=[""],d=0,h=0,y=o.shift();y;){if("newline"===y.type)h=0,p.push("");else if(y.value.length<=t-h)h+=y.value.length,p[p.length-1]+=r(y),d=h>d?h:d;else{var _=(f=t-h,[__assign(__assign({},v=y),{value:v.value.slice(0,f)}),__assign(__assign({},v),{value:v.value.slice(f)})]);h=0,p[p.length-1]+=r(_[0]),p.push(""),o.splice(0,0,_[1]),d=t}y=o.shift()}return[d,p]};var l=function(e,n,o){switch(void 0===o&&(o=""),e.type){case"text":case"code":case"subject":case"input":return n(e);case"props":return function(e,t,n){var o,i,s,c,v,f,p;void 0===n&&(n="");var d=[0,0,0],h=[];try{for(var y=__values(e.children),_=y.next();!_.done;_=y.next()){var m=_.value,g=[];h.push(g);var x=__spread(m.name);m.status&&x.splice(0,0,u(m.status));var w=__read(r.wrapTextNodes(x,t),2),b=w[0],j=w[1];g.push(j),b>d[0]&&(d[0]=b);var T=null!==(f=null===(v=m.comparator)||void 0===v?void 0:v.length)&&void 0!==f?f:0;if(g.push([null!==(p=m.comparator)&&void 0!==p?p:""]),T>d[1]&&(d[1]=T),"block"===m.contentType)g=[],h.push(g),g.push(l(m.expectedValue,t," ").split("\n"));else{var C=r.wrapTextNodes(m.expectedValue,t);0===C[0]?(g.push(["[EMPTY STRING]"]),C[0]="[EMPTY STRING]".length):g.push(C[1]),C[0]>d[2]&&(d[2]=C[0])}if("inline"===m.contentType&&void 0!==m.actualValue){g=[],h.push(g),g.push([],["→"]),0===d[1]&&(d[1]=1);var S=__read(r.wrapTextNodes([{type:"text",value:a(m.actualValue)}],t),2),N=S[0],E=S[1];g.push(E),N>d[2]&&(d[2]=N)}}}catch(e){o={error:e}}finally{try{_&&!_.done&&(i=y.return)&&i.call(y)}finally{if(o)throw o.error}}var k=[];try{for(var P=__values(h),O=P.next();!O.done;O=P.next())for(var I=O.value;I.some((function(e){return e.length}));)k.push(n+I.map((function(e,r){var t;return(null!==(t=e.shift())&&void 0!==t?t:"").padEnd(d[r])})).join(" "))}catch(e){s={error:e}}finally{try{O&&!O.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}return k.join("\n")}(e,n,o);case"prop":throw new Error("Prop node can only be rendered as part of Props");case"code-block":return a(e.value,(function(e){return e.split("\n").map((function(e){return o+"> "+e})).join("\n")}));case"test-line":return c(e,n);case"condition":return c(e,n,o);case"test-line-result":return v(e,n,o);case"link":return e.value!==e.href&&e.value?e.value+" ("+e.href+")":e.href;default:return t.assertUnknownSectionNode(e)}},c=function(e,r,t){void 0===t&&(t="");var n=e.status?r(u(e.status)):"",a=e.title.map(r).join(""),o=e.children.map((function(e){return l(e,r,t+" ")})).join("");return[t+n+a,o].filter(Boolean).join("\n")},v=function(e,r,t){var n;void 0===t&&(t="");var a=null===(n=e.message)||void 0===n?void 0:n.map(r).join(""),o=a?" "+r({type:e.status,value:e.status+": "})+a:"";return[c(e.children[0],r,t),o,e.screenshot?" screenshot: "+e.screenshot:""].filter(Boolean).join("\n")};r.toText=function(e,r){void 0===r&&(r=!0);var t=r?s:i;return Array.isArray(e)||(e=[e]),e.map((function(e){return l(e,t)})).join("")}})); | ||
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e}).apply(this,arguments)},__read=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,a,o=t.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i},__values=this&&this.__values||function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")},__spread=this&&this.__spread||function(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(__read(arguments[r]));return e};!function(e){if("object"==typeof module&&"object"==typeof module.exports){var r=e(require,exports);void 0!==r&&(module.exports=r)}else"function"==typeof define&&define.amd&&define(["require","exports","@suitest/smst"],e)}((function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toText=r.wrapTextNodes=r.escapeControlChars=void 0;var t=e("@suitest/smst"),n=new RegExp([[0,8],[11,12],[14,31],[127,159]].map((function(e){var r=__read(e,2),t=r[0],n=r[1];return"["+String.fromCharCode(t)+"-"+String.fromCharCode(n)+"]"})).join("|"),"g"),a=function(e,r){return void 0===r&&(r=String),null==e?"[NOT DEFINED]":""===e?"[EMPTY STRING]":r(e)};r.escapeControlChars=function(e){return e.replace(n,"�")};var o={cancel:"[0m",subject:"[32m",code:"[36m",input:"[4m",success:"[32m",fail:"[31m",fatal:"[31m",warning:"[33m",exit:"[34m",excluded:"[34m"},i=function(e){return(null==e?void 0:e.value)?r.escapeControlChars(e.value):""},s=function(e){return(null==e?void 0:e.value)?(t=r.escapeControlChars(e.value),(n=e.type)in o?o[n]+t+o.cancel:t):"";var t,n},u=function(e){var r="";switch(e){case"success":r="✔ ";break;case"fail":case"fatal":r="✖ ";break;case"warning":r="‼ ";break;case"excluded":case"exit":r="» "}return{type:e,value:r}};r.wrapTextNodes=function(e,r,t){var n,a;void 0===t&&(t=60);var o=[];try{for(var i=__values(e),s=i.next();!s.done;s=i.next()){var u=s.value,l=u.value.split(/\r\n|\r|\n/);if(1===l.length)o.push(u);else for(var c=0;c<l.length;c++)0!==c&&o.push({type:"newline"}),o.push({type:u.type,value:l[c]})}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.error}}for(var v,f,p=[""],d=0,h=0,y=o.shift();y;){if("newline"===y.type)h=0,p.push("");else if(y.value.length<=t-h)h+=y.value.length,p[p.length-1]+=r(y),d=h>d?h:d;else{var _=(f=t-h,[__assign(__assign({},v=y),{value:v.value.slice(0,f)}),__assign(__assign({},v),{value:v.value.slice(f)})]);h=0,p[p.length-1]+=r(_[0]),p.push(""),o.splice(0,0,_[1]),d=t}y=o.shift()}return[d,p]};var l=function(e,n,o){switch(void 0===o&&(o=""),e.type){case"text":case"code":case"subject":case"input":return n(e);case"props":return function(e,t,n){var o,i,s,c,v,f,p;void 0===n&&(n="");var d=[0,0,0],h=[];try{for(var y=__values(e.children),_=y.next();!_.done;_=y.next()){var m=_.value,g=[];h.push(g);var x=__spread(m.name);m.status&&x.splice(0,0,u(m.status));var w=__read(r.wrapTextNodes(x,t),2),b=w[0],j=w[1];g.push(j),b>d[0]&&(d[0]=b);var T=null!==(f=null===(v=m.comparator)||void 0===v?void 0:v.length)&&void 0!==f?f:0;if(g.push([null!==(p=m.comparator)&&void 0!==p?p:""]),T>d[1]&&(d[1]=T),"block"===m.contentType)g=[],h.push(g),g.push(l(m.expectedValue,t," ").split("\n"));else{var S=r.wrapTextNodes(m.expectedValue,t);0===S[0]?(g.push(["[EMPTY STRING]"]),S[0]="[EMPTY STRING]".length):g.push(S[1]),S[0]>d[2]&&(d[2]=S[0])}if("inline"===m.contentType&&void 0!==m.actualValue){g=[],h.push(g),g.push([],["→"]),0===d[1]&&(d[1]=1);var C=__read(r.wrapTextNodes([{type:"text",value:a(m.actualValue)}],t),2),N=C[0],E=C[1];g.push(E),N>d[2]&&(d[2]=N)}}}catch(e){o={error:e}}finally{try{_&&!_.done&&(i=y.return)&&i.call(y)}finally{if(o)throw o.error}}var k=[];try{for(var P=__values(h),O=P.next();!O.done;O=P.next())for(var I=O.value;I.some((function(e){return e.length}));)k.push(n+I.map((function(e,r){var t;return(null!==(t=e.shift())&&void 0!==t?t:"")[1===r?"padStart":"padEnd"](d[r])})).join(" "))}catch(e){s={error:e}}finally{try{O&&!O.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}return k.join("\n")}(e,n,o);case"prop":throw new Error("Prop node can only be rendered as part of Props");case"code-block":return a(e.value,(function(e){return e.split("\n").map((function(e){return o+"> "+e})).join("\n")}));case"test-line":return c(e,n);case"condition":return c(e,n,o);case"test-line-result":return v(e,n,o);case"link":return e.value!==e.href&&e.value?e.value+" ("+e.href+")":e.href;default:return t.assertUnknownSectionNode(e)}},c=function(e,r,t){void 0===t&&(t="");var n=e.status?r(u(e.status)):"",a=e.title.map(r).join(""),o=e.children.map((function(e){return l(e,r,t+" ")})).join("");return[t+n+a,o].filter(Boolean).join("\n")},v=function(e,r,t){var n;void 0===t&&(t="");var a=null===(n=e.message)||void 0===n?void 0:n.map(r).join(""),o=a?" "+r({type:e.status,value:e.status+": "})+a:"";return[c(e.children[0],r,t),o,e.screenshot?" screenshot: "+e.screenshot:""].filter(Boolean).join("\n")};r.toText=function(e,r){void 0===r&&(r=!0);var t=r?s:i;return Array.isArray(e)||(e=[e]),e.map((function(e){return l(e,t)})).join("")}})); |
{ | ||
"name": "@suitest/smst-to-text", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Utility to convert SMST to plain text or ANSI-styled text", | ||
@@ -5,0 +5,0 @@ "homepage": "https://suite.st/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
119095
3598
0