Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More →
Socket
Sign inDemoInstall
Socket

@suitest/smst-to-text

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suitest/smst-to-text - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

2

dist/toText.js

@@ -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:"",subject:"",code:"",input:"",success:"",fail:"",fatal:"",warning:"",exit:"",excluded:"",aborted:""},i=function(e){return Object.values(o).reduce((function(e,r){return e.replace(r,"")}),e).length},s=function(e){return(null==e?void 0:e.value)?r.escapeControlChars(e.value):""},u=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},l=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="Âģ ";break;case"aborted":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,p,f=[""],d=0,h=0,y=o.shift();y;){if("newline"===y.type)h=0,f.push("");else if(y.value.length<=t-h)h+=y.value.length,f[f.length-1]+=r(y),d=h>d?h:d;else{var _=(p=t-h,[__assign(__assign({},v=y),{value:v.value.slice(0,p)}),__assign(__assign({},v),{value:v.value.slice(p)})]);h=0,f[f.length-1]+=r(_[0]),f.push(""),o.splice(0,0,_[1]),d=t}y=o.shift()}return[d,f]};var c=function(e,n,o){var s=o.prefix,u=void 0===s?"":s,f=o.verbosity;switch(e.type){case"text":case"code":case"subject":case"input":return n(e);case"props":return function(e,t,n){var o,s,u,v,p,f,d,h=n.prefix,y=void 0===h?"":h,_=n.verbosity,m=[0,0,0],b=[];try{for(var x=__values(e.children),g=x.next();!g.done;g=x.next()){var w=g.value,j=[];b.push(j);var T=__spread(w.name);w.status&&T.splice(0,0,l(w.status));var S=__read(r.wrapTextNodes(T,t),2),C=S[0],N=S[1];j.push(N),C>m[0]&&(m[0]=C);var k=null!==(f=null===(p=w.comparator)||void 0===p?void 0:p.length)&&void 0!==f?f:0;if(j.push([null!==(d=w.comparator)&&void 0!==d?d:""]),k>m[1]&&(m[1]=k),"block"===w.contentType)j=[],b.push(j),j.push(c(w.expectedValue,t,{prefix:" ",verbosity:_}).split("\n"));else{var E=r.wrapTextNodes(w.expectedValue,t);0===E[0]?(j.push(["[EMPTY STRING]"]),E[0]="[EMPTY STRING]".length):j.push(E[1]),E[0]>m[2]&&(m[2]=E[0])}if("inline"===w.contentType&&void 0!==w.actualValue){j=[],b.push(j),j.push([],["→"]),0===m[1]&&(m[1]=1);var O=__read(r.wrapTextNodes([{type:"text",value:a(w.actualValue)}],t),2),P=O[0],I=O[1];j.push(I),P>m[2]&&(m[2]=P)}}}catch(e){o={error:e}}finally{try{g&&!g.done&&(s=x.return)&&s.call(x)}finally{if(o)throw o.error}}var M=[];try{for(var R=__values(b),V=R.next();!V.done;V=R.next())for(var G=V.value;G.some((function(e){return e.length}));)M.push(y+G.map((function(e,r){var t,n=null!==(t=e.shift())&&void 0!==t?t:"",a=i(n);return a<m[r]&&(n+=" ".repeat(m[r]-a)),n[1===r?"padStart":"padEnd"](m[r])})).join(" "))}catch(e){u={error:e}}finally{try{V&&!V.done&&(v=R.return)&&v.call(R)}finally{if(u)throw u.error}}return M.join("\n")}(e,n,{prefix:u,verbosity:f});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 u+"> "+e})).join("\n")}));case"test-line":case"condition":return v(e,n,{prefix:u,verbosity:f});case"test-line-result":return p(e,n,{prefix:u,verbosity:f});case"link":return e.value!==e.href&&e.value?e.value+" ("+e.href+")":e.href;default:return t.assertUnknownSectionNode(e)}},v=function(e,r,t){var n=t.prefix,a=void 0===n?"":n,o=t.verbosity,i=e.status?r(l(e.status)):"",s=e.title.map(r).join(""),u=e.children.map((function(e){return c(e,r,{prefix:a+" ",verbosity:o})})).join(""),v="verbose"===o&&e.docs?" ".repeat(i.length)+"docs: "+c(e.docs,r,{verbosity:o}):"",p="excluded"===e.status?" "+r({type:e.status,value:e.status+": "})+"Test line was not executed":"",f=[a+i+s];switch(o){case"normal":f.push(u);break;case"verbose":f.push(u,v)}return f.push(p),f.filter(Boolean).join("\n")},p=function(e,r,t){var n,a=null===(n=e.message)||void 0===n?void 0:n.map(r).join(""),o="";if(a&&"excluded"!==e.status){var s=r({type:e.status,value:e.status+": "});o=" "+s+function(e,r,t){void 0===r&&(r=115),void 0===t&&(t=0);var n=0===t?"":" ".repeat(t);return e.length>r?e.split(/\s/).reduce((function(e,a){var o=1===e.length?r-t:r,s=e[e.length-1],u=i(s);if(u+i(a)+1>o+5){if(u>=o-5)return e.push(n+a),e;var l=a.slice(0,o-u),c=a.slice(o-u);return e[e.length-1]=s+" "+l,e.push(n+c),e}return e[e.length-1]=(s?s+" ":"")+a,e}),[""]).join("\n"):e}(a,void 0,2+i(s))}return[v(e.children[0],r,t),o,e.screenshot?" screenshot: "+e.screenshot:""].filter(Boolean).join("\n")};r.toText=function(e,r){var t,n,a=null!==(t=null==r?void 0:r.format)&&void 0!==t&&t,o=null!==(n=null==r?void 0:r.verbosity)&&void 0!==n?n:"normal",i=a?u:s;return Array.isArray(e)||(e=[e]),e.map((function(e){return c(e,i,{verbosity:o})})).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="\n",a=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"),o=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(a,"īŋŊ")};var i={cancel:"",subject:"",code:"",input:"",success:"",fail:"",fatal:"",warning:"",exit:"",excluded:"",aborted:""},s=function(e){return Object.values(i).reduce((function(e,r){return e.replace(r,"")}),e).length},u=function(e){return(null==e?void 0:e.value)?r.escapeControlChars(e.value):""},l=function(e){return(null==e?void 0:e.value)?(t=r.escapeControlChars(e.value),(n=e.type)in i?i[n]+t+i.cancel:t):"";var t,n},c=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="Âģ ";break;case"aborted":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 v=function(e,a,i){var u=i.prefix,l=void 0===u?"":u,d=i.verbosity;switch(e.type){case"text":case"code":case"subject":case"input":return a(e);case"props":return function(e,t,a){var i,u,l,f,p,d,h,y=a.prefix,_=void 0===y?"":y,m=a.verbosity,b=[0,0,0],x=[];try{for(var g=__values(e.children),w=g.next();!w.done;w=g.next()){var j=w.value,T=[];x.push(T);var S=__spread(j.name);j.status&&S.splice(0,0,c(j.status));var C=__read(r.wrapTextNodes(S,t),2),N=C[0],E=C[1];T.push(E),N>b[0]&&(b[0]=N);var k=null!==(d=null===(p=j.comparator)||void 0===p?void 0:p.length)&&void 0!==d?d:0;if(T.push([null!==(h=j.comparator)&&void 0!==h?h:""]),k>b[1]&&(b[1]=k),"block"===j.contentType)T=[],x.push(T),T.push(v(j.expectedValue,t,{prefix:" ",verbosity:m}).split(n));else{var O=r.wrapTextNodes(j.expectedValue,t);0===O[0]?(T.push(["[EMPTY STRING]"]),O[0]="[EMPTY STRING]".length):T.push(O[1]),O[0]>b[2]&&(b[2]=O[0])}if("inline"===j.contentType&&void 0!==j.actualValue){T=[],x.push(T),T.push([],["→"]),0===b[1]&&(b[1]=1);var P=__read(r.wrapTextNodes([{type:"text",value:o(j.actualValue)}],t),2),I=P[0],M=P[1];T.push(M),I>b[2]&&(b[2]=I)}}}catch(e){i={error:e}}finally{try{w&&!w.done&&(u=g.return)&&u.call(g)}finally{if(i)throw i.error}}var R=[];try{for(var V=__values(x),B=V.next();!B.done;B=V.next())for(var G=B.value;G.some((function(e){return e.length}));)R.push(_+G.map((function(e,r){var t,n=null!==(t=e.shift())&&void 0!==t?t:"",a=s(n);return a<b[r]&&(n+=" ".repeat(b[r]-a)),n[1===r?"padStart":"padEnd"](b[r])})).join(" "))}catch(e){l={error:e}}finally{try{B&&!B.done&&(f=V.return)&&f.call(V)}finally{if(l)throw l.error}}return R.join(n)}(e,a,{prefix:l,verbosity:d});case"prop":throw new Error("Prop node can only be rendered as part of Props");case"code-block":return o(e.value,(function(e){return e.split(n).map((function(e){return l+"> "+e})).join(n)}));case"test-line":case"condition":return f(e,a,{prefix:l,verbosity:d});case"test-line-result":return p(e,a,{prefix:l,verbosity:d});case"link":return e.value!==e.href&&e.value?e.value+" ("+e.href+")":e.href;default:return t.assertUnknownSectionNode(e)}},f=function(e,r,t){var a=t.prefix,o=void 0===a?"":a,i=t.verbosity,s=e.status?r(c(e.status)):"",u=e.title.map(r).join(""),l=e.children.map((function(e){return v(e,r,{prefix:o+" ",verbosity:i})})).join(""),f=[o+s+u];return"normal"!==i&&"verbose"!==i||f.push(l),f.filter(Boolean).join(n)},p=function(e,r,t){var a,o=" "+r({type:e.status,value:e.status+": "}),i="";if("excluded"===e.status)i=o+"Test line was not executed";else{var u=null===(a=e.message)||void 0===a?void 0:a.map(r).join("");u&&(i=o+function(e,r,t){void 0===r&&(r=115),void 0===t&&(t=0);var a=0===t?"":" ".repeat(t);return e.length>r?e.split(/\s/).reduce((function(e,n){var o=1===e.length?r-t:r,i=e[e.length-1],u=s(i);if(u+s(n)+1>o+5){if(u>=o-5)return e.push(a+n),e;var l=n.slice(0,o-u),c=n.slice(o-u);return e[e.length-1]=i+" "+l,e.push(a+c),e}return e[e.length-1]=(i?i+" ":"")+n,e}),[""]).join(n):e}(u,void 0,s(o)))}var l=f(e.children[0],r,t),c=e.screenshot?"screenshot: "+e.screenshot:"";return[l,i,["verbose"===t.verbosity&&e.docs?"docs: "+e.docs:"",c].filter(Boolean).map((function(e){return e.split(n)})).reduce((function(e,r){return e.concat(r)}),[]).map((function(e){return" "+e})).join(n)].filter(Boolean).join(n)};r.toText=function(e,r){var t,n,a=null!==(t=null==r?void 0:r.format)&&void 0!==t&&t,o=null!==(n=null==r?void 0:r.verbosity)&&void 0!==n?n:"normal",i=a?l:u;return Array.isArray(e)||(e=[e]),e.map((function(e){return v(e,i,{verbosity:o})})).join("")}}));
{
"name": "@suitest/smst-to-text",
"version": "4.0.1",
"version": "4.0.2",
"description": "Utility to convert SMST to plain text or ANSI-styled text",

@@ -33,4 +33,4 @@ "homepage": "https://suite.st/",

"dependencies": {
"@suitest/smst": "^4.0.0"
"@suitest/smst": "^4.0.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc