@suitest/smst
Advanced tools
Comparing version 4.0.2 to 4.2.2
@@ -1,1 +0,1 @@ | ||
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};!function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define(["require","exports","unist-builder"],e)}((function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jsx=t.assertUnknownTextNode=t.assertUnknownSectionNode=t.flatten=void 0;var n=__importDefault(e("unist-builder")),r=["text","code","subject","input"];function o(e,t){return e.reduce((function(e,o){if(null==o)return e;"string"!=typeof o&&"boolean"!=typeof o&&"number"!=typeof o||(o=n.default(r.includes(t)?t:"text",String(o)));var u,a=e[e.length-1];return"object"==typeof(u=o)&&null!==u&&r.includes(u.type)&&(null==a?void 0:a.type)===o.type?e.splice(e.length-1,1,{type:o.type,value:a.value+o.value}):e.push(o),e}),[])}t.flatten=function(e){return Array.isArray(e)?e.reduce((function(e,n){return e.concat(t.flatten(n))}),[]):[e]};var u=function(e){return o(t.flatten([e]),"text")},a=function(e){var t=u(e.name);return l(e.expectedValue)?n.default("prop",{name:t,contentType:"block",expectedValue:e.expectedValue,comparator:e.comparator,status:e.status}):n.default("prop",{name:t,contentType:"inline",expectedValue:u(e.expectedValue),actualValue:e.actualValue,comparator:e.comparator,status:e.status})},s=function(e){return e.every((function(e){return"prop"===e.type}))},l=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e&&"code-block"===e.type},i=function(e){return e.every((function(e){return"test-line"===e.type}))},c=function(e){throw new Error("Unknown intrinsic element type "+e)};t.assertUnknownSectionNode=function(e){throw new Error("Unknown node type: "+JSON.stringify(e))},t.assertUnknownTextNode=function(e){throw new Error("Unknown plain text node: "+JSON.stringify(e))},t.jsx=function(e,r){for(var l,p,f=[],d=2;d<arguments.length;d++)f[d-2]=arguments[d];var y=o(t.flatten(f),e);switch(e){case"text":case"subject":case"input":case"code":return y[0];case"fragment":return y;case"link":var v=r.href,h=y[0];return n.default("link",{href:v},null!==(l=null==h?void 0:h.value)&&void 0!==l?l:"");case"code-block":var m=r,x=y[0],w=null!==(p=null==m?void 0:m.language)&&void 0!==p?p:"javascript";return n.default("code-block",{language:w},x.value);case"prop":return a(r);case"props":if(s(y))return n.default("props",y);throw new TypeError("Props can only accept Prop as its child");case"condition":case"test-line":var g=r,b={title:u(g.title)};return g.status&&(b.status=g.status),n.default(e,b,y);case"test-line-result":var k=r;if(i(y)&&1===y.length)return n.default("test-line-result",{status:k.status,message:u(k.message),screenshot:k.screenshot,docs:k.docs},y);throw new TypeError("TestLineResult expects a single child of type TestLine");default:return c(e)}}})); | ||
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.jsx=exports.assertUnknownTextNode=exports.assertUnknownSectionNode=exports.flatten=void 0;var unist_builder_1=__importDefault(require("unist-builder")),plainTypes=["text","code","subject","input"],isTextNode=function(e){return"object"==typeof e&&null!==e&&plainTypes.includes(e.type)};function normalizePlainChildren(e,t){return e.reduce((function(e,n){if(null==n)return e;"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n||(n=unist_builder_1.default(plainTypes.includes(t)?t:"text",String(n)));var r=e[e.length-1];return isTextNode(n)&&(null==r?void 0:r.type)===n.type?e.splice(e.length-1,1,{type:n.type,value:r.value+n.value}):e.push(n),e}),[])}exports.flatten=function(e){return Array.isArray(e)?e.reduce((function(e,t){return e.concat(exports.flatten(t))}),[]):[e]};var processTextNode=function(e){return normalizePlainChildren(exports.flatten([e]),"text")},processPropertyNode=function(e){var t=processTextNode(e.name);return isCodeBlockNode(e.expectedValue)?unist_builder_1.default("prop",{name:t,contentType:"block",expectedValue:e.expectedValue,comparator:e.comparator,status:e.status}):unist_builder_1.default("prop",{name:t,contentType:"inline",expectedValue:processTextNode(e.expectedValue),actualValue:e.actualValue,comparator:e.comparator,status:e.status})},isPropChildren=function(e){return e.every((function(e){return"prop"===e.type}))},isCodeBlockNode=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e&&"code-block"===e.type},isTestLineNodeArray=function(e){return e.every((function(e){return"test-line"===e.type}))},assertUnknownIntrinsicElementType=function(e){throw new Error("Unknown intrinsic element type "+e)};function jsx(e,t){for(var n,r,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];var u=normalizePlainChildren(exports.flatten(o),e);switch(e){case"text":case"subject":case"input":case"code":return u[0];case"fragment":return u;case"link":var i=t.href,a=u[0];return unist_builder_1.default("link",{href:i},null!==(n=null==a?void 0:a.value)&&void 0!==n?n:"");case"code-block":var l=t,c=u[0],p=null!==(r=null==l?void 0:l.language)&&void 0!==r?r:"javascript";return unist_builder_1.default("code-block",{language:p},c.value);case"prop":return processPropertyNode(t);case"props":if(isPropChildren(u))return unist_builder_1.default("props",u);throw new TypeError("Props can only accept Prop as its child");case"condition":case"test-line":var d=t,f={title:processTextNode(d.title)};return d.status&&(f.status=d.status),unist_builder_1.default(e,f,u);case"test-line-result":var y=t;if(isTestLineNodeArray(u)&&1===u.length)return unist_builder_1.default("test-line-result",{status:y.status,message:processTextNode(y.message),screenshot:y.screenshot,docs:y.docs},u);throw new TypeError("TestLineResult expects a single child of type TestLine");default:return assertUnknownIntrinsicElementType(e)}}exports.assertUnknownSectionNode=function(e){throw new Error("Unknown node type: "+JSON.stringify(e))},exports.assertUnknownTextNode=function(e){throw new Error("Unknown plain text node: "+JSON.stringify(e))},exports.jsx=jsx; |
{ | ||
"name": "@suitest/smst", | ||
"version": "4.0.2", | ||
"version": "4.2.2", | ||
"description": "UNIST definition and JSX factory for Suitest test lines rendering", | ||
@@ -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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
13902
1