allure-cypress 3.0.0-beta.1 → 3.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var ge=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},me=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ce(t))!de.call(e,a)&&a!==r&&A(e,a,{get:()=>t[a],enumerable:!(s=le(t,a))||s.enumerable});return e};var fe=e=>me(A({},"__esModule",{value:!0}),e);var Ie={};ge(Ie,{AllureCypressTestRuntime:()=>b,ContentType:()=>G,LabelName:()=>l,LinkType:()=>E,Severity:()=>C,Stage:()=>f,Status:()=>p,StatusByPriority:()=>O,allureId:()=>$,attachment:()=>V,description:()=>H,descriptionHtml:()=>k,displayName:()=>B,epic:()=>J,feature:()=>X,historyId:()=>K,issue:()=>Y,label:()=>g,labels:()=>L,layer:()=>ae,link:()=>R,links:()=>j,owner:()=>re,parameter:()=>U,parentSuite:()=>ee,severity:()=>se,step:()=>W,story:()=>q,subSuite:()=>te,suite:()=>Q,tag:()=>ne,tags:()=>ie,testCaseId:()=>z,tms:()=>Z});module.exports=fe(Ie);var p=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),O=[p.FAILED,p.BROKEN,p.PASSED,p.SKIPPED],f=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),C=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),G=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),E=function(e){return e.ISSUE="issue",e.TMS="tms",e}({});function N(e,t,r,s,a,n,i){try{var u=e[n](i),o=u.value}catch(m){return void r(m)}u.done?t(o):Promise.resolve(o).then(s,a)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(s,a){var n=e.apply(t,r);function i(o){N(n,s,a,i,u,"next",o)}function u(o){N(n,s,a,i,u,"throw",o)}i(void 0)})}}var w=class{attachment(){var t=this;return d(function*(){yield t.warning()})()}description(){var t=this;return d(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return d(function*(){yield t.warning()})()}displayName(){var t=this;return d(function*(){yield t.warning()})()}historyId(){var t=this;return d(function*(){yield t.warning()})()}labels(){var t=this;return d(function*(){yield t.warning()})()}links(){var t=this;return d(function*(){yield t.warning()})()}parameter(){var t=this;return d(function*(){yield t.warning()})()}step(t,r){var s=this;return d(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return d(function*(){yield t.warning()})()}stepParameter(){var t=this;return d(function*(){yield t.warning()})()}testCaseId(){var t=this;return d(function*(){yield t.warning()})()}warning(){return d(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},h=new w;var F="allureTestRuntime",T=e=>{globalThis[F]=()=>e},I=()=>globalThis?.[F],v=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}return h},P=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=I())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:h})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),h}return h};function S(){S=function(n,i){return new r(n,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function r(a,n,i){var u=RegExp(a,n);return t.set(u,i||t.get(a)),x(u,r.prototype)}function s(a,n){var i=t.get(n);return Object.keys(i).reduce(function(u,o){var m=i[o];if(typeof m=="number")u[o]=a[m];else{for(var y=0;a[m[y]]===void 0&&y+1<m.length;)y++;u[o]=a[m[y]]}return u},Object.create(null))}return ye(r,RegExp),r.prototype.exec=function(a){var n=e.exec.call(this,a);if(n){n.groups=s(n,this);var i=n.indices;i&&(i.groups=s(i,this))}return n},r.prototype[Symbol.replace]=function(a,n){if(typeof n=="string"){var i=t.get(this);return e[Symbol.replace].call(this,a,n.replace(/\$<([^>]+)>/g,function(o,m){var y=i[m];return"$"+(Array.isArray(y)?y.join("$"):y)}))}if(typeof n=="function"){var u=this;return e[Symbol.replace].call(this,a,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(s(o,u)),n.apply(this,o)})}return e[Symbol.replace].call(this,a,n)},S.apply(this,arguments)}function ye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},x(e,t)}var he=S(/@?allure.id[:=]([^\s]+)/,{id:1}),Ge=new RegExp(he,"g"),ve=S(/@?allure.label.([^\s]+?)[:=]([^\s]+)/,{name:1,value:2}),Ne=new RegExp(ve,"g");var _=e=>e.some(t=>t.type==="step_start"||t.type==="step_stop"),Ee=e=>e.reduce((t,r)=>{if(r.type!=="step_start"&&r.type!=="step_stop")return t;if(r.type==="step_start")return t.push([r]),t;var s=t.findLastIndex(a=>a.length===1);return s===-1||t[s].push(r),t},[]),M=e=>{var t=Ee(e);return t.filter(r=>r.length===1)},D=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var c=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];var n=P();return D(n)?n.then(i=>i[t](...s)):n[t](...s)},g=(e,t)=>c("labels",{name:e,value:t}),L=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r)},R=(e,t,r)=>c("links",{url:e,type:t,name:r}),j=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("links",...r)},U=(e,t,r)=>c("parameter",e,t,r),H=e=>c("description",e),k=e=>c("descriptionHtml",e),B=e=>c("displayName",e),K=e=>c("historyId",e),z=e=>c("testCaseId",e),V=(e,t,r)=>c("attachment",e,t,r),Se=()=>({displayName:e=>c("stepDisplayName",e),parameter:(e,t,r)=>c("stepParameter",e,t,r)}),W=(e,t)=>c("step",e,()=>t(Se())),Y=(e,t)=>R(e,E.ISSUE,t),Z=(e,t)=>R(e,E.TMS,t),$=e=>g(l.ALLURE_ID,e),J=e=>g(l.EPIC,e),X=e=>g(l.FEATURE,e),q=e=>g(l.STORY,e),Q=e=>g(l.SUITE,e),ee=e=>g(l.PARENT_SUITE,e),te=e=>g(l.SUB_SUITE,e),re=e=>g(l.OWNER,e),se=e=>g(l.SEVERITY,e),ae=e=>g(l.LAYER,e),ne=e=>g(l.TAG,e),ie=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r.map(a=>({name:l.TAG,value:a})))};var oe=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,ue=(e,t)=>Array.isArray(e)||e.buffer?"base64":t,pe=e=>{let t=[],r=e.parent;for(;r;)r.title&&t.unshift(r.title),r=r.parent;return t};var b=class{label(t,r){return this.sendMessageAsync({type:"metadata",data:{labels:[{name:t,value:r}]}})}labels(...t){return this.sendMessageAsync({type:"metadata",data:{labels:t}})}link(t,r,s){return this.sendMessageAsync({type:"metadata",data:{links:[{type:r,url:t,name:s}]}})}links(...t){return this.sendMessageAsync({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.sendMessageAsync({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.sendMessageAsync({type:"metadata",data:{displayName:t}})}historyId(t){return this.sendMessageAsync({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.sendMessageAsync({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let a=r?.type==="Buffer"?r.data:r,n=r instanceof Buffer?"base64":"utf-8",i=ue(a,n),u=oe(a);return this.sendMessageAsync({type:"raw_attachment",data:{content:u,encoding:i,contentType:s,name:t}})}step(t,r){return cy.wrap(null,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.sendMessageAsync({type:"step_stop",data:{status:p.PASSED,stage:f.FINISHED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.sendMessageAsync({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}sendMessage(t){let r=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",r.concat(t))}sendMessageAsync(t){return this.sendMessage(t),Cypress.Promise.resolve()}},{EVENT_TEST_BEGIN:Re,EVENT_TEST_FAIL:be,EVENT_TEST_PASS:Ae}=Mocha.Runner.constants,we=()=>{Cypress.env("allureInitialized")||(Cypress.mocha.getRunner().on(Re,t=>{let r=new b;Cypress.env("allureRuntimeMessages",[]),r.sendMessage({type:"cypress_start",data:{isInteractive:Cypress.config("isInteractive"),absolutePath:Cypress.spec.absolute,specPath:pe(t).concat(t.title),filename:Cypress.spec.relative,start:Date.now()}}),T(r)}).on(Ae,()=>{let t=v(),r=Cypress.env("allureRuntimeMessages");M(r).forEach(()=>{t.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}),t.sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}).on(be,(t,r)=>{v().sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:r.constructor.name==="AssertionError"?p.FAILED:p.BROKEN,statusDetails:{message:r.message,trace:r.stack},stop:Date.now()}})}),Cypress.Screenshot.defaults({onAfterScreenshot:(t,r)=>{v().sendMessage({type:"cypress_screenshot",data:{path:r.path,name:r.name||"Screenshot"}})}}),Cypress.on("fail",t=>{let r=v(),s=Cypress.env("allureRuntimeMessages");if(!_(s))throw t;let n=M(s);if(n.length===0)throw t;let i=t.constructor.name==="AssertionError"?p.FAILED:p.BROKEN;throw n.forEach(()=>{r.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:i,stop:Date.now(),statusDetails:{message:t.message,trace:t.stack}}})}),t}),afterEach(()=>{let t=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",t,{log:!1})}),Cypress.env("allureInitialized",!0))};we();
1
+ "use strict";var T=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var me=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},ge=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ce(t))!de.call(e,n)&&n!==r&&T(e,n,{get:()=>t[n],enumerable:!(s=le(t,n))||s.enumerable});return e};var fe=e=>ge(T({},"__esModule",{value:!0}),e);var we={};me(we,{AllureCypressTestRuntime:()=>b,ContentType:()=>x,LabelName:()=>l,LinkType:()=>E,Severity:()=>F,Stage:()=>f,Status:()=>p,StatusByPriority:()=>C,allureId:()=>$,attachment:()=>V,description:()=>H,descriptionHtml:()=>B,displayName:()=>k,epic:()=>J,feature:()=>X,historyId:()=>K,issue:()=>Y,label:()=>m,labels:()=>j,layer:()=>ne,link:()=>R,links:()=>L,owner:()=>re,parameter:()=>U,parentSuite:()=>ee,severity:()=>se,step:()=>W,story:()=>q,subSuite:()=>te,suite:()=>Q,tag:()=>ae,tags:()=>ie,testCaseId:()=>z,tms:()=>Z});module.exports=fe(we);var p=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),C=[p.FAILED,p.BROKEN,p.PASSED,p.SKIPPED],f=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),F=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),x=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),E=function(e){return e.ISSUE="issue",e.TMS="tms",e}({});function G(e,t,r,s,n,a,i){try{var u=e[a](i),o=u.value}catch(g){return void r(g)}u.done?t(o):Promise.resolve(o).then(s,n)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(s,n){var a=e.apply(t,r);function i(o){G(a,s,n,i,u,"next",o)}function u(o){G(a,s,n,i,u,"throw",o)}i(void 0)})}}var w=class{attachment(){var t=this;return d(function*(){yield t.warning()})()}attachmentFromPath(){var t=this;return d(function*(){yield t.warning()})()}description(){var t=this;return d(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return d(function*(){yield t.warning()})()}displayName(){var t=this;return d(function*(){yield t.warning()})()}historyId(){var t=this;return d(function*(){yield t.warning()})()}labels(){var t=this;return d(function*(){yield t.warning()})()}links(){var t=this;return d(function*(){yield t.warning()})()}parameter(){var t=this;return d(function*(){yield t.warning()})()}step(t,r){var s=this;return d(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return d(function*(){yield t.warning()})()}stepParameter(){var t=this;return d(function*(){yield t.warning()})()}testCaseId(){var t=this;return d(function*(){yield t.warning()})()}warning(){return d(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},y=new w;var N="allureTestRuntime",P=e=>{globalThis[N]=()=>e},I=()=>globalThis?.[N],v=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:y}return y},_=()=>{var e=I();if(e){var t;return(t=e())!==null&&t!==void 0?t:y}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=I())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:y})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),y}return y};function S(){S=function(a,i){return new r(a,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function r(n,a,i){var u=RegExp(n,a);return t.set(u,i||t.get(n)),M(u,r.prototype)}function s(n,a){var i=t.get(a);return Object.keys(i).reduce(function(u,o){var g=i[o];if(typeof g=="number")u[o]=n[g];else{for(var h=0;n[g[h]]===void 0&&h+1<g.length;)h++;u[o]=n[g[h]]}return u},Object.create(null))}return he(r,RegExp),r.prototype.exec=function(n){var a=e.exec.call(this,n);if(a){a.groups=s(a,this);var i=a.indices;i&&(i.groups=s(i,this))}return a},r.prototype[Symbol.replace]=function(n,a){if(typeof a=="string"){var i=t.get(this);return e[Symbol.replace].call(this,n,a.replace(/\$<([^>]+)>/g,function(o,g){var h=i[g];return"$"+(Array.isArray(h)?h.join("$"):h)}))}if(typeof a=="function"){var u=this;return e[Symbol.replace].call(this,n,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(s(o,u)),a.apply(this,o)})}return e[Symbol.replace].call(this,n,a)},S.apply(this,arguments)}function he(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}function M(e,t){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},M(e,t)}var ye=S(/@?allure.id[:=]([^\s]+)/,{id:1}),Fe=new RegExp(ye,"g"),ve=S(/@?allure.label.([^\s]+?)[:=]([^\s]+)/,{name:1,value:2}),Ge=new RegExp(ve,"g");var D=e=>e.some(t=>t.type==="step_start"||t.type==="step_stop"),Ee=e=>e.reduce((t,r)=>{if(r.type!=="step_start"&&r.type!=="step_stop")return t;if(r.type==="step_start")return t.push([r]),t;var s=t.findLastIndex(n=>n.length===1);return s===-1||t[s].push(r),t},[]),A=e=>{var t=Ee(e);return t.filter(r=>r.length===1)},O=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var c=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var a=_();return O(a)?a.then(i=>i[t](...s)):a[t](...s)},m=(e,t)=>c("labels",{name:e,value:t}),j=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r)},R=(e,t,r)=>c("links",{url:e,type:r,name:t}),L=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("links",...r)},U=(e,t,r)=>c("parameter",e,t,r),H=e=>c("description",e),B=e=>c("descriptionHtml",e),k=e=>c("displayName",e),K=e=>c("historyId",e),z=e=>c("testCaseId",e),V=(e,t,r)=>{var s=typeof r=="string"?{contentType:r}:r;return c("attachment",e,t,s)};var xe=()=>({displayName:e=>c("stepDisplayName",e),parameter:(e,t,r)=>c("stepParameter",e,t,r)}),W=(e,t)=>c("step",e,()=>t(xe())),Y=(e,t)=>R(e,t,E.ISSUE),Z=(e,t)=>R(e,t,E.TMS),$=e=>m(l.ALLURE_ID,e),J=e=>m(l.EPIC,e),X=e=>m(l.FEATURE,e),q=e=>m(l.STORY,e),Q=e=>m(l.SUITE,e),ee=e=>m(l.PARENT_SUITE,e),te=e=>m(l.SUB_SUITE,e),re=e=>m(l.OWNER,e),se=e=>m(l.SEVERITY,e),ne=e=>m(l.LAYER,e),ae=e=>m(l.TAG,e),ie=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r.map(n=>({name:l.TAG,value:n})))};var oe=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,ue=(e,t)=>Array.isArray(e)||e.buffer?"base64":t,pe=e=>{let t=[],r=e.parent;for(;r;)r.title&&t.unshift(r.title),r=r.parent;return t};var b=class{labels(...t){return this.sendMessageAsync({type:"metadata",data:{labels:t}})}links(...t){return this.sendMessageAsync({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.sendMessageAsync({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.sendMessageAsync({type:"metadata",data:{displayName:t}})}historyId(t){return this.sendMessageAsync({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.sendMessageAsync({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let n=r?.type==="Buffer"?r.data:r,a=r instanceof Buffer?"base64":"utf-8",i=ue(n,a),u=oe(n);return this.sendMessageAsync({type:"attachment_content",data:{name:t,content:u,encoding:i,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(t,r,s){return this.sendMessageAsync({type:"attachment_path",data:{name:t,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}step(t,r){return cy.wrap(null,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.sendMessageAsync({type:"step_stop",data:{status:p.PASSED,stage:f.FINISHED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.sendMessageAsync({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}sendMessage(t){let r=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",r.concat(t))}sendMessageAsync(t){return this.sendMessage(t),Cypress.Promise.resolve()}},{EVENT_TEST_BEGIN:Ae,EVENT_TEST_FAIL:Re,EVENT_TEST_PASS:be}=Mocha.Runner.constants,Te=()=>{Cypress.env("allureInitialized")||(Cypress.mocha.getRunner().on(Ae,t=>{let r=new b;Cypress.env("allureRuntimeMessages",[]),r.sendMessage({type:"cypress_start",data:{isInteractive:Cypress.config("isInteractive"),absolutePath:Cypress.spec.absolute,specPath:pe(t).concat(t.title),filename:Cypress.spec.relative,start:Date.now()}}),P(r)}).on(be,()=>{let t=v(),r=Cypress.env("allureRuntimeMessages");A(r).forEach(()=>{t.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}),t.sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:p.PASSED,stop:Date.now()}})}).on(Re,(t,r)=>{v().sendMessage({type:"cypress_end",data:{stage:f.FINISHED,status:r.constructor.name==="AssertionError"?p.FAILED:p.BROKEN,statusDetails:{message:r.message,trace:r.stack},stop:Date.now()}})}),Cypress.Screenshot.defaults({onAfterScreenshot:(t,r)=>v().sendMessageAsync({type:"attachment_path",data:{path:r.path,name:r.name||"Screenshot",contentType:x.PNG}})}),Cypress.on("fail",t=>{let r=v(),s=Cypress.env("allureRuntimeMessages");if(!D(s))throw t;let a=A(s);if(a.length===0)throw t;let i=t.constructor.name==="AssertionError"?p.FAILED:p.BROKEN;throw a.forEach(()=>{r.sendMessage({type:"step_stop",data:{stage:f.FINISHED,status:i,stop:Date.now(),statusDetails:{message:t.message,trace:t.stack}}})}),t}),afterEach(()=>{let t=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",t,{log:!1})}),Cypress.env("allureInitialized",!0))};Te();
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts", "../../../allure-js-commons/src/model.ts", "../../../allure-js-commons/src/sdk/runtime/NoopTestRuntime.ts", "../../../allure-js-commons/src/sdk/runtime/runtime.ts", "../../../allure-js-commons/src/sdk/utils.ts", "../../../allure-js-commons/src/facade.ts", "../../src/utils.ts"],
4
- "sourcesContent": ["import { Stage, Status } from \"allure-js-commons\";\nimport type { ContentType, Label, LabelName, Link, LinkType, ParameterMode, ParameterOptions } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { getUnfinishedStepsMessages, hasStepMessage } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport type { CypressRuntimeMessage } from \"./model.js\";\nimport { getSuitePath, normalizeAttachmentContentEncoding, uint8ArrayToBase64 } from \"./utils.js\";\n\nexport class AllureCypressTestRuntime implements TestRuntime {\n label(name: LabelName | string, value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels: [{ name, value }],\n },\n });\n }\n\n labels(...labels: Label[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n link(url: string, type?: LinkType | string, name?: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links: [{ type, url, name }],\n },\n });\n }\n\n links(...links: Link[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Buffer | string, type: string | ContentType) {\n // @ts-ignore\n const attachmentRawContent: string | Uint8Array = content?.type === \"Buffer\" ? content.data : content;\n const encoding = content instanceof Buffer ? \"base64\" : \"utf-8\";\n const actualEncoding = normalizeAttachmentContentEncoding(attachmentRawContent, encoding);\n const attachmentContent = uint8ArrayToBase64(attachmentRawContent);\n\n return this.sendMessageAsync({\n type: \"raw_attachment\",\n data: {\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: type,\n name,\n },\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(null, { log: false })\n .then(() => {\n this.sendMessage({\n type: \"step_start\",\n data: { name, start: Date.now() },\n });\n\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n return this.sendMessageAsync({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stage: Stage.FINISHED,\n stop: Date.now(),\n },\n }).then(() => result);\n });\n }\n\n stepDisplayName(name: string) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n sendMessage(message: CypressRuntimeMessage) {\n const messages = Cypress.env(\"allureRuntimeMessages\") || [];\n\n Cypress.env(\"allureRuntimeMessages\", messages.concat(message));\n }\n\n sendMessageAsync(message: CypressRuntimeMessage): PromiseLike<void> {\n this.sendMessage(message);\n return Cypress.Promise.resolve();\n }\n}\n\nconst { EVENT_TEST_BEGIN, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants;\n\nconst initializeAllure = () => {\n const initialized = Cypress.env(\"allureInitialized\") as boolean;\n\n if (initialized) {\n return;\n }\n\n // @ts-ignore\n Cypress.mocha\n .getRunner()\n .on(EVENT_TEST_BEGIN, (test: Mocha.Test) => {\n const testRuntime = new AllureCypressTestRuntime();\n\n Cypress.env(\"allureRuntimeMessages\", []);\n\n testRuntime.sendMessage({\n type: \"cypress_start\",\n data: {\n isInteractive: Cypress.config(\"isInteractive\"),\n absolutePath: Cypress.spec.absolute,\n specPath: getSuitePath(test).concat(test.title),\n filename: Cypress.spec.relative,\n start: Date.now(),\n },\n });\n\n setGlobalTestRuntime(testRuntime);\n })\n .on(EVENT_TEST_PASS, () => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n });\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n })\n .on(EVENT_TEST_FAIL, (test: Mocha.Test, err: Error) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN,\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n stop: Date.now(),\n },\n });\n });\n\n Cypress.Screenshot.defaults({\n onAfterScreenshot: (_, details) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_screenshot\",\n data: {\n path: details.path,\n name: details.name || \"Screenshot\",\n },\n });\n },\n });\n\n Cypress.on(\"fail\", (err) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const hasSteps = hasStepMessage(runtimeMessages as RuntimeMessage[]);\n\n // if there is no steps, don't handle the error\n if (!hasSteps) {\n throw err;\n }\n\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n if (unfinishedStepsMessages.length === 0) {\n throw err;\n }\n\n const failedStepsStatus = err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN;\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: failedStepsStatus,\n stop: Date.now(),\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n },\n });\n });\n\n throw err;\n });\n\n afterEach(() => {\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n\n cy.task(\"allureReportTest\", runtimeMessages, { log: false });\n });\n\n Cypress.env(\"allureInitialized\", true);\n};\n\ninitializeAllure();\n\nexport * from \"allure-js-commons\";\n", "export interface Attachment {\n name: string;\n type: string;\n source: string;\n}\n\nexport interface AttachmentOptions {\n contentType: ContentType | string;\n encoding?: string;\n fileExtension?: string;\n}\n\nexport interface Label {\n name: LabelName | string;\n value: string;\n}\n\nexport interface Link {\n name?: string;\n url: string;\n type?: LinkType | string;\n}\n\nexport type ParameterMode = \"hidden\" | \"masked\" | \"default\";\n\nexport interface Parameter {\n name: string;\n value: string;\n excluded?: boolean;\n mode?: ParameterMode;\n}\n\nexport type ParameterOptions = Pick<Parameter, \"mode\" | \"excluded\">;\n\nexport interface StatusDetails {\n message?: string;\n trace?: string;\n}\n\n// don't use the interface as is, use Results types instead\ninterface Executable {\n name?: string;\n status?: Status;\n statusDetails: StatusDetails;\n stage: Stage;\n description?: string;\n descriptionHtml?: string;\n steps: StepResult[];\n attachments: Attachment[];\n parameters: Parameter[];\n start?: number;\n stop?: number;\n}\n\nexport interface FixtureResult extends Executable {}\n\nexport interface StepResult extends Executable {}\n\nexport interface TestResult extends Executable {\n uuid: string;\n historyId?: string;\n fullName?: string;\n testCaseId?: string;\n labels: Label[];\n links: Link[];\n}\n\nexport interface TestResultContainer {\n uuid: string;\n name?: string;\n children: string[];\n befores: FixtureResult[];\n afters: FixtureResult[];\n}\n\nexport type TestOrStepResult = StepResult | TestResult;\n\n/* eslint-disable no-shadow */\nexport enum Status {\n FAILED = \"failed\",\n BROKEN = \"broken\",\n PASSED = \"passed\",\n SKIPPED = \"skipped\",\n}\n\nexport const StatusByPriority = [Status.FAILED, Status.BROKEN, Status.PASSED, Status.SKIPPED];\n\n/* eslint-disable no-shadow */\nexport enum Stage {\n SCHEDULED = \"scheduled\",\n RUNNING = \"running\",\n FINISHED = \"finished\",\n PENDING = \"pending\",\n INTERRUPTED = \"interrupted\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LabelName {\n ALLURE_ID = \"ALLURE_ID\",\n /**\n * @deprecated please use ALLURE_ID instead\n */\n AS_ID = ALLURE_ID,\n SUITE = \"suite\",\n PARENT_SUITE = \"parentSuite\",\n SUB_SUITE = \"subSuite\",\n EPIC = \"epic\",\n FEATURE = \"feature\",\n STORY = \"story\",\n SEVERITY = \"severity\",\n TAG = \"tag\",\n OWNER = \"owner\",\n LEAD = \"lead\",\n HOST = \"host\",\n THREAD = \"thread\",\n TEST_METHOD = \"testMethod\",\n TEST_CLASS = \"testClass\",\n PACKAGE = \"package\",\n FRAMEWORK = \"framework\",\n LANGUAGE = \"language\",\n LAYER = \"layer\",\n}\n\n/* eslint-disable no-shadow */\nexport enum Severity {\n BLOCKER = \"blocker\",\n CRITICAL = \"critical\",\n NORMAL = \"normal\",\n MINOR = \"minor\",\n TRIVIAL = \"trivial\",\n}\n\n/* eslint-disable no-shadow */\nexport enum ContentType {\n TEXT = \"text/plain\",\n XML = \"application/xml\",\n HTML = \"text/html\",\n CSV = \"text/csv\",\n TSV = \"text/tab-separated-values\",\n CSS = \"text/css\",\n URI = \"text/uri-list\",\n SVG = \"image/svg+xml\",\n PNG = \"image/png\",\n JSON = \"application/json\",\n ZIP = \"application/zip\",\n WEBM = \"video/webm\",\n JPEG = \"image/jpeg\",\n MP4 = \"video/mp4\",\n IMAGEDIFF = \"application/vnd.allure.image.diff\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LinkType {\n ISSUE = \"issue\",\n TMS = \"tms\",\n}\n\nexport interface ImageDiffAttachment {\n expected: string | undefined; // data:image;base64,\n actual: string | undefined; // data:image;base64,\n diff: string | undefined; // data:image;base64,\n name: string;\n}\n", "import type { TestRuntime } from \"./types.js\";\n\nexport class NoopTestRuntime implements TestRuntime {\n async attachment() {\n await this.warning();\n }\n\n async description() {\n await this.warning();\n }\n\n async descriptionHtml() {\n await this.warning();\n }\n\n async displayName() {\n await this.warning();\n }\n\n async historyId() {\n await this.warning();\n }\n\n async labels() {\n await this.warning();\n }\n\n async links() {\n await this.warning();\n }\n\n async parameter() {\n await this.warning();\n }\n\n async step<T>(name: string, body: () => T | PromiseLike<T>): Promise<T> {\n await this.warning();\n return body();\n }\n\n async stepDisplayName() {\n await this.warning();\n }\n\n async stepParameter() {\n await this.warning();\n }\n\n async testCaseId() {\n await this.warning();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async warning() {\n // eslint-disable-next-line no-console\n console.log(\"no test runtime is found. Please check test framework configuration\");\n }\n}\n\nexport const noopRuntime = new NoopTestRuntime();\n", "import { noopRuntime } from \"./NoopTestRuntime.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nconst ALLURE_TEST_RUNTIME_KEY = \"allureTestRuntime\";\n\nexport const setGlobalTestRuntime = (runtime: TestRuntime) => {\n (globalThis as any)[ALLURE_TEST_RUNTIME_KEY] = () => runtime;\n};\n\nconst getGlobalTestRuntimeFunction = () => {\n return (globalThis as any)?.[ALLURE_TEST_RUNTIME_KEY] as (() => TestRuntime | undefined) | undefined;\n};\n\nexport const getGlobalTestRuntime = (): TestRuntime => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n return noopRuntime;\n};\n\nexport const getGlobalTestRuntimeWithAutoconfig = (): TestRuntime | Promise<TestRuntime> => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n if (\"_playwrightInstance\" in globalThis) {\n try {\n // protection from bundlers tree-shaking visiting (webpack, rollup)\n // @ts-ignore\n // eslint-disable-next-line no-eval\n return (0, eval)(\"(() => import('allure-playwright/autoconfig'))()\").then(() => {\n return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(\"can't execute allure-playwright/autoconfig\", err);\n return noopRuntime;\n }\n }\n\n return noopRuntime;\n};\n", "import type { FixtureResult, Label, StatusDetails, StepResult, TestResult } from \"../model.js\";\nimport { LabelName, Status } from \"../model.js\";\nimport type { RuntimeMessage } from \"./types.js\";\n\nexport const getStatusFromError = (error: Error): Status => {\n switch (true) {\n /**\n * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError`\n * `jest` throws `JestAssertionError` instance\n * `jasmine` throws `ExpectationFailed` instance\n */\n case /assert/gi.test(error.constructor.name):\n case /expectation/gi.test(error.constructor.name):\n case /assert/gi.test(error.name):\n case /assert/gi.test(error.message):\n return Status.FAILED;\n default:\n return Status.BROKEN;\n }\n};\n\n/**\n * Source: https://github.com/chalk/ansi-regex\n */\nexport const ansiRegex = ({ onlyFirst = false } = {}) => {\n const pattern = [\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\",\n \"(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\",\n ].join(\"|\");\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n\n/**\n * https://github.com/chalk/strip-ansi\n */\nexport const stripAnsi = (str: string) => {\n if (typeof str !== \"string\") {\n throw new TypeError(`Expected a \\`string\\`, got \\`${typeof str}\\``);\n }\n\n const regex = ansiRegex();\n\n return str.replace(regex, \"\");\n};\n\nexport const getMessageAndTraceFromError = (\n error: Error | { message?: string; stack?: string },\n): Pick<StatusDetails, \"message\" | \"trace\"> => {\n const { message, stack } = error;\n return {\n message: message ? stripAnsi(message) : undefined,\n trace: stack ? stripAnsi(stack) : undefined,\n };\n};\n\nexport const allureIdRegexp = /@?allure.id[:=](?<id>[^\\s]+)/;\nexport const allureIdRegexpGlobal = new RegExp(allureIdRegexp, \"g\");\nexport const allureLabelRegexp = /@?allure.label.(?<name>[^\\s]+?)[:=](?<value>[^\\s]+)/;\nexport const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, \"g\");\n\nexport const extractMetadataFromString = (\n title: string,\n): {\n labels: Label[];\n cleanTitle: string;\n} => {\n const labels = [] as Label[];\n\n title.split(\" \").forEach((val) => {\n const idValue = val.match(allureIdRegexp)?.groups?.id;\n\n if (idValue) {\n labels.push({ name: LabelName.ALLURE_ID, value: idValue });\n }\n\n const labelMatch = val.match(allureLabelRegexp);\n const { name, value } = labelMatch?.groups || {};\n\n if (name && value) {\n labels?.push({ name, value });\n }\n });\n\n const cleanTitle = title.replace(allureLabelRegexpGlobal, \"\").replace(allureIdRegexpGlobal, \"\").trim();\n\n return { labels, cleanTitle };\n};\n\nexport const isAnyStepFailed = (item: StepResult | TestResult | FixtureResult): boolean => {\n const isFailed = item.status === Status.FAILED;\n\n if (isFailed || item.steps.length === 0) {\n return isFailed;\n }\n\n return !!item.steps.find((step) => isAnyStepFailed(step));\n};\n\nexport const isAllStepsEnded = (item: StepResult | TestResult | FixtureResult): boolean => {\n return item.steps.every((val) => val.stop && isAllStepsEnded(val));\n};\n\nexport const hasLabel = (testResult: TestResult, labelName: LabelName | string): boolean => {\n return !!testResult.labels.find((l) => l.name === labelName);\n};\n\nexport const hasStepMessage = (messages: RuntimeMessage[]) => {\n return messages.some((message) => message.type === \"step_start\" || message.type === \"step_stop\");\n};\n\nexport const getStepsMessagesPair = (messages: RuntimeMessage[]) =>\n messages.reduce((acc, message) => {\n if (message.type !== \"step_start\" && message.type !== \"step_stop\") {\n return acc;\n }\n\n if (message.type === \"step_start\") {\n acc.push([message]);\n\n return acc;\n }\n\n const unfinishedStepIdx = acc.findLastIndex((step) => step.length === 1);\n\n if (unfinishedStepIdx === -1) {\n return acc;\n }\n\n acc[unfinishedStepIdx].push(message);\n\n return acc;\n }, [] as RuntimeMessage[][]);\n\nexport const getUnfinishedStepsMessages = (messages: RuntimeMessage[]) => {\n const grouppedStepsMessage = getStepsMessagesPair(messages);\n\n return grouppedStepsMessage.filter((step) => step.length === 1);\n};\n\nexport const isPromise = (obj: any): boolean =>\n !!obj && (typeof obj === \"object\" || typeof obj === \"function\") && typeof obj.then === \"function\";\n", "import type { ContentType, Label, Link, ParameterMode, ParameterOptions } from \"./model.js\";\nimport { LabelName, LinkType } from \"./model.js\";\nimport { getGlobalTestRuntimeWithAutoconfig } from \"./sdk/runtime/runtime.js\";\nimport type { TestRuntime } from \"./sdk/runtime/types.js\";\nimport { isPromise } from \"./sdk/utils.js\";\n\nconst callRuntimeMethod = (method: string, ...args: any[]) => {\n const runtime = getGlobalTestRuntimeWithAutoconfig();\n\n if (!isPromise(runtime)) {\n // @ts-ignore\n return (runtime as TestRuntime)[method](...args);\n }\n\n return (runtime as Promise<TestRuntime>).then((testRuntime) => {\n // @ts-ignore\n return testRuntime[method](...args);\n });\n};\n\nexport const label = (name: LabelName | string, value: string) => {\n return callRuntimeMethod(\"labels\", { name, value });\n // const runtime = getGlobalTestRuntimeWithAutoconfig();\n //\n // if (!isPromise(runtime)) {\n // return (runtime as TestRuntime).labels({ name, value });\n // }\n //\n // return (runtime as Promise<TestRuntime>).then((testRuntime) => testRuntime.labels({ name, value }));\n};\n\nexport const labels = (...labelsList: Label[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.labels(...labelsList);\n return callRuntimeMethod(\"labels\", ...labelsList);\n};\n\nexport const link = (url: string, type?: LinkType | string, name?: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.links({ url, type, name });\n return callRuntimeMethod(\"links\", { url, type, name });\n};\n\nexport const links = (...linksList: Link[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.links(...linksList);\n return callRuntimeMethod(\"links\", ...linksList);\n};\n\nexport const parameter = (name: string, value: string, options?: ParameterOptions) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.parameter(name, value, options);\n return callRuntimeMethod(\"parameter\", name, value, options);\n};\n\nexport const description = (markdown: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.description(markdown);\n return callRuntimeMethod(\"description\", markdown);\n};\n\nexport const descriptionHtml = (html: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.descriptionHtml(html);\n return callRuntimeMethod(\"descriptionHtml\", html);\n};\n\nexport const displayName = (name: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.displayName(name);\n return callRuntimeMethod(\"displayName\", name);\n};\n\nexport const historyId = (value: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.historyId(value);\n return callRuntimeMethod(\"historyId\", value);\n};\n\nexport const testCaseId = (value: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.testCaseId(value);\n return callRuntimeMethod(\"testCaseId\", value);\n};\n\nexport const attachment = (name: string, content: Buffer | string, type: ContentType | string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.attachment(name, content, type);\n return callRuntimeMethod(\"attachment\", name, content, type);\n};\n\nexport type StepContext = {\n displayName: (name: string) => void | PromiseLike<void>;\n parameter: (name: string, value: string, mode?: ParameterMode) => void | PromiseLike<void>;\n};\n\nconst stepContext: () => StepContext = () => ({\n displayName: (name: string) => {\n // return runtime.stepDisplayName(name);\n return callRuntimeMethod(\"stepDisplayName\", name);\n },\n parameter: (name, value, mode?) => {\n // return runtime.stepParameter(name, value, mode);\n return callRuntimeMethod(\"stepParameter\", name, value, mode);\n },\n});\n\nexport const step = <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => {\n // throw new Error(\"Not implemented\");\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.step(name, () => body(stepContext(runtime)));\n return callRuntimeMethod(\"step\", name, () => body(stepContext()));\n};\n\nexport const issue = (url: string, name?: string) => link(url, LinkType.ISSUE, name);\n\nexport const tms = (url: string, name?: string) => link(url, LinkType.TMS, name);\n\nexport const allureId = (value: string) => label(LabelName.ALLURE_ID, value);\n\nexport const epic = (name: string) => label(LabelName.EPIC, name);\n\nexport const feature = (name: string) => label(LabelName.FEATURE, name);\n\nexport const story = (name: string) => label(LabelName.STORY, name);\n\nexport const suite = (name: string) => label(LabelName.SUITE, name);\n\nexport const parentSuite = (name: string) => label(LabelName.PARENT_SUITE, name);\n\nexport const subSuite = (name: string) => label(LabelName.SUB_SUITE, name);\n\nexport const owner = (name: string) => label(LabelName.OWNER, name);\n\nexport const severity = (name: string) => label(LabelName.SEVERITY, name);\n\nexport const layer = (name: string) => label(LabelName.LAYER, name);\n\nexport const tag = (name: string) => label(LabelName.TAG, name);\n\nexport const tags = (...tagsList: string[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.labels(...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n return callRuntimeMethod(\"labels\", ...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n};\n", "export const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const normalizeAttachmentContentEncoding = (data: unknown, encoding: BufferEncoding): BufferEncoding => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (u8arrayLike) {\n return \"base64\";\n }\n\n return encoding;\n};\n\nexport const getSuitePath = (test: Mocha.Test): string[] => {\n const path: string[] = [];\n let currentSuite: Mocha.Suite | undefined = test.parent;\n\n while (currentSuite) {\n if (currentSuite.title) {\n path.unshift(currentSuite.title);\n }\n\n currentSuite = currentSuite.parent;\n }\n\n return path;\n};\n"],
5
- "mappings": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,8BAAAE,EAAA,gBAAAC,EAAA,cAAAC,EAAA,aAAAC,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CV,EAAY,YAAY,CACtB,KAAM,YACN,KAAM,CACJ,MAAOT,EAAM,SACb,OAAQoB,EACR,KAAM,KAAK,IAAI,EACf,cAAe,CACb,QAASL,EAAI,QACb,MAAOA,EAAI,KACb,CACF,CACF,CAAC,CACH,CAAC,EAEKA,CACR,CAAC,EAED,UAAU,IAAM,CACd,IAAMF,EAAkB,QAAQ,IAAI,uBAAuB,EAE3D,GAAG,KAAK,mBAAoBA,EAAiB,CAAE,IAAK,EAAM,CAAC,CAC7D,CAAC,EAED,QAAQ,IAAI,oBAAqB,EAAI,EACvC,EAEAN,GAAiB",
6
- "names": ["src_exports", "__export", "AllureCypressTestRuntime", "ContentType", "LabelName", "LinkType", "Severity", "Stage", "Status", "StatusByPriority", "allureId", "attachment", "description", "descriptionHtml", "displayName", "epic", "feature", "historyId", "issue", "label", "labels", "layer", "link", "links", "owner", "parameter", "parentSuite", "severity", "step", "story", "subSuite", "suite", "tag", "tags", "testCaseId", "tms", "__toCommonJS", "Status", "StatusByPriority", "FAILED", "BROKEN", "PASSED", "SKIPPED", "Stage", "LabelName", "Severity", "ContentType", "LinkType", "NoopTestRuntime", "attachment", "_this", "_asyncToGenerator", "warning", "description", "_this2", "descriptionHtml", "_this3", "displayName", "_this4", "historyId", "_this5", "labels", "_this6", "links", "_this7", "parameter", "_this8", "step", "name", "body", "_this9", "stepDisplayName", "_this10", "stepParameter", "_this11", "testCaseId", "_this12", "console", "log", "noopRuntime", "ALLURE_TEST_RUNTIME_KEY", "setGlobalTestRuntime", "runtime", "globalThis", "getGlobalTestRuntimeFunction", "getGlobalTestRuntime", "testRuntime", "_testRuntime", "noopRuntime", "getGlobalTestRuntimeWithAutoconfig", "_testRuntime2", "eval", "then", "_getGlobalTestRuntime", "_getGlobalTestRuntime2", "err", "console", "log", "allureIdRegexp", "_wrapRegExp", "id", "allureIdRegexpGlobal", "RegExp", "allureLabelRegexp", "name", "value", "allureLabelRegexpGlobal", "hasStepMessage", "messages", "some", "message", "type", "getStepsMessagesPair", "reduce", "acc", "push", "unfinishedStepIdx", "findLastIndex", "step", "length", "getUnfinishedStepsMessages", "grouppedStepsMessage", "filter", "isPromise", "obj", "then", "callRuntimeMethod", "method", "_len", "arguments", "length", "args", "Array", "_key", "runtime", "getGlobalTestRuntimeWithAutoconfig", "isPromise", "then", "testRuntime", "label", "name", "value", "labels", "_len2", "labelsList", "_key2", "link", "url", "type", "links", "_len3", "linksList", "_key3", "parameter", "options", "description", "markdown", "descriptionHtml", "html", "displayName", "historyId", "testCaseId", "attachment", "content", "stepContext", "mode", "step", "body", "issue", "LinkType", "ISSUE", "tms", "TMS", "allureId", "LabelName", "ALLURE_ID", "epic", "EPIC", "feature", "FEATURE", "story", "STORY", "suite", "SUITE", "parentSuite", "PARENT_SUITE", "subSuite", "SUB_SUITE", "owner", "OWNER", "severity", "SEVERITY", "layer", "LAYER", "tag", "TAG", "tags", "_len4", "tagsList", "_key4", "map", "uint8ArrayToBase64", "data", "normalizeAttachmentContentEncoding", "encoding", "getSuitePath", "test", "path", "currentSuite", "AllureCypressTestRuntime", "name", "value", "labels", "url", "type", "links", "options", "markdown", "html", "content", "attachmentRawContent", "encoding", "actualEncoding", "normalizeAttachmentContentEncoding", "attachmentContent", "uint8ArrayToBase64", "body", "result", "Status", "Stage", "mode", "message", "messages", "EVENT_TEST_BEGIN", "EVENT_TEST_FAIL", "EVENT_TEST_PASS", "initializeAllure", "test", "testRuntime", "getSuitePath", "setGlobalTestRuntime", "getGlobalTestRuntime", "runtimeMessages", "getUnfinishedStepsMessages", "err", "_", "details", "hasStepMessage", "unfinishedStepsMessages", "failedStepsStatus"]
4
+ "sourcesContent": ["import { ContentType, Stage, Status } from \"allure-js-commons\";\nimport type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { getUnfinishedStepsMessages, hasStepMessage } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport type { CypressRuntimeMessage } from \"./model.js\";\nimport { getSuitePath, normalizeAttachmentContentEncoding, uint8ArrayToBase64 } from \"./utils.js\";\n\nexport class AllureCypressTestRuntime implements TestRuntime {\n labels(...labels: Label[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n links(...links: Link[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Buffer | string, options: AttachmentOptions) {\n // @ts-ignore\n const attachmentRawContent: string | Uint8Array = content?.type === \"Buffer\" ? content.data : content;\n const encoding = content instanceof Buffer ? \"base64\" : \"utf-8\";\n const actualEncoding = normalizeAttachmentContentEncoding(attachmentRawContent, encoding);\n const attachmentContent = uint8ArrayToBase64(attachmentRawContent);\n\n return this.sendMessageAsync({\n type: \"attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.sendMessageAsync({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(null, { log: false })\n .then(() => {\n this.sendMessage({\n type: \"step_start\",\n data: { name, start: Date.now() },\n });\n\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n return this.sendMessageAsync({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stage: Stage.FINISHED,\n stop: Date.now(),\n },\n }).then(() => result);\n });\n }\n\n stepDisplayName(name: string) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n sendMessage(message: CypressRuntimeMessage) {\n const messages = Cypress.env(\"allureRuntimeMessages\") || [];\n\n Cypress.env(\"allureRuntimeMessages\", messages.concat(message));\n }\n\n sendMessageAsync(message: CypressRuntimeMessage): PromiseLike<void> {\n this.sendMessage(message);\n return Cypress.Promise.resolve();\n }\n}\n\nconst { EVENT_TEST_BEGIN, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants;\n\nconst initializeAllure = () => {\n const initialized = Cypress.env(\"allureInitialized\") as boolean;\n\n if (initialized) {\n return;\n }\n\n // @ts-ignore\n Cypress.mocha\n .getRunner()\n .on(EVENT_TEST_BEGIN, (test: Mocha.Test) => {\n const testRuntime = new AllureCypressTestRuntime();\n\n Cypress.env(\"allureRuntimeMessages\", []);\n\n testRuntime.sendMessage({\n type: \"cypress_start\",\n data: {\n isInteractive: Cypress.config(\"isInteractive\"),\n absolutePath: Cypress.spec.absolute,\n specPath: getSuitePath(test).concat(test.title),\n filename: Cypress.spec.relative,\n start: Date.now(),\n },\n });\n\n setGlobalTestRuntime(testRuntime);\n })\n .on(EVENT_TEST_PASS, () => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n });\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n })\n .on(EVENT_TEST_FAIL, (test: Mocha.Test, err: Error) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN,\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n stop: Date.now(),\n },\n });\n });\n\n Cypress.Screenshot.defaults({\n onAfterScreenshot: (_, details) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n return testRuntime.sendMessageAsync({\n type: \"attachment_path\",\n data: {\n path: details.path,\n name: details.name || \"Screenshot\",\n contentType: ContentType.PNG,\n },\n });\n },\n });\n\n Cypress.on(\"fail\", (err) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const hasSteps = hasStepMessage(runtimeMessages as RuntimeMessage[]);\n\n // if there is no steps, don't handle the error\n if (!hasSteps) {\n throw err;\n }\n\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n if (unfinishedStepsMessages.length === 0) {\n throw err;\n }\n\n const failedStepsStatus = err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN;\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: failedStepsStatus,\n stop: Date.now(),\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n },\n });\n });\n\n throw err;\n });\n\n afterEach(() => {\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n\n cy.task(\"allureReportTest\", runtimeMessages, { log: false });\n });\n\n Cypress.env(\"allureInitialized\", true);\n};\n\ninitializeAllure();\n\nexport * from \"allure-js-commons\";\n", "export interface Attachment {\n name: string;\n type?: string;\n source: string;\n}\n\nexport interface AttachmentOptions {\n contentType: ContentType | string;\n encoding?: BufferEncoding;\n fileExtension?: string;\n}\n\nexport interface Label {\n name: LabelName | string;\n value: string;\n}\n\nexport interface Link {\n name?: string;\n url: string;\n type?: LinkType | string;\n}\n\nexport type ParameterMode = \"hidden\" | \"masked\" | \"default\";\n\nexport interface Parameter {\n name: string;\n value: string;\n excluded?: boolean;\n mode?: ParameterMode;\n}\n\nexport type ParameterOptions = Pick<Parameter, \"mode\" | \"excluded\">;\n\nexport interface StatusDetails {\n message?: string;\n trace?: string;\n}\n\n// don't use the interface as is, use Results types instead\ninterface Executable {\n name?: string;\n status?: Status;\n statusDetails: StatusDetails;\n stage: Stage;\n description?: string;\n descriptionHtml?: string;\n steps: StepResult[];\n attachments: Attachment[];\n parameters: Parameter[];\n start?: number;\n stop?: number;\n}\n\nexport interface FixtureResult extends Executable {}\n\nexport interface StepResult extends Executable {}\n\nexport interface TestResult extends Executable {\n uuid: string;\n historyId?: string;\n fullName?: string;\n testCaseId?: string;\n labels: Label[];\n links: Link[];\n}\n\nexport interface TestResultContainer {\n uuid: string;\n name?: string;\n children: string[];\n befores: FixtureResult[];\n afters: FixtureResult[];\n}\n\nexport type TestOrStepResult = StepResult | TestResult;\n\n/* eslint-disable no-shadow */\nexport enum Status {\n FAILED = \"failed\",\n BROKEN = \"broken\",\n PASSED = \"passed\",\n SKIPPED = \"skipped\",\n}\n\nexport const StatusByPriority = [Status.FAILED, Status.BROKEN, Status.PASSED, Status.SKIPPED];\n\n/* eslint-disable no-shadow */\nexport enum Stage {\n SCHEDULED = \"scheduled\",\n RUNNING = \"running\",\n FINISHED = \"finished\",\n PENDING = \"pending\",\n INTERRUPTED = \"interrupted\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LabelName {\n ALLURE_ID = \"ALLURE_ID\",\n /**\n * @deprecated please use ALLURE_ID instead\n */\n AS_ID = ALLURE_ID,\n SUITE = \"suite\",\n PARENT_SUITE = \"parentSuite\",\n SUB_SUITE = \"subSuite\",\n EPIC = \"epic\",\n FEATURE = \"feature\",\n STORY = \"story\",\n SEVERITY = \"severity\",\n TAG = \"tag\",\n OWNER = \"owner\",\n LEAD = \"lead\",\n HOST = \"host\",\n THREAD = \"thread\",\n TEST_METHOD = \"testMethod\",\n TEST_CLASS = \"testClass\",\n PACKAGE = \"package\",\n FRAMEWORK = \"framework\",\n LANGUAGE = \"language\",\n LAYER = \"layer\",\n}\n\n/* eslint-disable no-shadow */\nexport enum Severity {\n BLOCKER = \"blocker\",\n CRITICAL = \"critical\",\n NORMAL = \"normal\",\n MINOR = \"minor\",\n TRIVIAL = \"trivial\",\n}\n\n/* eslint-disable no-shadow */\nexport enum ContentType {\n TEXT = \"text/plain\",\n XML = \"application/xml\",\n HTML = \"text/html\",\n CSV = \"text/csv\",\n TSV = \"text/tab-separated-values\",\n CSS = \"text/css\",\n URI = \"text/uri-list\",\n SVG = \"image/svg+xml\",\n PNG = \"image/png\",\n JSON = \"application/json\",\n ZIP = \"application/zip\",\n WEBM = \"video/webm\",\n JPEG = \"image/jpeg\",\n MP4 = \"video/mp4\",\n IMAGEDIFF = \"application/vnd.allure.image.diff\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LinkType {\n ISSUE = \"issue\",\n TMS = \"tms\",\n}\n\nexport interface ImageDiffAttachment {\n expected: string | undefined; // data:image;base64,\n actual: string | undefined; // data:image;base64,\n diff: string | undefined; // data:image;base64,\n name: string;\n}\n", "import type { TestRuntime } from \"./types.js\";\n\nexport class NoopTestRuntime implements TestRuntime {\n async attachment() {\n await this.warning();\n }\n\n async attachmentFromPath() {\n await this.warning();\n }\n\n async description() {\n await this.warning();\n }\n\n async descriptionHtml() {\n await this.warning();\n }\n\n async displayName() {\n await this.warning();\n }\n\n async historyId() {\n await this.warning();\n }\n\n async labels() {\n await this.warning();\n }\n\n async links() {\n await this.warning();\n }\n\n async parameter() {\n await this.warning();\n }\n\n async step<T>(name: string, body: () => T | PromiseLike<T>): Promise<T> {\n await this.warning();\n return body();\n }\n\n async stepDisplayName() {\n await this.warning();\n }\n\n async stepParameter() {\n await this.warning();\n }\n\n async testCaseId() {\n await this.warning();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async warning() {\n // eslint-disable-next-line no-console\n console.log(\"no test runtime is found. Please check test framework configuration\");\n }\n}\n\nexport const noopRuntime: TestRuntime = new NoopTestRuntime();\n", "import { noopRuntime } from \"./NoopTestRuntime.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nconst ALLURE_TEST_RUNTIME_KEY = \"allureTestRuntime\";\n\nexport const setGlobalTestRuntime = (runtime: TestRuntime) => {\n (globalThis as any)[ALLURE_TEST_RUNTIME_KEY] = () => runtime;\n};\n\nconst getGlobalTestRuntimeFunction = () => {\n return (globalThis as any)?.[ALLURE_TEST_RUNTIME_KEY] as (() => TestRuntime | undefined) | undefined;\n};\n\nexport const getGlobalTestRuntime = (): TestRuntime => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n return noopRuntime;\n};\n\nexport const getGlobalTestRuntimeWithAutoconfig = (): TestRuntime | Promise<TestRuntime> => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n if (\"_playwrightInstance\" in globalThis) {\n try {\n // protection from bundlers tree-shaking visiting (webpack, rollup)\n // @ts-ignore\n // eslint-disable-next-line no-eval\n return (0, eval)(\"(() => import('allure-playwright/autoconfig'))()\").then(() => {\n return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(\"can't execute allure-playwright/autoconfig\", err);\n return noopRuntime;\n }\n }\n\n return noopRuntime;\n};\n", "import type { FixtureResult, Label, StatusDetails, StepResult, TestResult } from \"../model.js\";\nimport { LabelName, Status } from \"../model.js\";\nimport type { RuntimeMessage } from \"./types.js\";\n\nexport const getStatusFromError = (error: Error): Status => {\n switch (true) {\n /**\n * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError`\n * `jest` throws `JestAssertionError` instance\n * `jasmine` throws `ExpectationFailed` instance\n */\n case /assert/gi.test(error.constructor.name):\n case /expectation/gi.test(error.constructor.name):\n case /assert/gi.test(error.name):\n case /assert/gi.test(error.message):\n return Status.FAILED;\n default:\n return Status.BROKEN;\n }\n};\n\n/**\n * Source: https://github.com/chalk/ansi-regex\n */\nconst ansiRegex = ({ onlyFirst = false } = {}) => {\n const pattern = [\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\",\n \"(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\",\n ].join(\"|\");\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n\n/**\n * https://github.com/chalk/strip-ansi\n */\nexport const stripAnsi = (str: string): string => {\n const regex = ansiRegex();\n return str.replace(regex, \"\");\n};\n\nexport const getMessageAndTraceFromError = (\n error: Error | { message?: string; stack?: string },\n): Pick<StatusDetails, \"message\" | \"trace\"> => {\n const { message, stack } = error;\n return {\n message: message ? stripAnsi(message) : undefined,\n trace: stack ? stripAnsi(stack) : undefined,\n };\n};\n\nexport const allureIdRegexp = /@?allure.id[:=](?<id>[^\\s]+)/;\nexport const allureIdRegexpGlobal = new RegExp(allureIdRegexp, \"g\");\nexport const allureLabelRegexp = /@?allure.label.(?<name>[^\\s]+?)[:=](?<value>[^\\s]+)/;\nexport const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, \"g\");\n\nexport const extractMetadataFromString = (\n title: string,\n): {\n labels: Label[];\n cleanTitle: string;\n} => {\n const labels = [] as Label[];\n\n title.split(\" \").forEach((val) => {\n const idValue = val.match(allureIdRegexp)?.groups?.id;\n\n if (idValue) {\n labels.push({ name: LabelName.ALLURE_ID, value: idValue });\n }\n\n const labelMatch = val.match(allureLabelRegexp);\n const { name, value } = labelMatch?.groups || {};\n\n if (name && value) {\n labels?.push({ name, value });\n }\n });\n\n const cleanTitle = title.replace(allureLabelRegexpGlobal, \"\").replace(allureIdRegexpGlobal, \"\").trim();\n\n return { labels, cleanTitle };\n};\n\nexport const isAnyStepFailed = (item: StepResult | TestResult | FixtureResult): boolean => {\n const isFailed = item.status === Status.FAILED;\n\n if (isFailed || item.steps.length === 0) {\n return isFailed;\n }\n\n return !!item.steps.find((step) => isAnyStepFailed(step));\n};\n\nexport const isAllStepsEnded = (item: StepResult | TestResult | FixtureResult): boolean => {\n return item.steps.every((val) => val.stop && isAllStepsEnded(val));\n};\n\nexport const hasLabel = (testResult: TestResult, labelName: LabelName | string): boolean => {\n return !!testResult.labels.find((l) => l.name === labelName);\n};\n\nexport const hasStepMessage = (messages: RuntimeMessage[]) => {\n return messages.some((message) => message.type === \"step_start\" || message.type === \"step_stop\");\n};\n\nexport const getStepsMessagesPair = (messages: RuntimeMessage[]) =>\n messages.reduce((acc, message) => {\n if (message.type !== \"step_start\" && message.type !== \"step_stop\") {\n return acc;\n }\n\n if (message.type === \"step_start\") {\n acc.push([message]);\n\n return acc;\n }\n\n const unfinishedStepIdx = acc.findLastIndex((step) => step.length === 1);\n\n if (unfinishedStepIdx === -1) {\n return acc;\n }\n\n acc[unfinishedStepIdx].push(message);\n\n return acc;\n }, [] as RuntimeMessage[][]);\n\nexport const getUnfinishedStepsMessages = (messages: RuntimeMessage[]) => {\n const grouppedStepsMessage = getStepsMessagesPair(messages);\n\n return grouppedStepsMessage.filter((step) => step.length === 1);\n};\n\nexport const isPromise = (obj: any): boolean =>\n !!obj && (typeof obj === \"object\" || typeof obj === \"function\") && typeof obj.then === \"function\";\n", "import type { ContentType } from \"./model.js\";\nimport { type AttachmentOptions, type Label, type Link, type ParameterMode, type ParameterOptions } from \"./model.js\";\nimport { LabelName, LinkType } from \"./model.js\";\nimport { getGlobalTestRuntimeWithAutoconfig } from \"./sdk/runtime/runtime.js\";\nimport type { TestRuntime } from \"./sdk/runtime/types.js\";\nimport { isPromise } from \"./sdk/utils.js\";\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;\nconst callRuntimeMethod = <T extends keyof TestRuntime, S extends ArgumentTypes<TestRuntime[T]>>(\n method: T,\n ...args: S\n) => {\n const runtime = getGlobalTestRuntimeWithAutoconfig();\n\n if (!isPromise(runtime)) {\n // @ts-ignore\n return (runtime as TestRuntime)[method](...args);\n }\n\n return (runtime as Promise<TestRuntime>).then((testRuntime) => {\n // @ts-ignore\n return testRuntime[method](...args);\n });\n};\n\nexport const label = (name: LabelName | string, value: string) => {\n return callRuntimeMethod(\"labels\", { name, value });\n};\n\nexport const labels = (...labelsList: Label[]) => {\n return callRuntimeMethod(\"labels\", ...labelsList);\n};\n\nexport const link = (url: string, name?: string, type?: LinkType | string) => {\n return callRuntimeMethod(\"links\", { url, type, name });\n};\n\nexport const links = (...linksList: Link[]) => {\n return callRuntimeMethod(\"links\", ...linksList);\n};\n\nexport const parameter = (name: string, value: string, options?: ParameterOptions) => {\n return callRuntimeMethod(\"parameter\", name, value, options);\n};\n\nexport const description = (markdown: string) => {\n return callRuntimeMethod(\"description\", markdown);\n};\n\nexport const descriptionHtml = (html: string) => {\n return callRuntimeMethod(\"descriptionHtml\", html);\n};\n\nexport const displayName = (name: string) => {\n return callRuntimeMethod(\"displayName\", name);\n};\n\nexport const historyId = (value: string) => {\n return callRuntimeMethod(\"historyId\", value);\n};\n\nexport const testCaseId = (value: string) => {\n return callRuntimeMethod(\"testCaseId\", value);\n};\n\nexport const attachment = (\n name: string,\n content: Buffer | string,\n options: ContentType | string | AttachmentOptions,\n) => {\n const opts = typeof options === \"string\" ? { contentType: options } : options;\n return callRuntimeMethod(\"attachment\", name, content, opts);\n};\n\nexport const attachmentPath = (\n name: string,\n path: string,\n options: ContentType | string | Omit<AttachmentOptions, \"encoding\">,\n) => {\n const opts = typeof options === \"string\" ? { contentType: options } : options;\n return callRuntimeMethod(\"attachmentFromPath\", name, path, opts);\n};\n\nexport type StepContext = {\n displayName: (name: string) => void | PromiseLike<void>;\n parameter: (name: string, value: string, mode?: ParameterMode) => void | PromiseLike<void>;\n};\n\nconst stepContext: () => StepContext = () => ({\n displayName: (name: string) => {\n return callRuntimeMethod(\"stepDisplayName\", name);\n },\n parameter: (name, value, mode?) => {\n return callRuntimeMethod(\"stepParameter\", name, value, mode);\n },\n});\n\nexport const step = <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => {\n return callRuntimeMethod(\"step\", name, () => body(stepContext()));\n};\n\nexport const issue = (url: string, name?: string) => link(url, name, LinkType.ISSUE);\n\nexport const tms = (url: string, name?: string) => link(url, name, LinkType.TMS);\n\nexport const allureId = (value: string) => label(LabelName.ALLURE_ID, value);\n\nexport const epic = (name: string) => label(LabelName.EPIC, name);\n\nexport const feature = (name: string) => label(LabelName.FEATURE, name);\n\nexport const story = (name: string) => label(LabelName.STORY, name);\n\nexport const suite = (name: string) => label(LabelName.SUITE, name);\n\nexport const parentSuite = (name: string) => label(LabelName.PARENT_SUITE, name);\n\nexport const subSuite = (name: string) => label(LabelName.SUB_SUITE, name);\n\nexport const owner = (name: string) => label(LabelName.OWNER, name);\n\nexport const severity = (name: string) => label(LabelName.SEVERITY, name);\n\nexport const layer = (name: string) => label(LabelName.LAYER, name);\n\nexport const tag = (name: string) => label(LabelName.TAG, name);\n\nexport const tags = (...tagsList: string[]) => {\n return callRuntimeMethod(\"labels\", ...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n};\n", "export const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const normalizeAttachmentContentEncoding = (data: unknown, encoding: BufferEncoding): BufferEncoding => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (u8arrayLike) {\n return \"base64\";\n }\n\n return encoding;\n};\n\nexport const getSuitePath = (test: Mocha.Test): string[] => {\n const path: string[] = [];\n let currentSuite: Mocha.Suite | undefined = test.parent;\n\n while (currentSuite) {\n if (currentSuite.title) {\n path.unshift(currentSuite.title);\n }\n\n currentSuite = currentSuite.parent;\n }\n\n return path;\n};\n"],
5
+ "mappings": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,8BAAAE,EAAA,gBAAAC,EAAA,cAAAC,EAAA,aAAAC,EAAA,aAAAC,EAAA,UAAAC,EAAA,WAAAC,EAAA,qBAAAC,EAAA,aAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,oBAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,UAAAC,EAAA,UAAAC,EAAA,WAAAC,EAAA,UAAAC,GAAA,SAAAC,EAAA,UAAAC,EAAA,UAAAC,GAAA,cAAAC,EAAA,gBAAAC,GAAA,aAAAC,GAAA,SAAAC,EAAA,UAAAC,EAAA,aAAAC,GAAA,UAAAC,EAAA,QAAAC,GAAA,SAAAC,GAAA,eAAAC,EAAA,QAAAC,IAAA,eAAAC,GAAApC,IC8EA,IAAYqC,EAAM,SAAN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Name", "LinkType", "Severity", "Stage", "Status", "StatusByPriority", "allureId", "attachment", "description", "descriptionHtml", "displayName", "epic", "feature", "historyId", "issue", "label", "labels", "layer", "link", "links", "owner", "parameter", "parentSuite", "severity", "step", "story", "subSuite", "suite", "tag", "tags", "testCaseId", "tms", "__toCommonJS", "Status", "StatusByPriority", "FAILED", "BROKEN", "PASSED", "SKIPPED", "Stage", "LabelName", "Severity", "ContentType", "LinkType", "NoopTestRuntime", "attachment", "_this", "_asyncToGenerator", "warning", "attachmentFromPath", "_this2", "description", "_this3", "descriptionHtml", "_this4", "displayName", "_this5", "historyId", "_this6", "labels", "_this7", "links", "_this8", "parameter", "_this9", "step", "name", "body", "_this10", "stepDisplayName", "_this11", "stepParameter", "_this12", "testCaseId", "_this13", "console", "log", "noopRuntime", "ALLURE_TEST_RUNTIME_KEY", "setGlobalTestRuntime", "runtime", "globalThis", "getGlobalTestRuntimeFunction", "getGlobalTestRuntime", "testRuntime", "_testRuntime", "noopRuntime", "getGlobalTestRuntimeWithAutoconfig", "_testRuntime2", "eval", "then", "_getGlobalTestRuntime", "_getGlobalTestRuntime2", "err", "console", "log", "allureIdRegexp", "_wrapRegExp", "id", "allureIdRegexpGlobal", "RegExp", "allureLabelRegexp", "name", "value", "allureLabelRegexpGlobal", "hasStepMessage", "messages", "some", "message", "type", "getStepsMessagesPair", "reduce", "acc", "push", "unfinishedStepIdx", "findLastIndex", "step", "length", "getUnfinishedStepsMessages", "grouppedStepsMessage", "filter", "isPromise", "obj", "then", "callRuntimeMethod", "method", "_len", "arguments", "length", "args", "Array", "_key", "runtime", "getGlobalTestRuntimeWithAutoconfig", "isPromise", "then", "testRuntime", "label", "name", "value", "labels", "_len2", "labelsList", "_key2", "link", "url", "type", "links", "_len3", "linksList", "_key3", "parameter", "options", "description", "markdown", "descriptionHtml", "html", "displayName", "historyId", "testCaseId", "attachment", "content", "opts", "contentType", "stepContext", "displayName", "name", "callRuntimeMethod", "parameter", "value", "mode", "step", "body", "issue", "url", "link", "LinkType", "ISSUE", "tms", "TMS", "allureId", "label", "LabelName", "ALLURE_ID", "epic", "EPIC", "feature", "FEATURE", "story", "STORY", "suite", "SUITE", "parentSuite", "PARENT_SUITE", "subSuite", "SUB_SUITE", "owner", "OWNER", "severity", "SEVERITY", "layer", "LAYER", "tag", "TAG", "tags", "_len4", "arguments", "length", "tagsList", "Array", "_key4", "map", "uint8ArrayToBase64", "data", "normalizeAttachmentContentEncoding", "encoding", "getSuitePath", "test", "path", "currentSuite", "AllureCypressTestRuntime", "labels", "links", "name", "value", "options", "markdown", "html", "content", "attachmentRawContent", "encoding", "actualEncoding", "normalizeAttachmentContentEncoding", "attachmentContent", "uint8ArrayToBase64", "path", "body", "result", "Status", "Stage", "mode", "message", "messages", "EVENT_TEST_BEGIN", "EVENT_TEST_FAIL", "EVENT_TEST_PASS", "initializeAllure", "test", "testRuntime", "getSuitePath", "setGlobalTestRuntime", "getGlobalTestRuntime", "runtimeMessages", "getUnfinishedStepsMessages", "err", "_", "details", "ContentType", "hasStepMessage", "unfinishedStepsMessages", "failedStepsStatus"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import type { Stage, Status, StatusDetails } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\n\nexport type CypressTestStartRuntimeMessage = {\n type: \"cypress_start\";\n data: {\n isInteractive: boolean;\n absolutePath: string;\n specPath: string[];\n filename: string;\n start: number;\n };\n};\n\nexport type CypressTestEndRuntimeMessage = {\n type: \"cypress_end\";\n data: {\n stage: Stage;\n status: Status;\n statusDetails?: StatusDetails;\n stop: number;\n };\n};\n\nexport type CypressScreenshotRuntimeMessage = {\n type: \"cypress_screenshot\";\n data: {\n path: string;\n name: string;\n };\n};\n\nexport type CypressRuntimeMessage =\n | RuntimeMessage\n | CypressScreenshotRuntimeMessage\n | CypressTestStartRuntimeMessage\n | CypressTestEndRuntimeMessage;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import type { Stage, Status, StatusDetails } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\n\nexport type CypressTestStartRuntimeMessage = {\n type: \"cypress_start\";\n data: {\n isInteractive: boolean;\n absolutePath: string;\n specPath: string[];\n filename: string;\n start: number;\n };\n};\n\nexport type CypressTestEndRuntimeMessage = {\n type: \"cypress_end\";\n data: {\n stage: Stage;\n status: Status;\n statusDetails?: StatusDetails;\n stop: number;\n };\n};\n\nexport type CypressRuntimeMessage = RuntimeMessage | CypressTestStartRuntimeMessage | CypressTestEndRuntimeMessage;\n"],"mappings":"","ignoreList":[]}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.allureCypress = exports.AllureCypress = void 0;
7
- var _nodeFs = require("node:fs");
8
7
  var _allureJsCommons = require("allure-js-commons");
9
8
  var _sdk = require("allure-js-commons/sdk");
10
9
  var _reporter = require("allure-js-commons/sdk/reporter");
@@ -43,7 +42,7 @@ class AllureCypress {
43
42
  if (startMessage.type !== "cypress_start" || endMessage.type !== "cypress_end") {
44
43
  throw new Error("INTERNAL ERROR: Invalid message sequence");
45
44
  }
46
- var suiteLabels = (0, _reporter.getSuitesLabels)(startMessage.data.specPath.slice(0, -1));
45
+ var suiteLabels = (0, _reporter.getSuiteLabels)(startMessage.data.specPath.slice(0, -1));
47
46
  var testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];
48
47
  var titleMetadata = (0, _sdk.extractMetadataFromString)(testTitle);
49
48
  var testUuid = this.runtime.startTest({
@@ -64,24 +63,7 @@ class AllureCypress {
64
63
  result.labels.push(...suiteLabels);
65
64
  result.labels.push(...titleMetadata.labels);
66
65
  this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {
67
- testUuid,
68
- customHandler: message => {
69
- var type = message.type;
70
- if (type === "cypress_screenshot") {
71
- var {
72
- name,
73
- path
74
- } = message.data;
75
- // False positive by eslint (path is string)
76
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
77
- var screenshotBody = (0, _nodeFs.readFileSync)(path);
78
- this.runtime.writeAttachment({
79
- name,
80
- content: screenshotBody,
81
- contentType: _allureJsCommons.ContentType.PNG
82
- }, testUuid);
83
- }
84
- }
66
+ testUuid
85
67
  });
86
68
  }, testUuid);
87
69
  this.runtime.updateTest(result => {
@@ -113,24 +95,12 @@ class AllureCypress {
113
95
  if (!testUuids) {
114
96
  return;
115
97
  }
116
- var videoSource;
117
98
  for (var uuid of testUuids) {
118
- if (!cypressResult.video) {
119
- this.runtime.writeTest(uuid);
120
- continue;
121
- }
122
- if (!videoSource) {
123
- videoSource = this.runtime.writeAttachmentFromPath("Video", cypressResult.video, {
99
+ // TODO add it to spec scope to remove duplicates.
100
+ if (cypressResult.video) {
101
+ this.runtime.writeAttachmentFromPath("Video", cypressResult.video, {
124
102
  contentType: _allureJsCommons.ContentType.MP4
125
103
  }, uuid);
126
- } else {
127
- this.runtime.updateTest(result => {
128
- result.attachments.push({
129
- name: "Video",
130
- source: videoSource,
131
- type: _allureJsCommons.ContentType.MP4
132
- });
133
- }, uuid);
134
104
  }
135
105
  this.runtime.writeTest(uuid);
136
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","names":["_nodeFs","require","_allureJsCommons","_sdk","_reporter","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AllureCypress","constructor","config","Map","_ref","resultsDir","rest","runtime","ReporterRuntime","writer","FileSystemWriter","pushTestUuid","absolutePath","uuid","currentUuids","testsUuidsByCypressAbsolutePath","get","set","attachToCypress","on","allureReportTest","messages","startMessage","endMessage","type","Error","suiteLabels","getSuitesLabels","data","specPath","slice","testTitle","titleMetadata","extractMetadataFromString","testUuid","startTest","name","cleanTitle","start","fullName","concat","filename","join","stage","Stage","RUNNING","updateTest","result","labels","LabelName","LANGUAGE","FRAMEWORK","applyRuntimeMessages","customHandler","message","path","screenshotBody","readFileSync","writeAttachment","content","contentType","ContentType","PNG","status","statusDetails","stopTest","stop","Date","now","isInteractive","writeTest","endSpec","spec","cypressResult","testUuids","absolute","delete","videoSource","video","writeAttachmentFromPath","MP4","attachments","source","exports","allureCypress","allureConfig","allureCypressReporter"],"sources":["../../src/reporter.ts"],"sourcesContent":["import type Cypress from \"cypress\";\nimport { readFileSync } from \"node:fs\";\nimport { ContentType, LabelName, Stage } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport { FileSystemWriter, ReporterRuntime, getSuitesLabels } from \"allure-js-commons/sdk/reporter\";\nimport type { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from \"./model.js\";\n\nexport type AllureCypressConfig = {\n resultsDir?: string;\n links?: {\n type: string;\n urlTemplate: string;\n }[];\n};\n\nexport class AllureCypress {\n runtime: ReporterRuntime;\n\n testsUuidsByCypressAbsolutePath = new Map<string, string[]>();\n\n constructor(config?: AllureCypressConfig) {\n const { resultsDir = \"./allure-results\", ...rest } = config || {};\n\n this.runtime = new ReporterRuntime({\n writer: new FileSystemWriter({\n resultsDir,\n }),\n ...rest,\n });\n }\n\n private pushTestUuid(absolutePath: string, uuid: string) {\n const currentUuids = this.testsUuidsByCypressAbsolutePath.get(absolutePath) || [];\n\n this.testsUuidsByCypressAbsolutePath.set(absolutePath, [...currentUuids, uuid]);\n }\n\n attachToCypress(on: Cypress.PluginEvents) {\n on(\"task\", {\n allureReportTest: (messages: CypressRuntimeMessage[]) => {\n const startMessage = messages[0] as CypressTestStartRuntimeMessage;\n const endMessage = messages[messages.length - 1] as CypressTestEndRuntimeMessage;\n\n if (startMessage.type !== \"cypress_start\" || endMessage.type !== \"cypress_end\") {\n throw new Error(\"INTERNAL ERROR: Invalid message sequence\");\n }\n\n const suiteLabels = getSuitesLabels(startMessage.data.specPath.slice(0, -1));\n const testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];\n const titleMetadata = extractMetadataFromString(testTitle);\n const testUuid = this.runtime.startTest({\n name: titleMetadata.cleanTitle || testTitle,\n start: startMessage.data.start,\n fullName: `${startMessage.data.filename}#${startMessage.data.specPath.join(\" \")}`,\n stage: Stage.RUNNING,\n });\n\n this.runtime.updateTest((result) => {\n result.labels.push({\n name: LabelName.LANGUAGE,\n value: \"javascript\",\n });\n result.labels.push({\n name: LabelName.FRAMEWORK,\n value: \"cypress\",\n });\n result.labels.push(...suiteLabels);\n result.labels.push(...titleMetadata.labels);\n\n this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {\n testUuid,\n customHandler: (message) => {\n const type = message.type;\n\n if (type === \"cypress_screenshot\") {\n const { name, path } = message.data;\n // False positive by eslint (path is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const screenshotBody = readFileSync(path);\n\n this.runtime.writeAttachment(\n {\n name,\n content: screenshotBody,\n contentType: ContentType.PNG,\n },\n testUuid,\n );\n }\n },\n });\n }, testUuid);\n this.runtime.updateTest((result) => {\n result.stage = endMessage.data.stage;\n result.status = endMessage.data.status;\n\n if (!endMessage.data.statusDetails) {\n return;\n }\n\n result.statusDetails = endMessage.data.statusDetails;\n }, testUuid);\n\n this.runtime.stopTest({ uuid: testUuid, stop: Date.now() });\n\n if (startMessage.data.isInteractive) {\n this.runtime.writeTest(testUuid);\n } else {\n // False positive by eslint (testUuid is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n this.pushTestUuid(startMessage.data.absolutePath, testUuid);\n }\n\n return null;\n },\n });\n }\n\n endSpec(spec: Cypress.Spec, cypressResult: CypressCommandLine.RunResult) {\n const testUuids = this.testsUuidsByCypressAbsolutePath.get(spec.absolute);\n this.testsUuidsByCypressAbsolutePath.delete(spec.absolute);\n\n if (!testUuids) {\n return;\n }\n\n let videoSource: string | undefined;\n\n for (const uuid of testUuids) {\n if (!cypressResult.video) {\n this.runtime.writeTest(uuid);\n continue;\n }\n\n if (!videoSource) {\n videoSource = this.runtime.writeAttachmentFromPath(\n \"Video\",\n cypressResult.video,\n {\n contentType: ContentType.MP4,\n },\n uuid,\n );\n } else {\n this.runtime.updateTest((result) => {\n result.attachments.push({\n name: \"Video\",\n source: videoSource!,\n type: ContentType.MP4,\n });\n }, uuid);\n }\n\n this.runtime.writeTest(uuid);\n }\n }\n}\n\nexport const allureCypress = (on: Cypress.PluginEvents, allureConfig?: AllureCypressConfig) => {\n const allureCypressReporter = new AllureCypress(allureConfig);\n\n allureCypressReporter.attachToCypress(on);\n\n on(\"after:spec\", (spec, result) => {\n allureCypressReporter.endSpec(spec, result);\n });\n\n return allureCypressReporter;\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAAoG,IAAAI,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CA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AAE;QAChBA,WAAW,GAAG,IAAI,CAACtE,OAAO,CAACwE,uBAAuB,CAChD,OAAO,EACPN,aAAa,CAACK,KAAK,EACnB;UACElB,WAAW,EAAEC,4BAAW,CAACmB;QAC3B,CAAC,EACDnE,IACF,CAAC;MACH,CAAC,MAAM;QACL,IAAI,CAACN,OAAO,CAACuC,UAAU,CAAEC,MAAM,IAAK;UAClCA,MAAM,CAACkC,WAAW,CAAC7G,IAAI,CAAC;YACtBgE,IAAI,EAAE,OAAO;YACb8C,MAAM,EAAEL,WAAY;YACpBrD,IAAI,EAAEqC,4BAAW,CAACmB;UACpB,CAAC,CAAC;QACJ,CAAC,EAAEnE,IAAI,CAAC;MACV;MAEA,IAAI,CAACN,OAAO,CAAC+D,SAAS,CAACzD,IAAI,CAAC;IAC9B;EACF;AACF;AAACsE,OAAA,CAAAnF,aAAA,GAAAA,aAAA;AAEM,IAAMoF,aAAa,GAAGA,CAACjE,EAAwB,EAAEkE,YAAkC,KAAK;EAC7F,IAAMC,qBAAqB,GAAG,IAAItF,aAAa,CAACqF,YAAY,CAAC;EAE7DC,qBAAqB,CAACpE,eAAe,CAACC,EAAE,CAAC;EAEzCA,EAAE,CAAC,YAAY,EAAE,CAACqD,IAAI,EAAEzB,MAAM,KAAK;IACjCuC,qBAAqB,CAACf,OAAO,CAACC,IAAI,EAAEzB,MAAM,CAAC;EAC7C,CAAC,CAAC;EAEF,OAAOuC,qBAAqB;AAC9B,CAAC;AAACH,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"reporter.js","names":["_allureJsCommons","require","_sdk","_reporter","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AllureCypress","constructor","config","Map","_ref","resultsDir","rest","runtime","ReporterRuntime","writer","FileSystemWriter","pushTestUuid","absolutePath","uuid","currentUuids","testsUuidsByCypressAbsolutePath","get","set","attachToCypress","on","allureReportTest","messages","startMessage","endMessage","type","Error","suiteLabels","getSuiteLabels","data","specPath","slice","testTitle","titleMetadata","extractMetadataFromString","testUuid","startTest","name","cleanTitle","start","fullName","concat","filename","join","stage","Stage","RUNNING","updateTest","result","labels","LabelName","LANGUAGE","FRAMEWORK","applyRuntimeMessages","status","statusDetails","stopTest","stop","Date","now","isInteractive","writeTest","endSpec","spec","cypressResult","testUuids","absolute","delete","video","writeAttachmentFromPath","contentType","ContentType","MP4","exports","allureCypress","allureConfig","allureCypressReporter"],"sources":["../../src/reporter.ts"],"sourcesContent":["import type Cypress from \"cypress\";\nimport { ContentType, LabelName, Stage } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport { FileSystemWriter, ReporterRuntime, getSuiteLabels } from \"allure-js-commons/sdk/reporter\";\nimport type { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from \"./model.js\";\n\nexport type AllureCypressConfig = {\n resultsDir?: string;\n links?: {\n type: string;\n urlTemplate: string;\n }[];\n};\n\nexport class AllureCypress {\n runtime: ReporterRuntime;\n\n testsUuidsByCypressAbsolutePath = new Map<string, string[]>();\n\n constructor(config?: AllureCypressConfig) {\n const { resultsDir = \"./allure-results\", ...rest } = config || {};\n\n this.runtime = new ReporterRuntime({\n writer: new FileSystemWriter({\n resultsDir,\n }),\n ...rest,\n });\n }\n\n private pushTestUuid(absolutePath: string, uuid: string) {\n const currentUuids = this.testsUuidsByCypressAbsolutePath.get(absolutePath) || [];\n\n this.testsUuidsByCypressAbsolutePath.set(absolutePath, [...currentUuids, uuid]);\n }\n\n attachToCypress(on: Cypress.PluginEvents) {\n on(\"task\", {\n allureReportTest: (messages: CypressRuntimeMessage[]) => {\n const startMessage = messages[0] as CypressTestStartRuntimeMessage;\n const endMessage = messages[messages.length - 1] as CypressTestEndRuntimeMessage;\n\n if (startMessage.type !== \"cypress_start\" || endMessage.type !== \"cypress_end\") {\n throw new Error(\"INTERNAL ERROR: Invalid message sequence\");\n }\n\n const suiteLabels = getSuiteLabels(startMessage.data.specPath.slice(0, -1));\n const testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];\n const titleMetadata = extractMetadataFromString(testTitle);\n const testUuid = this.runtime.startTest({\n name: titleMetadata.cleanTitle || testTitle,\n start: startMessage.data.start,\n fullName: `${startMessage.data.filename}#${startMessage.data.specPath.join(\" \")}`,\n stage: Stage.RUNNING,\n });\n\n this.runtime.updateTest((result) => {\n result.labels.push({\n name: LabelName.LANGUAGE,\n value: \"javascript\",\n });\n result.labels.push({\n name: LabelName.FRAMEWORK,\n value: \"cypress\",\n });\n result.labels.push(...suiteLabels);\n result.labels.push(...titleMetadata.labels);\n\n this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {\n testUuid,\n });\n }, testUuid);\n this.runtime.updateTest((result) => {\n result.stage = endMessage.data.stage;\n result.status = endMessage.data.status;\n\n if (!endMessage.data.statusDetails) {\n return;\n }\n\n result.statusDetails = endMessage.data.statusDetails;\n }, testUuid);\n\n this.runtime.stopTest({ uuid: testUuid, stop: Date.now() });\n\n if (startMessage.data.isInteractive) {\n this.runtime.writeTest(testUuid);\n } else {\n // False positive by eslint (testUuid is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n this.pushTestUuid(startMessage.data.absolutePath, testUuid);\n }\n\n return null;\n },\n });\n }\n\n endSpec(spec: Cypress.Spec, cypressResult: CypressCommandLine.RunResult) {\n const testUuids = this.testsUuidsByCypressAbsolutePath.get(spec.absolute);\n this.testsUuidsByCypressAbsolutePath.delete(spec.absolute);\n\n if (!testUuids) {\n return;\n }\n\n for (const uuid of testUuids) {\n // TODO add it to spec scope to remove duplicates.\n if (cypressResult.video) {\n this.runtime.writeAttachmentFromPath(\n \"Video\",\n cypressResult.video,\n {\n contentType: ContentType.MP4,\n },\n uuid,\n );\n }\n\n this.runtime.writeTest(uuid);\n }\n }\n}\n\nexport const allureCypress = (on: Cypress.PluginEvents, allureConfig?: AllureCypressConfig) => {\n const allureCypressReporter = new AllureCypress(allureConfig);\n\n allureCypressReporter.attachToCypress(on);\n\n on(\"after:spec\", (spec, result) => {\n allureCypressReporter.endSpec(spec, result);\n });\n\n return allureCypressReporter;\n};\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAmG,IAAAG,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAA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kB,EAAEC,aAA2C,EAAE;IACvE,IAAMC,SAAS,GAAG,IAAI,CAACjD,+BAA+B,CAACC,GAAG,CAAC8C,IAAI,CAACG,QAAQ,CAAC;IACzE,IAAI,CAAClD,+BAA+B,CAACmD,MAAM,CAACJ,IAAI,CAACG,QAAQ,CAAC;IAE1D,IAAI,CAACD,SAAS,EAAE;MACd;IACF;IAEA,KAAK,IAAMnD,IAAI,IAAImD,SAAS,EAAE;MAC5B;MACA,IAAID,aAAa,CAACI,KAAK,EAAE;QACvB,IAAI,CAAC5D,OAAO,CAAC6D,uBAAuB,CAClC,OAAO,EACPL,aAAa,CAACI,KAAK,EACnB;UACEE,WAAW,EAAEC,4BAAW,CAACC;QAC3B,CAAC,EACD1D,IACF,CAAC;MACH;MAEA,IAAI,CAACN,OAAO,CAACqD,SAAS,CAAC/C,IAAI,CAAC;IAC9B;EACF;AACF;AAAC2D,OAAA,CAAAxE,aAAA,GAAAA,aAAA;AAEM,IAAMyE,aAAa,GAAGA,CAACtD,EAAwB,EAAEuD,YAAkC,KAAK;EAC7F,IAAMC,qBAAqB,GAAG,IAAI3E,aAAa,CAAC0E,YAAY,CAAC;EAE7DC,qBAAqB,CAACzD,eAAe,CAACC,EAAE,CAAC;EAEzCA,EAAE,CAAC,YAAY,EAAE,CAAC2C,IAAI,EAAEf,MAAM,KAAK;IACjC4B,qBAAqB,CAACd,OAAO,CAACC,IAAI,EAAEf,MAAM,CAAC;EAC7C,CAAC,CAAC;EAEF,OAAO4B,qBAAqB;AAC9B,CAAC;AAACH,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var p=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),F=[p.FAILED,p.BROKEN,p.PASSED,p.SKIPPED],y=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),L=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),j=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),E=function(e){return e.ISSUE="issue",e.TMS="tms",e}({});function D(e,t,r,s,a,n,i){try{var u=e[n](i),o=u.value}catch(m){return void r(m)}u.done?t(o):Promise.resolve(o).then(s,a)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(s,a){var n=e.apply(t,r);function i(o){D(n,s,a,i,u,"next",o)}function u(o){D(n,s,a,i,u,"throw",o)}i(void 0)})}}var R=class{attachment(){var t=this;return d(function*(){yield t.warning()})()}description(){var t=this;return d(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return d(function*(){yield t.warning()})()}displayName(){var t=this;return d(function*(){yield t.warning()})()}historyId(){var t=this;return d(function*(){yield t.warning()})()}labels(){var t=this;return d(function*(){yield t.warning()})()}links(){var t=this;return d(function*(){yield t.warning()})()}parameter(){var t=this;return d(function*(){yield t.warning()})()}step(t,r){var s=this;return d(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return d(function*(){yield t.warning()})()}stepParameter(){var t=this;return d(function*(){yield t.warning()})()}testCaseId(){var t=this;return d(function*(){yield t.warning()})()}warning(){return d(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},h=new R;var O="allureTestRuntime",A=e=>{globalThis[O]=()=>e},b=()=>globalThis?.[O],v=()=>{var e=b();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}return h},w=()=>{var e=b();if(e){var t;return(t=e())!==null&&t!==void 0?t:h}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=b())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:h})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),h}return h};function S(){S=function(n,i){return new r(n,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function r(a,n,i){var u=RegExp(a,n);return t.set(u,i||t.get(a)),x(u,r.prototype)}function s(a,n){var i=t.get(n);return Object.keys(i).reduce(function(u,o){var m=i[o];if(typeof m=="number")u[o]=a[m];else{for(var f=0;a[m[f]]===void 0&&f+1<m.length;)f++;u[o]=a[m[f]]}return u},Object.create(null))}return U(r,RegExp),r.prototype.exec=function(a){var n=e.exec.call(this,a);if(n){n.groups=s(n,this);var i=n.indices;i&&(i.groups=s(i,this))}return n},r.prototype[Symbol.replace]=function(a,n){if(typeof n=="string"){var i=t.get(this);return e[Symbol.replace].call(this,a,n.replace(/\$<([^>]+)>/g,function(o,m){var f=i[m];return"$"+(Array.isArray(f)?f.join("$"):f)}))}if(typeof n=="function"){var u=this;return e[Symbol.replace].call(this,a,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(s(o,u)),n.apply(this,o)})}return e[Symbol.replace].call(this,a,n)},S.apply(this,arguments)}function U(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},x(e,t)}var H=S(/@?allure.id[:=]([^\s]+)/,{id:1}),Ae=new RegExp(H,"g"),k=S(/@?allure.label.([^\s]+?)[:=]([^\s]+)/,{name:1,value:2}),we=new RegExp(k,"g");var I=e=>e.some(t=>t.type==="step_start"||t.type==="step_stop"),B=e=>e.reduce((t,r)=>{if(r.type!=="step_start"&&r.type!=="step_stop")return t;if(r.type==="step_start")return t.push([r]),t;var s=t.findLastIndex(a=>a.length===1);return s===-1||t[s].push(r),t},[]),M=e=>{var t=B(e);return t.filter(r=>r.length===1)},T=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var c=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];var n=w();return T(n)?n.then(i=>i[t](...s)):n[t](...s)},g=(e,t)=>c("labels",{name:e,value:t}),K=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r)},P=(e,t,r)=>c("links",{url:e,type:t,name:r}),z=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("links",...r)},V=(e,t,r)=>c("parameter",e,t,r),W=e=>c("description",e),Y=e=>c("descriptionHtml",e),Z=e=>c("displayName",e),$=e=>c("historyId",e),J=e=>c("testCaseId",e),X=(e,t,r)=>c("attachment",e,t,r),q=()=>({displayName:e=>c("stepDisplayName",e),parameter:(e,t,r)=>c("stepParameter",e,t,r)}),Q=(e,t)=>c("step",e,()=>t(q())),ee=(e,t)=>P(e,E.ISSUE,t),te=(e,t)=>P(e,E.TMS,t),re=e=>g(l.ALLURE_ID,e),se=e=>g(l.EPIC,e),ae=e=>g(l.FEATURE,e),ne=e=>g(l.STORY,e),ie=e=>g(l.SUITE,e),oe=e=>g(l.PARENT_SUITE,e),ue=e=>g(l.SUB_SUITE,e),pe=e=>g(l.OWNER,e),le=e=>g(l.SEVERITY,e),ce=e=>g(l.LAYER,e),de=e=>g(l.TAG,e),ge=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r.map(a=>({name:l.TAG,value:a})))};var C=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,G=(e,t)=>Array.isArray(e)||e.buffer?"base64":t,N=e=>{let t=[],r=e.parent;for(;r;)r.title&&t.unshift(r.title),r=r.parent;return t};var _=class{label(t,r){return this.sendMessageAsync({type:"metadata",data:{labels:[{name:t,value:r}]}})}labels(...t){return this.sendMessageAsync({type:"metadata",data:{labels:t}})}link(t,r,s){return this.sendMessageAsync({type:"metadata",data:{links:[{type:r,url:t,name:s}]}})}links(...t){return this.sendMessageAsync({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.sendMessageAsync({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.sendMessageAsync({type:"metadata",data:{displayName:t}})}historyId(t){return this.sendMessageAsync({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.sendMessageAsync({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let a=r?.type==="Buffer"?r.data:r,n=r instanceof Buffer?"base64":"utf-8",i=G(a,n),u=C(a);return this.sendMessageAsync({type:"raw_attachment",data:{content:u,encoding:i,contentType:s,name:t}})}step(t,r){return cy.wrap(null,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.sendMessageAsync({type:"step_stop",data:{status:p.PASSED,stage:y.FINISHED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.sendMessageAsync({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}sendMessage(t){let r=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",r.concat(t))}sendMessageAsync(t){return this.sendMessage(t),Cypress.Promise.resolve()}},{EVENT_TEST_BEGIN:ye,EVENT_TEST_FAIL:he,EVENT_TEST_PASS:ve}=Mocha.Runner.constants,Ee=()=>{Cypress.env("allureInitialized")||(Cypress.mocha.getRunner().on(ye,t=>{let r=new _;Cypress.env("allureRuntimeMessages",[]),r.sendMessage({type:"cypress_start",data:{isInteractive:Cypress.config("isInteractive"),absolutePath:Cypress.spec.absolute,specPath:N(t).concat(t.title),filename:Cypress.spec.relative,start:Date.now()}}),A(r)}).on(ve,()=>{let t=v(),r=Cypress.env("allureRuntimeMessages");M(r).forEach(()=>{t.sendMessage({type:"step_stop",data:{stage:y.FINISHED,status:p.PASSED,stop:Date.now()}})}),t.sendMessage({type:"cypress_end",data:{stage:y.FINISHED,status:p.PASSED,stop:Date.now()}})}).on(he,(t,r)=>{v().sendMessage({type:"cypress_end",data:{stage:y.FINISHED,status:r.constructor.name==="AssertionError"?p.FAILED:p.BROKEN,statusDetails:{message:r.message,trace:r.stack},stop:Date.now()}})}),Cypress.Screenshot.defaults({onAfterScreenshot:(t,r)=>{v().sendMessage({type:"cypress_screenshot",data:{path:r.path,name:r.name||"Screenshot"}})}}),Cypress.on("fail",t=>{let r=v(),s=Cypress.env("allureRuntimeMessages");if(!I(s))throw t;let n=M(s);if(n.length===0)throw t;let i=t.constructor.name==="AssertionError"?p.FAILED:p.BROKEN;throw n.forEach(()=>{r.sendMessage({type:"step_stop",data:{stage:y.FINISHED,status:i,stop:Date.now(),statusDetails:{message:t.message,trace:t.stack}}})}),t}),afterEach(()=>{let t=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",t,{log:!1})}),Cypress.env("allureInitialized",!0))};Ee();export{_ as AllureCypressTestRuntime,j as ContentType,l as LabelName,E as LinkType,L as Severity,y as Stage,p as Status,F as StatusByPriority,re as allureId,X as attachment,W as description,Y as descriptionHtml,Z as displayName,se as epic,ae as feature,$ as historyId,ee as issue,g as label,K as labels,ce as layer,P as link,z as links,pe as owner,V as parameter,oe as parentSuite,le as severity,Q as step,ne as story,ue as subSuite,ie as suite,de as tag,ge as tags,J as testCaseId,te as tms};
1
+ var p=function(e){return e.FAILED="failed",e.BROKEN="broken",e.PASSED="passed",e.SKIPPED="skipped",e}({}),j=[p.FAILED,p.BROKEN,p.PASSED,p.SKIPPED],h=function(e){return e.SCHEDULED="scheduled",e.RUNNING="running",e.FINISHED="finished",e.PENDING="pending",e.INTERRUPTED="interrupted",e}({}),l=function(e){return e.ALLURE_ID="ALLURE_ID",e.AS_ID="ALLURE_ID",e.SUITE="suite",e.PARENT_SUITE="parentSuite",e.SUB_SUITE="subSuite",e.EPIC="epic",e.FEATURE="feature",e.STORY="story",e.SEVERITY="severity",e.TAG="tag",e.OWNER="owner",e.LEAD="lead",e.HOST="host",e.THREAD="thread",e.TEST_METHOD="testMethod",e.TEST_CLASS="testClass",e.PACKAGE="package",e.FRAMEWORK="framework",e.LANGUAGE="language",e.LAYER="layer",e}({}),L=function(e){return e.BLOCKER="blocker",e.CRITICAL="critical",e.NORMAL="normal",e.MINOR="minor",e.TRIVIAL="trivial",e}({}),A=function(e){return e.TEXT="text/plain",e.XML="application/xml",e.HTML="text/html",e.CSV="text/csv",e.TSV="text/tab-separated-values",e.CSS="text/css",e.URI="text/uri-list",e.SVG="image/svg+xml",e.PNG="image/png",e.JSON="application/json",e.ZIP="application/zip",e.WEBM="video/webm",e.JPEG="image/jpeg",e.MP4="video/mp4",e.IMAGEDIFF="application/vnd.allure.image.diff",e}({}),E=function(e){return e.ISSUE="issue",e.TMS="tms",e}({});function O(e,t,r,s,n,a,i){try{var u=e[a](i),o=u.value}catch(g){return void r(g)}u.done?t(o):Promise.resolve(o).then(s,n)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(s,n){var a=e.apply(t,r);function i(o){O(a,s,n,i,u,"next",o)}function u(o){O(a,s,n,i,u,"throw",o)}i(void 0)})}}var R=class{attachment(){var t=this;return d(function*(){yield t.warning()})()}attachmentFromPath(){var t=this;return d(function*(){yield t.warning()})()}description(){var t=this;return d(function*(){yield t.warning()})()}descriptionHtml(){var t=this;return d(function*(){yield t.warning()})()}displayName(){var t=this;return d(function*(){yield t.warning()})()}historyId(){var t=this;return d(function*(){yield t.warning()})()}labels(){var t=this;return d(function*(){yield t.warning()})()}links(){var t=this;return d(function*(){yield t.warning()})()}parameter(){var t=this;return d(function*(){yield t.warning()})()}step(t,r){var s=this;return d(function*(){return yield s.warning(),r()})()}stepDisplayName(){var t=this;return d(function*(){yield t.warning()})()}stepParameter(){var t=this;return d(function*(){yield t.warning()})()}testCaseId(){var t=this;return d(function*(){yield t.warning()})()}warning(){return d(function*(){console.log("no test runtime is found. Please check test framework configuration")})()}},y=new R;var C="allureTestRuntime",T=e=>{globalThis[C]=()=>e},b=()=>globalThis?.[C],v=()=>{var e=b();if(e){var t;return(t=e())!==null&&t!==void 0?t:y}return y},w=()=>{var e=b();if(e){var t;return(t=e())!==null&&t!==void 0?t:y}if("_playwrightInstance"in globalThis)try{return(0,eval)("(() => import('allure-playwright/autoconfig'))()").then(()=>{var r,s;return(r=(s=b())===null||s===void 0?void 0:s())!==null&&r!==void 0?r:y})}catch(r){return console.log("can't execute allure-playwright/autoconfig",r),y}return y};function x(){x=function(a,i){return new r(a,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function r(n,a,i){var u=RegExp(n,a);return t.set(u,i||t.get(n)),S(u,r.prototype)}function s(n,a){var i=t.get(a);return Object.keys(i).reduce(function(u,o){var g=i[o];if(typeof g=="number")u[o]=n[g];else{for(var f=0;n[g[f]]===void 0&&f+1<g.length;)f++;u[o]=n[g[f]]}return u},Object.create(null))}return U(r,RegExp),r.prototype.exec=function(n){var a=e.exec.call(this,n);if(a){a.groups=s(a,this);var i=a.indices;i&&(i.groups=s(i,this))}return a},r.prototype[Symbol.replace]=function(n,a){if(typeof a=="string"){var i=t.get(this);return e[Symbol.replace].call(this,n,a.replace(/\$<([^>]+)>/g,function(o,g){var f=i[g];return"$"+(Array.isArray(f)?f.join("$"):f)}))}if(typeof a=="function"){var u=this;return e[Symbol.replace].call(this,n,function(){var o=arguments;return typeof o[o.length-1]!="object"&&(o=[].slice.call(o)).push(s(o,u)),a.apply(this,o)})}return e[Symbol.replace].call(this,n,a)},x.apply(this,arguments)}function U(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&S(e,t)}function S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},S(e,t)}var H=x(/@?allure.id[:=]([^\s]+)/,{id:1}),be=new RegExp(H,"g"),B=x(/@?allure.label.([^\s]+?)[:=]([^\s]+)/,{name:1,value:2}),Te=new RegExp(B,"g");var I=e=>e.some(t=>t.type==="step_start"||t.type==="step_stop"),k=e=>e.reduce((t,r)=>{if(r.type!=="step_start"&&r.type!=="step_stop")return t;if(r.type==="step_start")return t.push([r]),t;var s=t.findLastIndex(n=>n.length===1);return s===-1||t[s].push(r),t},[]),M=e=>{var t=k(e);return t.filter(r=>r.length===1)},P=e=>!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function";var c=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];var a=w();return P(a)?a.then(i=>i[t](...s)):a[t](...s)},m=(e,t)=>c("labels",{name:e,value:t}),K=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r)},_=(e,t,r)=>c("links",{url:e,type:r,name:t}),z=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("links",...r)},V=(e,t,r)=>c("parameter",e,t,r),W=e=>c("description",e),Y=e=>c("descriptionHtml",e),Z=e=>c("displayName",e),$=e=>c("historyId",e),J=e=>c("testCaseId",e),X=(e,t,r)=>{var s=typeof r=="string"?{contentType:r}:r;return c("attachment",e,t,s)};var q=()=>({displayName:e=>c("stepDisplayName",e),parameter:(e,t,r)=>c("stepParameter",e,t,r)}),Q=(e,t)=>c("step",e,()=>t(q())),ee=(e,t)=>_(e,t,E.ISSUE),te=(e,t)=>_(e,t,E.TMS),re=e=>m(l.ALLURE_ID,e),se=e=>m(l.EPIC,e),ne=e=>m(l.FEATURE,e),ae=e=>m(l.STORY,e),ie=e=>m(l.SUITE,e),oe=e=>m(l.PARENT_SUITE,e),ue=e=>m(l.SUB_SUITE,e),pe=e=>m(l.OWNER,e),le=e=>m(l.SEVERITY,e),ce=e=>m(l.LAYER,e),de=e=>m(l.TAG,e),me=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return c("labels",...r.map(n=>({name:l.TAG,value:n})))};var F=e=>Array.isArray(e)||e.buffer?btoa(String.fromCharCode.apply(null,e)):e,G=(e,t)=>Array.isArray(e)||e.buffer?"base64":t,N=e=>{let t=[],r=e.parent;for(;r;)r.title&&t.unshift(r.title),r=r.parent;return t};var D=class{labels(...t){return this.sendMessageAsync({type:"metadata",data:{labels:t}})}links(...t){return this.sendMessageAsync({type:"metadata",data:{links:t}})}parameter(t,r,s){return this.sendMessageAsync({type:"metadata",data:{parameters:[{name:t,value:r,...s}]}})}description(t){return this.sendMessageAsync({type:"metadata",data:{description:t}})}descriptionHtml(t){return this.sendMessageAsync({type:"metadata",data:{descriptionHtml:t}})}displayName(t){return this.sendMessageAsync({type:"metadata",data:{displayName:t}})}historyId(t){return this.sendMessageAsync({type:"metadata",data:{historyId:t}})}testCaseId(t){return this.sendMessageAsync({type:"metadata",data:{testCaseId:t}})}attachment(t,r,s){let n=r?.type==="Buffer"?r.data:r,a=r instanceof Buffer?"base64":"utf-8",i=G(n,a),u=F(n);return this.sendMessageAsync({type:"attachment_content",data:{name:t,content:u,encoding:i,contentType:s.contentType,fileExtension:s.fileExtension}})}attachmentFromPath(t,r,s){return this.sendMessageAsync({type:"attachment_path",data:{name:t,path:r,contentType:s.contentType,fileExtension:s.fileExtension}})}step(t,r){return cy.wrap(null,{log:!1}).then(()=>(this.sendMessage({type:"step_start",data:{name:t,start:Date.now()}}),Cypress.Promise.resolve(r()))).then(s=>this.sendMessageAsync({type:"step_stop",data:{status:p.PASSED,stage:h.FINISHED,stop:Date.now()}}).then(()=>s))}stepDisplayName(t){return this.sendMessageAsync({type:"step_metadata",data:{name:t}})}stepParameter(t,r,s){return this.sendMessageAsync({type:"step_metadata",data:{parameters:[{name:t,value:r,mode:s}]}})}sendMessage(t){let r=Cypress.env("allureRuntimeMessages")||[];Cypress.env("allureRuntimeMessages",r.concat(t))}sendMessageAsync(t){return this.sendMessage(t),Cypress.Promise.resolve()}},{EVENT_TEST_BEGIN:he,EVENT_TEST_FAIL:ye,EVENT_TEST_PASS:ve}=Mocha.Runner.constants,Ee=()=>{Cypress.env("allureInitialized")||(Cypress.mocha.getRunner().on(he,t=>{let r=new D;Cypress.env("allureRuntimeMessages",[]),r.sendMessage({type:"cypress_start",data:{isInteractive:Cypress.config("isInteractive"),absolutePath:Cypress.spec.absolute,specPath:N(t).concat(t.title),filename:Cypress.spec.relative,start:Date.now()}}),T(r)}).on(ve,()=>{let t=v(),r=Cypress.env("allureRuntimeMessages");M(r).forEach(()=>{t.sendMessage({type:"step_stop",data:{stage:h.FINISHED,status:p.PASSED,stop:Date.now()}})}),t.sendMessage({type:"cypress_end",data:{stage:h.FINISHED,status:p.PASSED,stop:Date.now()}})}).on(ye,(t,r)=>{v().sendMessage({type:"cypress_end",data:{stage:h.FINISHED,status:r.constructor.name==="AssertionError"?p.FAILED:p.BROKEN,statusDetails:{message:r.message,trace:r.stack},stop:Date.now()}})}),Cypress.Screenshot.defaults({onAfterScreenshot:(t,r)=>v().sendMessageAsync({type:"attachment_path",data:{path:r.path,name:r.name||"Screenshot",contentType:A.PNG}})}),Cypress.on("fail",t=>{let r=v(),s=Cypress.env("allureRuntimeMessages");if(!I(s))throw t;let a=M(s);if(a.length===0)throw t;let i=t.constructor.name==="AssertionError"?p.FAILED:p.BROKEN;throw a.forEach(()=>{r.sendMessage({type:"step_stop",data:{stage:h.FINISHED,status:i,stop:Date.now(),statusDetails:{message:t.message,trace:t.stack}}})}),t}),afterEach(()=>{let t=Cypress.env("allureRuntimeMessages");cy.task("allureReportTest",t,{log:!1})}),Cypress.env("allureInitialized",!0))};Ee();export{D as AllureCypressTestRuntime,A as ContentType,l as LabelName,E as LinkType,L as Severity,h as Stage,p as Status,j as StatusByPriority,re as allureId,X as attachment,W as description,Y as descriptionHtml,Z as displayName,se as epic,ne as feature,$ as historyId,ee as issue,m as label,K as labels,ce as layer,_ as link,z as links,pe as owner,V as parameter,oe as parentSuite,le as severity,Q as step,ae as story,ue as subSuite,ie as suite,de as tag,me as tags,J as testCaseId,te as tms};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../allure-js-commons/src/model.ts", "../../../allure-js-commons/src/sdk/runtime/NoopTestRuntime.ts", "../../../allure-js-commons/src/sdk/runtime/runtime.ts", "../../../allure-js-commons/src/sdk/utils.ts", "../../../allure-js-commons/src/facade.ts", "../../src/utils.ts", "../../src/index.ts"],
4
- "sourcesContent": ["export interface Attachment {\n name: string;\n type: string;\n source: string;\n}\n\nexport interface AttachmentOptions {\n contentType: ContentType | string;\n encoding?: string;\n fileExtension?: string;\n}\n\nexport interface Label {\n name: LabelName | string;\n value: string;\n}\n\nexport interface Link {\n name?: string;\n url: string;\n type?: LinkType | string;\n}\n\nexport type ParameterMode = \"hidden\" | \"masked\" | \"default\";\n\nexport interface Parameter {\n name: string;\n value: string;\n excluded?: boolean;\n mode?: ParameterMode;\n}\n\nexport type ParameterOptions = Pick<Parameter, \"mode\" | \"excluded\">;\n\nexport interface StatusDetails {\n message?: string;\n trace?: string;\n}\n\n// don't use the interface as is, use Results types instead\ninterface Executable {\n name?: string;\n status?: Status;\n statusDetails: StatusDetails;\n stage: Stage;\n description?: string;\n descriptionHtml?: string;\n steps: StepResult[];\n attachments: Attachment[];\n parameters: Parameter[];\n start?: number;\n stop?: number;\n}\n\nexport interface FixtureResult extends Executable {}\n\nexport interface StepResult extends Executable {}\n\nexport interface TestResult extends Executable {\n uuid: string;\n historyId?: string;\n fullName?: string;\n testCaseId?: string;\n labels: Label[];\n links: Link[];\n}\n\nexport interface TestResultContainer {\n uuid: string;\n name?: string;\n children: string[];\n befores: FixtureResult[];\n afters: FixtureResult[];\n}\n\nexport type TestOrStepResult = StepResult | TestResult;\n\n/* eslint-disable no-shadow */\nexport enum Status {\n FAILED = \"failed\",\n BROKEN = \"broken\",\n PASSED = \"passed\",\n SKIPPED = \"skipped\",\n}\n\nexport const StatusByPriority = [Status.FAILED, Status.BROKEN, Status.PASSED, Status.SKIPPED];\n\n/* eslint-disable no-shadow */\nexport enum Stage {\n SCHEDULED = \"scheduled\",\n RUNNING = \"running\",\n FINISHED = \"finished\",\n PENDING = \"pending\",\n INTERRUPTED = \"interrupted\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LabelName {\n ALLURE_ID = \"ALLURE_ID\",\n /**\n * @deprecated please use ALLURE_ID instead\n */\n AS_ID = ALLURE_ID,\n SUITE = \"suite\",\n PARENT_SUITE = \"parentSuite\",\n SUB_SUITE = \"subSuite\",\n EPIC = \"epic\",\n FEATURE = \"feature\",\n STORY = \"story\",\n SEVERITY = \"severity\",\n TAG = \"tag\",\n OWNER = \"owner\",\n LEAD = \"lead\",\n HOST = \"host\",\n THREAD = \"thread\",\n TEST_METHOD = \"testMethod\",\n TEST_CLASS = \"testClass\",\n PACKAGE = \"package\",\n FRAMEWORK = \"framework\",\n LANGUAGE = \"language\",\n LAYER = \"layer\",\n}\n\n/* eslint-disable no-shadow */\nexport enum Severity {\n BLOCKER = \"blocker\",\n CRITICAL = \"critical\",\n NORMAL = \"normal\",\n MINOR = \"minor\",\n TRIVIAL = \"trivial\",\n}\n\n/* eslint-disable no-shadow */\nexport enum ContentType {\n TEXT = \"text/plain\",\n XML = \"application/xml\",\n HTML = \"text/html\",\n CSV = \"text/csv\",\n TSV = \"text/tab-separated-values\",\n CSS = \"text/css\",\n URI = \"text/uri-list\",\n SVG = \"image/svg+xml\",\n PNG = \"image/png\",\n JSON = \"application/json\",\n ZIP = \"application/zip\",\n WEBM = \"video/webm\",\n JPEG = \"image/jpeg\",\n MP4 = \"video/mp4\",\n IMAGEDIFF = \"application/vnd.allure.image.diff\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LinkType {\n ISSUE = \"issue\",\n TMS = \"tms\",\n}\n\nexport interface ImageDiffAttachment {\n expected: string | undefined; // data:image;base64,\n actual: string | undefined; // data:image;base64,\n diff: string | undefined; // data:image;base64,\n name: string;\n}\n", "import type { TestRuntime } from \"./types.js\";\n\nexport class NoopTestRuntime implements TestRuntime {\n async attachment() {\n await this.warning();\n }\n\n async description() {\n await this.warning();\n }\n\n async descriptionHtml() {\n await this.warning();\n }\n\n async displayName() {\n await this.warning();\n }\n\n async historyId() {\n await this.warning();\n }\n\n async labels() {\n await this.warning();\n }\n\n async links() {\n await this.warning();\n }\n\n async parameter() {\n await this.warning();\n }\n\n async step<T>(name: string, body: () => T | PromiseLike<T>): Promise<T> {\n await this.warning();\n return body();\n }\n\n async stepDisplayName() {\n await this.warning();\n }\n\n async stepParameter() {\n await this.warning();\n }\n\n async testCaseId() {\n await this.warning();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async warning() {\n // eslint-disable-next-line no-console\n console.log(\"no test runtime is found. Please check test framework configuration\");\n }\n}\n\nexport const noopRuntime = new NoopTestRuntime();\n", "import { noopRuntime } from \"./NoopTestRuntime.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nconst ALLURE_TEST_RUNTIME_KEY = \"allureTestRuntime\";\n\nexport const setGlobalTestRuntime = (runtime: TestRuntime) => {\n (globalThis as any)[ALLURE_TEST_RUNTIME_KEY] = () => runtime;\n};\n\nconst getGlobalTestRuntimeFunction = () => {\n return (globalThis as any)?.[ALLURE_TEST_RUNTIME_KEY] as (() => TestRuntime | undefined) | undefined;\n};\n\nexport const getGlobalTestRuntime = (): TestRuntime => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n return noopRuntime;\n};\n\nexport const getGlobalTestRuntimeWithAutoconfig = (): TestRuntime | Promise<TestRuntime> => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n if (\"_playwrightInstance\" in globalThis) {\n try {\n // protection from bundlers tree-shaking visiting (webpack, rollup)\n // @ts-ignore\n // eslint-disable-next-line no-eval\n return (0, eval)(\"(() => import('allure-playwright/autoconfig'))()\").then(() => {\n return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(\"can't execute allure-playwright/autoconfig\", err);\n return noopRuntime;\n }\n }\n\n return noopRuntime;\n};\n", "import type { FixtureResult, Label, StatusDetails, StepResult, TestResult } from \"../model.js\";\nimport { LabelName, Status } from \"../model.js\";\nimport type { RuntimeMessage } from \"./types.js\";\n\nexport const getStatusFromError = (error: Error): Status => {\n switch (true) {\n /**\n * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError`\n * `jest` throws `JestAssertionError` instance\n * `jasmine` throws `ExpectationFailed` instance\n */\n case /assert/gi.test(error.constructor.name):\n case /expectation/gi.test(error.constructor.name):\n case /assert/gi.test(error.name):\n case /assert/gi.test(error.message):\n return Status.FAILED;\n default:\n return Status.BROKEN;\n }\n};\n\n/**\n * Source: https://github.com/chalk/ansi-regex\n */\nexport const ansiRegex = ({ onlyFirst = false } = {}) => {\n const pattern = [\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\",\n \"(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\",\n ].join(\"|\");\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n\n/**\n * https://github.com/chalk/strip-ansi\n */\nexport const stripAnsi = (str: string) => {\n if (typeof str !== \"string\") {\n throw new TypeError(`Expected a \\`string\\`, got \\`${typeof str}\\``);\n }\n\n const regex = ansiRegex();\n\n return str.replace(regex, \"\");\n};\n\nexport const getMessageAndTraceFromError = (\n error: Error | { message?: string; stack?: string },\n): Pick<StatusDetails, \"message\" | \"trace\"> => {\n const { message, stack } = error;\n return {\n message: message ? stripAnsi(message) : undefined,\n trace: stack ? stripAnsi(stack) : undefined,\n };\n};\n\nexport const allureIdRegexp = /@?allure.id[:=](?<id>[^\\s]+)/;\nexport const allureIdRegexpGlobal = new RegExp(allureIdRegexp, \"g\");\nexport const allureLabelRegexp = /@?allure.label.(?<name>[^\\s]+?)[:=](?<value>[^\\s]+)/;\nexport const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, \"g\");\n\nexport const extractMetadataFromString = (\n title: string,\n): {\n labels: Label[];\n cleanTitle: string;\n} => {\n const labels = [] as Label[];\n\n title.split(\" \").forEach((val) => {\n const idValue = val.match(allureIdRegexp)?.groups?.id;\n\n if (idValue) {\n labels.push({ name: LabelName.ALLURE_ID, value: idValue });\n }\n\n const labelMatch = val.match(allureLabelRegexp);\n const { name, value } = labelMatch?.groups || {};\n\n if (name && value) {\n labels?.push({ name, value });\n }\n });\n\n const cleanTitle = title.replace(allureLabelRegexpGlobal, \"\").replace(allureIdRegexpGlobal, \"\").trim();\n\n return { labels, cleanTitle };\n};\n\nexport const isAnyStepFailed = (item: StepResult | TestResult | FixtureResult): boolean => {\n const isFailed = item.status === Status.FAILED;\n\n if (isFailed || item.steps.length === 0) {\n return isFailed;\n }\n\n return !!item.steps.find((step) => isAnyStepFailed(step));\n};\n\nexport const isAllStepsEnded = (item: StepResult | TestResult | FixtureResult): boolean => {\n return item.steps.every((val) => val.stop && isAllStepsEnded(val));\n};\n\nexport const hasLabel = (testResult: TestResult, labelName: LabelName | string): boolean => {\n return !!testResult.labels.find((l) => l.name === labelName);\n};\n\nexport const hasStepMessage = (messages: RuntimeMessage[]) => {\n return messages.some((message) => message.type === \"step_start\" || message.type === \"step_stop\");\n};\n\nexport const getStepsMessagesPair = (messages: RuntimeMessage[]) =>\n messages.reduce((acc, message) => {\n if (message.type !== \"step_start\" && message.type !== \"step_stop\") {\n return acc;\n }\n\n if (message.type === \"step_start\") {\n acc.push([message]);\n\n return acc;\n }\n\n const unfinishedStepIdx = acc.findLastIndex((step) => step.length === 1);\n\n if (unfinishedStepIdx === -1) {\n return acc;\n }\n\n acc[unfinishedStepIdx].push(message);\n\n return acc;\n }, [] as RuntimeMessage[][]);\n\nexport const getUnfinishedStepsMessages = (messages: RuntimeMessage[]) => {\n const grouppedStepsMessage = getStepsMessagesPair(messages);\n\n return grouppedStepsMessage.filter((step) => step.length === 1);\n};\n\nexport const isPromise = (obj: any): boolean =>\n !!obj && (typeof obj === \"object\" || typeof obj === \"function\") && typeof obj.then === \"function\";\n", "import type { ContentType, Label, Link, ParameterMode, ParameterOptions } from \"./model.js\";\nimport { LabelName, LinkType } from \"./model.js\";\nimport { getGlobalTestRuntimeWithAutoconfig } from \"./sdk/runtime/runtime.js\";\nimport type { TestRuntime } from \"./sdk/runtime/types.js\";\nimport { isPromise } from \"./sdk/utils.js\";\n\nconst callRuntimeMethod = (method: string, ...args: any[]) => {\n const runtime = getGlobalTestRuntimeWithAutoconfig();\n\n if (!isPromise(runtime)) {\n // @ts-ignore\n return (runtime as TestRuntime)[method](...args);\n }\n\n return (runtime as Promise<TestRuntime>).then((testRuntime) => {\n // @ts-ignore\n return testRuntime[method](...args);\n });\n};\n\nexport const label = (name: LabelName | string, value: string) => {\n return callRuntimeMethod(\"labels\", { name, value });\n // const runtime = getGlobalTestRuntimeWithAutoconfig();\n //\n // if (!isPromise(runtime)) {\n // return (runtime as TestRuntime).labels({ name, value });\n // }\n //\n // return (runtime as Promise<TestRuntime>).then((testRuntime) => testRuntime.labels({ name, value }));\n};\n\nexport const labels = (...labelsList: Label[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.labels(...labelsList);\n return callRuntimeMethod(\"labels\", ...labelsList);\n};\n\nexport const link = (url: string, type?: LinkType | string, name?: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.links({ url, type, name });\n return callRuntimeMethod(\"links\", { url, type, name });\n};\n\nexport const links = (...linksList: Link[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.links(...linksList);\n return callRuntimeMethod(\"links\", ...linksList);\n};\n\nexport const parameter = (name: string, value: string, options?: ParameterOptions) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.parameter(name, value, options);\n return callRuntimeMethod(\"parameter\", name, value, options);\n};\n\nexport const description = (markdown: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.description(markdown);\n return callRuntimeMethod(\"description\", markdown);\n};\n\nexport const descriptionHtml = (html: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.descriptionHtml(html);\n return callRuntimeMethod(\"descriptionHtml\", html);\n};\n\nexport const displayName = (name: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.displayName(name);\n return callRuntimeMethod(\"displayName\", name);\n};\n\nexport const historyId = (value: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.historyId(value);\n return callRuntimeMethod(\"historyId\", value);\n};\n\nexport const testCaseId = (value: string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.testCaseId(value);\n return callRuntimeMethod(\"testCaseId\", value);\n};\n\nexport const attachment = (name: string, content: Buffer | string, type: ContentType | string) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.attachment(name, content, type);\n return callRuntimeMethod(\"attachment\", name, content, type);\n};\n\nexport type StepContext = {\n displayName: (name: string) => void | PromiseLike<void>;\n parameter: (name: string, value: string, mode?: ParameterMode) => void | PromiseLike<void>;\n};\n\nconst stepContext: () => StepContext = () => ({\n displayName: (name: string) => {\n // return runtime.stepDisplayName(name);\n return callRuntimeMethod(\"stepDisplayName\", name);\n },\n parameter: (name, value, mode?) => {\n // return runtime.stepParameter(name, value, mode);\n return callRuntimeMethod(\"stepParameter\", name, value, mode);\n },\n});\n\nexport const step = <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => {\n // throw new Error(\"Not implemented\");\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.step(name, () => body(stepContext(runtime)));\n return callRuntimeMethod(\"step\", name, () => body(stepContext()));\n};\n\nexport const issue = (url: string, name?: string) => link(url, LinkType.ISSUE, name);\n\nexport const tms = (url: string, name?: string) => link(url, LinkType.TMS, name);\n\nexport const allureId = (value: string) => label(LabelName.ALLURE_ID, value);\n\nexport const epic = (name: string) => label(LabelName.EPIC, name);\n\nexport const feature = (name: string) => label(LabelName.FEATURE, name);\n\nexport const story = (name: string) => label(LabelName.STORY, name);\n\nexport const suite = (name: string) => label(LabelName.SUITE, name);\n\nexport const parentSuite = (name: string) => label(LabelName.PARENT_SUITE, name);\n\nexport const subSuite = (name: string) => label(LabelName.SUB_SUITE, name);\n\nexport const owner = (name: string) => label(LabelName.OWNER, name);\n\nexport const severity = (name: string) => label(LabelName.SEVERITY, name);\n\nexport const layer = (name: string) => label(LabelName.LAYER, name);\n\nexport const tag = (name: string) => label(LabelName.TAG, name);\n\nexport const tags = (...tagsList: string[]) => {\n // const runtime = await getGlobalTestRuntimeWithAutoconfig();\n //\n // return runtime.labels(...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n return callRuntimeMethod(\"labels\", ...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n};\n", "export const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const normalizeAttachmentContentEncoding = (data: unknown, encoding: BufferEncoding): BufferEncoding => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (u8arrayLike) {\n return \"base64\";\n }\n\n return encoding;\n};\n\nexport const getSuitePath = (test: Mocha.Test): string[] => {\n const path: string[] = [];\n let currentSuite: Mocha.Suite | undefined = test.parent;\n\n while (currentSuite) {\n if (currentSuite.title) {\n path.unshift(currentSuite.title);\n }\n\n currentSuite = currentSuite.parent;\n }\n\n return path;\n};\n", "import { Stage, Status } from \"allure-js-commons\";\nimport type { ContentType, Label, LabelName, Link, LinkType, ParameterMode, ParameterOptions } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { getUnfinishedStepsMessages, hasStepMessage } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport type { CypressRuntimeMessage } from \"./model.js\";\nimport { getSuitePath, normalizeAttachmentContentEncoding, uint8ArrayToBase64 } from \"./utils.js\";\n\nexport class AllureCypressTestRuntime implements TestRuntime {\n label(name: LabelName | string, value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels: [{ name, value }],\n },\n });\n }\n\n labels(...labels: Label[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n link(url: string, type?: LinkType | string, name?: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links: [{ type, url, name }],\n },\n });\n }\n\n links(...links: Link[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Buffer | string, type: string | ContentType) {\n // @ts-ignore\n const attachmentRawContent: string | Uint8Array = content?.type === \"Buffer\" ? content.data : content;\n const encoding = content instanceof Buffer ? \"base64\" : \"utf-8\";\n const actualEncoding = normalizeAttachmentContentEncoding(attachmentRawContent, encoding);\n const attachmentContent = uint8ArrayToBase64(attachmentRawContent);\n\n return this.sendMessageAsync({\n type: \"raw_attachment\",\n data: {\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: type,\n name,\n },\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(null, { log: false })\n .then(() => {\n this.sendMessage({\n type: \"step_start\",\n data: { name, start: Date.now() },\n });\n\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n return this.sendMessageAsync({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stage: Stage.FINISHED,\n stop: Date.now(),\n },\n }).then(() => result);\n });\n }\n\n stepDisplayName(name: string) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n sendMessage(message: CypressRuntimeMessage) {\n const messages = Cypress.env(\"allureRuntimeMessages\") || [];\n\n Cypress.env(\"allureRuntimeMessages\", messages.concat(message));\n }\n\n sendMessageAsync(message: CypressRuntimeMessage): PromiseLike<void> {\n this.sendMessage(message);\n return Cypress.Promise.resolve();\n }\n}\n\nconst { EVENT_TEST_BEGIN, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants;\n\nconst initializeAllure = () => {\n const initialized = Cypress.env(\"allureInitialized\") as boolean;\n\n if (initialized) {\n return;\n }\n\n // @ts-ignore\n Cypress.mocha\n .getRunner()\n .on(EVENT_TEST_BEGIN, (test: Mocha.Test) => {\n const testRuntime = new AllureCypressTestRuntime();\n\n Cypress.env(\"allureRuntimeMessages\", []);\n\n testRuntime.sendMessage({\n type: \"cypress_start\",\n data: {\n isInteractive: Cypress.config(\"isInteractive\"),\n absolutePath: Cypress.spec.absolute,\n specPath: getSuitePath(test).concat(test.title),\n filename: Cypress.spec.relative,\n start: Date.now(),\n },\n });\n\n setGlobalTestRuntime(testRuntime);\n })\n .on(EVENT_TEST_PASS, () => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n });\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n })\n .on(EVENT_TEST_FAIL, (test: Mocha.Test, err: Error) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN,\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n stop: Date.now(),\n },\n });\n });\n\n Cypress.Screenshot.defaults({\n onAfterScreenshot: (_, details) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_screenshot\",\n data: {\n path: details.path,\n name: details.name || \"Screenshot\",\n },\n });\n },\n });\n\n Cypress.on(\"fail\", (err) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const hasSteps = hasStepMessage(runtimeMessages as RuntimeMessage[]);\n\n // if there is no steps, don't handle the error\n if (!hasSteps) {\n throw err;\n }\n\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n if (unfinishedStepsMessages.length === 0) {\n throw err;\n }\n\n const failedStepsStatus = err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN;\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: failedStepsStatus,\n stop: Date.now(),\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n },\n });\n });\n\n throw err;\n });\n\n afterEach(() => {\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n\n cy.task(\"allureReportTest\", runtimeMessages, { log: false });\n });\n\n Cypress.env(\"allureInitialized\", true);\n};\n\ninitializeAllure();\n\nexport * from \"allure-js-commons\";\n"],
5
- "mappings": "AA8EA,IAAYA,EAAM,SAANA,EAAM,CAANA,OAAAA,EAAM,OAAA,SAANA,EAAM,OAAA,SAANA,EAAM,OAAA,SAANA,EAAM,QAAA,UAANA,CA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,SACb,OAAQe,EAAI,YAAY,OAAS,iBAAmBhB,EAAO,OAASA,EAAO,OAC3E,cAAe,CACb,QAASgB,EAAI,QACb,MAAOA,EAAI,KACb,EACA,KAAM,KAAK,IAAI,CACjB,CACF,CAAC,CACH,CAAC,EAEH,QAAQ,WAAW,SAAS,CAC1B,kBAAmB,CAACC,EAAGC,IAAY,CACbL,EAAqB,EAE7B,YAAY,CACtB,KAAM,qBACN,KAAM,CACJ,KAAMK,EAAQ,KACd,KAAMA,EAAQ,MAAQ,YACxB,CACF,CAAC,CACH,CACF,CAAC,EAED,QAAQ,GAAG,OAASF,GAAQ,CAC1B,IAAMN,EAAcG,EAAqB,EACnCC,EAAkB,QAAQ,IAAI,uBAAuB,EAI3D,GAAI,CAHaK,EAAeL,CAAmC,EAIjE,MAAME,EAGR,IAAMI,EAA0BL,EAA2BD,CAAmC,EAE9F,GAAIM,EAAwB,SAAW,EACrC,MAAMJ,EAGR,IAAMK,EAAoBL,EAAI,YAAY,OAAS,iBAAmBhB,EAAO,OAASA,EAAO,OAE7F,MAAAoB,EAAwB,QAAQ,IAAM,CACpCV,EAAY,YAAY,CACtB,KAAM,YACN,KAAM,CACJ,MAAOT,EAAM,SACb,OAAQoB,EACR,KAAM,KAAK,IAAI,EACf,cAAe,CACb,QAASL,EAAI,QACb,MAAOA,EAAI,KACb,CACF,CACF,CAAC,CACH,CAAC,EAEKA,CACR,CAAC,EAED,UAAU,IAAM,CACd,IAAMF,EAAkB,QAAQ,IAAI,uBAAuB,EAE3D,GAAG,KAAK,mBAAoBA,EAAiB,CAAE,IAAK,EAAM,CAAC,CAC7D,CAAC,EAED,QAAQ,IAAI,oBAAqB,EAAI,EACvC,EAEAN,GAAiB",
6
- "names": ["Status", "StatusByPriority", "FAILED", "BROKEN", "PASSED", "SKIPPED", "Stage", "LabelName", "Severity", "ContentType", "LinkType", "NoopTestRuntime", "attachment", "_this", "_asyncToGenerator", "warning", "description", "_this2", "descriptionHtml", "_this3", "displayName", "_this4", "historyId", "_this5", "labels", "_this6", "links", "_this7", "parameter", "_this8", "step", "name", "body", "_this9", "stepDisplayName", "_this10", "stepParameter", "_this11", "testCaseId", "_this12", "console", "log", "noopRuntime", "ALLURE_TEST_RUNTIME_KEY", "setGlobalTestRuntime", "runtime", "globalThis", "getGlobalTestRuntimeFunction", "getGlobalTestRuntime", "testRuntime", "_testRuntime", "noopRuntime", "getGlobalTestRuntimeWithAutoconfig", "_testRuntime2", "eval", "then", "_getGlobalTestRuntime", "_getGlobalTestRuntime2", "err", "console", "log", "allureIdRegexp", "_wrapRegExp", "id", "allureIdRegexpGlobal", "RegExp", "allureLabelRegexp", "name", "value", "allureLabelRegexpGlobal", "hasStepMessage", "messages", "some", "message", "type", "getStepsMessagesPair", "reduce", "acc", "push", "unfinishedStepIdx", "findLastIndex", "step", "length", "getUnfinishedStepsMessages", "grouppedStepsMessage", "filter", "isPromise", "obj", "then", "callRuntimeMethod", "method", "_len", "arguments", "length", "args", "Array", "_key", "runtime", "getGlobalTestRuntimeWithAutoconfig", "isPromise", "then", "testRuntime", "label", "name", "value", "labels", "_len2", "labelsList", "_key2", "link", "url", "type", "links", "_len3", "linksList", "_key3", "parameter", "options", "description", "markdown", "descriptionHtml", "html", "displayName", "historyId", "testCaseId", "attachment", "content", "stepContext", "mode", "step", "body", "issue", "LinkType", "ISSUE", "tms", "TMS", "allureId", "LabelName", "ALLURE_ID", "epic", "EPIC", "feature", "FEATURE", "story", "STORY", "suite", "SUITE", "parentSuite", "PARENT_SUITE", "subSuite", "SUB_SUITE", "owner", "OWNER", "severity", "SEVERITY", "layer", "LAYER", "tag", "TAG", "tags", "_len4", "tagsList", "_key4", "map", "uint8ArrayToBase64", "data", "normalizeAttachmentContentEncoding", "encoding", "getSuitePath", "test", "path", "currentSuite", "AllureCypressTestRuntime", "name", "value", "labels", "url", "type", "links", "options", "markdown", "html", "content", "attachmentRawContent", "encoding", "actualEncoding", "normalizeAttachmentContentEncoding", "attachmentContent", "uint8ArrayToBase64", "body", "result", "Status", "Stage", "mode", "message", "messages", "EVENT_TEST_BEGIN", "EVENT_TEST_FAIL", "EVENT_TEST_PASS", "initializeAllure", "test", "testRuntime", "getSuitePath", "setGlobalTestRuntime", "getGlobalTestRuntime", "runtimeMessages", "getUnfinishedStepsMessages", "err", "_", "details", "hasStepMessage", "unfinishedStepsMessages", "failedStepsStatus"]
4
+ "sourcesContent": ["export interface Attachment {\n name: string;\n type?: string;\n source: string;\n}\n\nexport interface AttachmentOptions {\n contentType: ContentType | string;\n encoding?: BufferEncoding;\n fileExtension?: string;\n}\n\nexport interface Label {\n name: LabelName | string;\n value: string;\n}\n\nexport interface Link {\n name?: string;\n url: string;\n type?: LinkType | string;\n}\n\nexport type ParameterMode = \"hidden\" | \"masked\" | \"default\";\n\nexport interface Parameter {\n name: string;\n value: string;\n excluded?: boolean;\n mode?: ParameterMode;\n}\n\nexport type ParameterOptions = Pick<Parameter, \"mode\" | \"excluded\">;\n\nexport interface StatusDetails {\n message?: string;\n trace?: string;\n}\n\n// don't use the interface as is, use Results types instead\ninterface Executable {\n name?: string;\n status?: Status;\n statusDetails: StatusDetails;\n stage: Stage;\n description?: string;\n descriptionHtml?: string;\n steps: StepResult[];\n attachments: Attachment[];\n parameters: Parameter[];\n start?: number;\n stop?: number;\n}\n\nexport interface FixtureResult extends Executable {}\n\nexport interface StepResult extends Executable {}\n\nexport interface TestResult extends Executable {\n uuid: string;\n historyId?: string;\n fullName?: string;\n testCaseId?: string;\n labels: Label[];\n links: Link[];\n}\n\nexport interface TestResultContainer {\n uuid: string;\n name?: string;\n children: string[];\n befores: FixtureResult[];\n afters: FixtureResult[];\n}\n\nexport type TestOrStepResult = StepResult | TestResult;\n\n/* eslint-disable no-shadow */\nexport enum Status {\n FAILED = \"failed\",\n BROKEN = \"broken\",\n PASSED = \"passed\",\n SKIPPED = \"skipped\",\n}\n\nexport const StatusByPriority = [Status.FAILED, Status.BROKEN, Status.PASSED, Status.SKIPPED];\n\n/* eslint-disable no-shadow */\nexport enum Stage {\n SCHEDULED = \"scheduled\",\n RUNNING = \"running\",\n FINISHED = \"finished\",\n PENDING = \"pending\",\n INTERRUPTED = \"interrupted\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LabelName {\n ALLURE_ID = \"ALLURE_ID\",\n /**\n * @deprecated please use ALLURE_ID instead\n */\n AS_ID = ALLURE_ID,\n SUITE = \"suite\",\n PARENT_SUITE = \"parentSuite\",\n SUB_SUITE = \"subSuite\",\n EPIC = \"epic\",\n FEATURE = \"feature\",\n STORY = \"story\",\n SEVERITY = \"severity\",\n TAG = \"tag\",\n OWNER = \"owner\",\n LEAD = \"lead\",\n HOST = \"host\",\n THREAD = \"thread\",\n TEST_METHOD = \"testMethod\",\n TEST_CLASS = \"testClass\",\n PACKAGE = \"package\",\n FRAMEWORK = \"framework\",\n LANGUAGE = \"language\",\n LAYER = \"layer\",\n}\n\n/* eslint-disable no-shadow */\nexport enum Severity {\n BLOCKER = \"blocker\",\n CRITICAL = \"critical\",\n NORMAL = \"normal\",\n MINOR = \"minor\",\n TRIVIAL = \"trivial\",\n}\n\n/* eslint-disable no-shadow */\nexport enum ContentType {\n TEXT = \"text/plain\",\n XML = \"application/xml\",\n HTML = \"text/html\",\n CSV = \"text/csv\",\n TSV = \"text/tab-separated-values\",\n CSS = \"text/css\",\n URI = \"text/uri-list\",\n SVG = \"image/svg+xml\",\n PNG = \"image/png\",\n JSON = \"application/json\",\n ZIP = \"application/zip\",\n WEBM = \"video/webm\",\n JPEG = \"image/jpeg\",\n MP4 = \"video/mp4\",\n IMAGEDIFF = \"application/vnd.allure.image.diff\",\n}\n\n/* eslint-disable no-shadow */\nexport enum LinkType {\n ISSUE = \"issue\",\n TMS = \"tms\",\n}\n\nexport interface ImageDiffAttachment {\n expected: string | undefined; // data:image;base64,\n actual: string | undefined; // data:image;base64,\n diff: string | undefined; // data:image;base64,\n name: string;\n}\n", "import type { TestRuntime } from \"./types.js\";\n\nexport class NoopTestRuntime implements TestRuntime {\n async attachment() {\n await this.warning();\n }\n\n async attachmentFromPath() {\n await this.warning();\n }\n\n async description() {\n await this.warning();\n }\n\n async descriptionHtml() {\n await this.warning();\n }\n\n async displayName() {\n await this.warning();\n }\n\n async historyId() {\n await this.warning();\n }\n\n async labels() {\n await this.warning();\n }\n\n async links() {\n await this.warning();\n }\n\n async parameter() {\n await this.warning();\n }\n\n async step<T>(name: string, body: () => T | PromiseLike<T>): Promise<T> {\n await this.warning();\n return body();\n }\n\n async stepDisplayName() {\n await this.warning();\n }\n\n async stepParameter() {\n await this.warning();\n }\n\n async testCaseId() {\n await this.warning();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async warning() {\n // eslint-disable-next-line no-console\n console.log(\"no test runtime is found. Please check test framework configuration\");\n }\n}\n\nexport const noopRuntime: TestRuntime = new NoopTestRuntime();\n", "import { noopRuntime } from \"./NoopTestRuntime.js\";\nimport type { TestRuntime } from \"./types.js\";\n\nconst ALLURE_TEST_RUNTIME_KEY = \"allureTestRuntime\";\n\nexport const setGlobalTestRuntime = (runtime: TestRuntime) => {\n (globalThis as any)[ALLURE_TEST_RUNTIME_KEY] = () => runtime;\n};\n\nconst getGlobalTestRuntimeFunction = () => {\n return (globalThis as any)?.[ALLURE_TEST_RUNTIME_KEY] as (() => TestRuntime | undefined) | undefined;\n};\n\nexport const getGlobalTestRuntime = (): TestRuntime => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n return noopRuntime;\n};\n\nexport const getGlobalTestRuntimeWithAutoconfig = (): TestRuntime | Promise<TestRuntime> => {\n const testRuntime = getGlobalTestRuntimeFunction();\n\n if (testRuntime) {\n return testRuntime() ?? noopRuntime;\n }\n\n if (\"_playwrightInstance\" in globalThis) {\n try {\n // protection from bundlers tree-shaking visiting (webpack, rollup)\n // @ts-ignore\n // eslint-disable-next-line no-eval\n return (0, eval)(\"(() => import('allure-playwright/autoconfig'))()\").then(() => {\n return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(\"can't execute allure-playwright/autoconfig\", err);\n return noopRuntime;\n }\n }\n\n return noopRuntime;\n};\n", "import type { FixtureResult, Label, StatusDetails, StepResult, TestResult } from \"../model.js\";\nimport { LabelName, Status } from \"../model.js\";\nimport type { RuntimeMessage } from \"./types.js\";\n\nexport const getStatusFromError = (error: Error): Status => {\n switch (true) {\n /**\n * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError`\n * `jest` throws `JestAssertionError` instance\n * `jasmine` throws `ExpectationFailed` instance\n */\n case /assert/gi.test(error.constructor.name):\n case /expectation/gi.test(error.constructor.name):\n case /assert/gi.test(error.name):\n case /assert/gi.test(error.message):\n return Status.FAILED;\n default:\n return Status.BROKEN;\n }\n};\n\n/**\n * Source: https://github.com/chalk/ansi-regex\n */\nconst ansiRegex = ({ onlyFirst = false } = {}) => {\n const pattern = [\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)\",\n \"(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))\",\n ].join(\"|\");\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n\n/**\n * https://github.com/chalk/strip-ansi\n */\nexport const stripAnsi = (str: string): string => {\n const regex = ansiRegex();\n return str.replace(regex, \"\");\n};\n\nexport const getMessageAndTraceFromError = (\n error: Error | { message?: string; stack?: string },\n): Pick<StatusDetails, \"message\" | \"trace\"> => {\n const { message, stack } = error;\n return {\n message: message ? stripAnsi(message) : undefined,\n trace: stack ? stripAnsi(stack) : undefined,\n };\n};\n\nexport const allureIdRegexp = /@?allure.id[:=](?<id>[^\\s]+)/;\nexport const allureIdRegexpGlobal = new RegExp(allureIdRegexp, \"g\");\nexport const allureLabelRegexp = /@?allure.label.(?<name>[^\\s]+?)[:=](?<value>[^\\s]+)/;\nexport const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, \"g\");\n\nexport const extractMetadataFromString = (\n title: string,\n): {\n labels: Label[];\n cleanTitle: string;\n} => {\n const labels = [] as Label[];\n\n title.split(\" \").forEach((val) => {\n const idValue = val.match(allureIdRegexp)?.groups?.id;\n\n if (idValue) {\n labels.push({ name: LabelName.ALLURE_ID, value: idValue });\n }\n\n const labelMatch = val.match(allureLabelRegexp);\n const { name, value } = labelMatch?.groups || {};\n\n if (name && value) {\n labels?.push({ name, value });\n }\n });\n\n const cleanTitle = title.replace(allureLabelRegexpGlobal, \"\").replace(allureIdRegexpGlobal, \"\").trim();\n\n return { labels, cleanTitle };\n};\n\nexport const isAnyStepFailed = (item: StepResult | TestResult | FixtureResult): boolean => {\n const isFailed = item.status === Status.FAILED;\n\n if (isFailed || item.steps.length === 0) {\n return isFailed;\n }\n\n return !!item.steps.find((step) => isAnyStepFailed(step));\n};\n\nexport const isAllStepsEnded = (item: StepResult | TestResult | FixtureResult): boolean => {\n return item.steps.every((val) => val.stop && isAllStepsEnded(val));\n};\n\nexport const hasLabel = (testResult: TestResult, labelName: LabelName | string): boolean => {\n return !!testResult.labels.find((l) => l.name === labelName);\n};\n\nexport const hasStepMessage = (messages: RuntimeMessage[]) => {\n return messages.some((message) => message.type === \"step_start\" || message.type === \"step_stop\");\n};\n\nexport const getStepsMessagesPair = (messages: RuntimeMessage[]) =>\n messages.reduce((acc, message) => {\n if (message.type !== \"step_start\" && message.type !== \"step_stop\") {\n return acc;\n }\n\n if (message.type === \"step_start\") {\n acc.push([message]);\n\n return acc;\n }\n\n const unfinishedStepIdx = acc.findLastIndex((step) => step.length === 1);\n\n if (unfinishedStepIdx === -1) {\n return acc;\n }\n\n acc[unfinishedStepIdx].push(message);\n\n return acc;\n }, [] as RuntimeMessage[][]);\n\nexport const getUnfinishedStepsMessages = (messages: RuntimeMessage[]) => {\n const grouppedStepsMessage = getStepsMessagesPair(messages);\n\n return grouppedStepsMessage.filter((step) => step.length === 1);\n};\n\nexport const isPromise = (obj: any): boolean =>\n !!obj && (typeof obj === \"object\" || typeof obj === \"function\") && typeof obj.then === \"function\";\n", "import type { ContentType } from \"./model.js\";\nimport { type AttachmentOptions, type Label, type Link, type ParameterMode, type ParameterOptions } from \"./model.js\";\nimport { LabelName, LinkType } from \"./model.js\";\nimport { getGlobalTestRuntimeWithAutoconfig } from \"./sdk/runtime/runtime.js\";\nimport type { TestRuntime } from \"./sdk/runtime/types.js\";\nimport { isPromise } from \"./sdk/utils.js\";\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;\nconst callRuntimeMethod = <T extends keyof TestRuntime, S extends ArgumentTypes<TestRuntime[T]>>(\n method: T,\n ...args: S\n) => {\n const runtime = getGlobalTestRuntimeWithAutoconfig();\n\n if (!isPromise(runtime)) {\n // @ts-ignore\n return (runtime as TestRuntime)[method](...args);\n }\n\n return (runtime as Promise<TestRuntime>).then((testRuntime) => {\n // @ts-ignore\n return testRuntime[method](...args);\n });\n};\n\nexport const label = (name: LabelName | string, value: string) => {\n return callRuntimeMethod(\"labels\", { name, value });\n};\n\nexport const labels = (...labelsList: Label[]) => {\n return callRuntimeMethod(\"labels\", ...labelsList);\n};\n\nexport const link = (url: string, name?: string, type?: LinkType | string) => {\n return callRuntimeMethod(\"links\", { url, type, name });\n};\n\nexport const links = (...linksList: Link[]) => {\n return callRuntimeMethod(\"links\", ...linksList);\n};\n\nexport const parameter = (name: string, value: string, options?: ParameterOptions) => {\n return callRuntimeMethod(\"parameter\", name, value, options);\n};\n\nexport const description = (markdown: string) => {\n return callRuntimeMethod(\"description\", markdown);\n};\n\nexport const descriptionHtml = (html: string) => {\n return callRuntimeMethod(\"descriptionHtml\", html);\n};\n\nexport const displayName = (name: string) => {\n return callRuntimeMethod(\"displayName\", name);\n};\n\nexport const historyId = (value: string) => {\n return callRuntimeMethod(\"historyId\", value);\n};\n\nexport const testCaseId = (value: string) => {\n return callRuntimeMethod(\"testCaseId\", value);\n};\n\nexport const attachment = (\n name: string,\n content: Buffer | string,\n options: ContentType | string | AttachmentOptions,\n) => {\n const opts = typeof options === \"string\" ? { contentType: options } : options;\n return callRuntimeMethod(\"attachment\", name, content, opts);\n};\n\nexport const attachmentPath = (\n name: string,\n path: string,\n options: ContentType | string | Omit<AttachmentOptions, \"encoding\">,\n) => {\n const opts = typeof options === \"string\" ? { contentType: options } : options;\n return callRuntimeMethod(\"attachmentFromPath\", name, path, opts);\n};\n\nexport type StepContext = {\n displayName: (name: string) => void | PromiseLike<void>;\n parameter: (name: string, value: string, mode?: ParameterMode) => void | PromiseLike<void>;\n};\n\nconst stepContext: () => StepContext = () => ({\n displayName: (name: string) => {\n return callRuntimeMethod(\"stepDisplayName\", name);\n },\n parameter: (name, value, mode?) => {\n return callRuntimeMethod(\"stepParameter\", name, value, mode);\n },\n});\n\nexport const step = <T = void>(name: string, body: (context: StepContext) => T | PromiseLike<T>) => {\n return callRuntimeMethod(\"step\", name, () => body(stepContext()));\n};\n\nexport const issue = (url: string, name?: string) => link(url, name, LinkType.ISSUE);\n\nexport const tms = (url: string, name?: string) => link(url, name, LinkType.TMS);\n\nexport const allureId = (value: string) => label(LabelName.ALLURE_ID, value);\n\nexport const epic = (name: string) => label(LabelName.EPIC, name);\n\nexport const feature = (name: string) => label(LabelName.FEATURE, name);\n\nexport const story = (name: string) => label(LabelName.STORY, name);\n\nexport const suite = (name: string) => label(LabelName.SUITE, name);\n\nexport const parentSuite = (name: string) => label(LabelName.PARENT_SUITE, name);\n\nexport const subSuite = (name: string) => label(LabelName.SUB_SUITE, name);\n\nexport const owner = (name: string) => label(LabelName.OWNER, name);\n\nexport const severity = (name: string) => label(LabelName.SEVERITY, name);\n\nexport const layer = (name: string) => label(LabelName.LAYER, name);\n\nexport const tag = (name: string) => label(LabelName.TAG, name);\n\nexport const tags = (...tagsList: string[]) => {\n return callRuntimeMethod(\"labels\", ...tagsList.map((value) => ({ name: LabelName.TAG, value })));\n};\n", "export const uint8ArrayToBase64 = (data: unknown) => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (!u8arrayLike) {\n return data as string;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return btoa(String.fromCharCode.apply(null, data as number[]));\n};\n\nexport const normalizeAttachmentContentEncoding = (data: unknown, encoding: BufferEncoding): BufferEncoding => {\n // @ts-ignore\n const u8arrayLike = Array.isArray(data) || data.buffer;\n\n if (u8arrayLike) {\n return \"base64\";\n }\n\n return encoding;\n};\n\nexport const getSuitePath = (test: Mocha.Test): string[] => {\n const path: string[] = [];\n let currentSuite: Mocha.Suite | undefined = test.parent;\n\n while (currentSuite) {\n if (currentSuite.title) {\n path.unshift(currentSuite.title);\n }\n\n currentSuite = currentSuite.parent;\n }\n\n return path;\n};\n", "import { ContentType, Stage, Status } from \"allure-js-commons\";\nimport type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\nimport { getUnfinishedStepsMessages, hasStepMessage } from \"allure-js-commons/sdk\";\nimport type { TestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport { getGlobalTestRuntime, setGlobalTestRuntime } from \"allure-js-commons/sdk/runtime\";\nimport type { CypressRuntimeMessage } from \"./model.js\";\nimport { getSuitePath, normalizeAttachmentContentEncoding, uint8ArrayToBase64 } from \"./utils.js\";\n\nexport class AllureCypressTestRuntime implements TestRuntime {\n labels(...labels: Label[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n labels,\n },\n });\n }\n\n links(...links: Link[]) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n links,\n },\n });\n }\n\n parameter(name: string, value: string, options?: ParameterOptions) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n parameters: [\n {\n name,\n value,\n ...options,\n },\n ],\n },\n });\n }\n\n description(markdown: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n description: markdown,\n },\n });\n }\n\n descriptionHtml(html: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n descriptionHtml: html,\n },\n });\n }\n\n displayName(name: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n displayName: name,\n },\n });\n }\n\n historyId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n historyId: value,\n },\n });\n }\n\n testCaseId(value: string) {\n return this.sendMessageAsync({\n type: \"metadata\",\n data: {\n testCaseId: value,\n },\n });\n }\n\n attachment(name: string, content: Buffer | string, options: AttachmentOptions) {\n // @ts-ignore\n const attachmentRawContent: string | Uint8Array = content?.type === \"Buffer\" ? content.data : content;\n const encoding = content instanceof Buffer ? \"base64\" : \"utf-8\";\n const actualEncoding = normalizeAttachmentContentEncoding(attachmentRawContent, encoding);\n const attachmentContent = uint8ArrayToBase64(attachmentRawContent);\n\n return this.sendMessageAsync({\n type: \"attachment_content\",\n data: {\n name,\n content: attachmentContent,\n encoding: actualEncoding,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, \"encoding\">) {\n return this.sendMessageAsync({\n type: \"attachment_path\",\n data: {\n name,\n path,\n contentType: options.contentType,\n fileExtension: options.fileExtension,\n },\n });\n }\n\n step<T = void>(name: string, body: () => T | PromiseLike<T>) {\n return cy\n .wrap(null, { log: false })\n .then(() => {\n this.sendMessage({\n type: \"step_start\",\n data: { name, start: Date.now() },\n });\n\n return Cypress.Promise.resolve(body());\n })\n .then((result) => {\n return this.sendMessageAsync({\n type: \"step_stop\",\n data: {\n status: Status.PASSED,\n stage: Stage.FINISHED,\n stop: Date.now(),\n },\n }).then(() => result);\n });\n }\n\n stepDisplayName(name: string) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: { name },\n });\n }\n\n stepParameter(name: string, value: string, mode?: ParameterMode) {\n return this.sendMessageAsync({\n type: \"step_metadata\",\n data: {\n parameters: [{ name, value, mode }],\n },\n });\n }\n\n sendMessage(message: CypressRuntimeMessage) {\n const messages = Cypress.env(\"allureRuntimeMessages\") || [];\n\n Cypress.env(\"allureRuntimeMessages\", messages.concat(message));\n }\n\n sendMessageAsync(message: CypressRuntimeMessage): PromiseLike<void> {\n this.sendMessage(message);\n return Cypress.Promise.resolve();\n }\n}\n\nconst { EVENT_TEST_BEGIN, EVENT_TEST_FAIL, EVENT_TEST_PASS } = Mocha.Runner.constants;\n\nconst initializeAllure = () => {\n const initialized = Cypress.env(\"allureInitialized\") as boolean;\n\n if (initialized) {\n return;\n }\n\n // @ts-ignore\n Cypress.mocha\n .getRunner()\n .on(EVENT_TEST_BEGIN, (test: Mocha.Test) => {\n const testRuntime = new AllureCypressTestRuntime();\n\n Cypress.env(\"allureRuntimeMessages\", []);\n\n testRuntime.sendMessage({\n type: \"cypress_start\",\n data: {\n isInteractive: Cypress.config(\"isInteractive\"),\n absolutePath: Cypress.spec.absolute,\n specPath: getSuitePath(test).concat(test.title),\n filename: Cypress.spec.relative,\n start: Date.now(),\n },\n });\n\n setGlobalTestRuntime(testRuntime);\n })\n .on(EVENT_TEST_PASS, () => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n });\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: Status.PASSED,\n stop: Date.now(),\n },\n });\n })\n .on(EVENT_TEST_FAIL, (test: Mocha.Test, err: Error) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n testRuntime.sendMessage({\n type: \"cypress_end\",\n data: {\n stage: Stage.FINISHED,\n status: err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN,\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n stop: Date.now(),\n },\n });\n });\n\n Cypress.Screenshot.defaults({\n onAfterScreenshot: (_, details) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n\n return testRuntime.sendMessageAsync({\n type: \"attachment_path\",\n data: {\n path: details.path,\n name: details.name || \"Screenshot\",\n contentType: ContentType.PNG,\n },\n });\n },\n });\n\n Cypress.on(\"fail\", (err) => {\n const testRuntime = getGlobalTestRuntime() as AllureCypressTestRuntime;\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n const hasSteps = hasStepMessage(runtimeMessages as RuntimeMessage[]);\n\n // if there is no steps, don't handle the error\n if (!hasSteps) {\n throw err;\n }\n\n const unfinishedStepsMessages = getUnfinishedStepsMessages(runtimeMessages as RuntimeMessage[]);\n\n if (unfinishedStepsMessages.length === 0) {\n throw err;\n }\n\n const failedStepsStatus = err.constructor.name === \"AssertionError\" ? Status.FAILED : Status.BROKEN;\n\n unfinishedStepsMessages.forEach(() => {\n testRuntime.sendMessage({\n type: \"step_stop\",\n data: {\n stage: Stage.FINISHED,\n status: failedStepsStatus,\n stop: Date.now(),\n statusDetails: {\n message: err.message,\n trace: err.stack,\n },\n },\n });\n });\n\n throw err;\n });\n\n afterEach(() => {\n const runtimeMessages = Cypress.env(\"allureRuntimeMessages\") as CypressRuntimeMessage[];\n\n cy.task(\"allureReportTest\", runtimeMessages, { log: false });\n });\n\n Cypress.env(\"allureInitialized\", true);\n};\n\ninitializeAllure();\n\nexport * from \"allure-js-commons\";\n"],
5
+ "mappings": "AA8EA,IAAYA,EAAM,SAANA,EAAM,CAANA,OAAAA,EAAM,OAAA,SAANA,EAAM,OAAA,SAANA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E7B,YAAY,CACtB,KAAM,cACN,KAAM,CACJ,MAAOZ,EAAM,SACb,OAAQe,EAAI,YAAY,OAAS,iBAAmBhB,EAAO,OAASA,EAAO,OAC3E,cAAe,CACb,QAASgB,EAAI,QACb,MAAOA,EAAI,KACb,EACA,KAAM,KAAK,IAAI,CACjB,CACF,CAAC,CACH,CAAC,EAEH,QAAQ,WAAW,SAAS,CAC1B,kBAAmB,CAACC,EAAGC,IACDL,EAAqB,EAEtB,iBAAiB,CAClC,KAAM,kBACN,KAAM,CACJ,KAAMK,EAAQ,KACd,KAAMA,EAAQ,MAAQ,aACtB,YAAaC,EAAY,GAC3B,CACF,CAAC,CAEL,CAAC,EAED,QAAQ,GAAG,OAASH,GAAQ,CAC1B,IAAMN,EAAcG,EAAqB,EACnCC,EAAkB,QAAQ,IAAI,uBAAuB,EAI3D,GAAI,CAHaM,EAAeN,CAAmC,EAIjE,MAAME,EAGR,IAAMK,EAA0BN,EAA2BD,CAAmC,EAE9F,GAAIO,EAAwB,SAAW,EACrC,MAAML,EAGR,IAAMM,EAAoBN,EAAI,YAAY,OAAS,iBAAmBhB,EAAO,OAASA,EAAO,OAE7F,MAAAqB,EAAwB,QAAQ,IAAM,CACpCX,EAAY,YAAY,CACtB,KAAM,YACN,KAAM,CACJ,MAAOT,EAAM,SACb,OAAQqB,EACR,KAAM,KAAK,IAAI,EACf,cAAe,CACb,QAASN,EAAI,QACb,MAAOA,EAAI,KACb,CACF,CACF,CAAC,CACH,CAAC,EAEKA,CACR,CAAC,EAED,UAAU,IAAM,CACd,IAAMF,EAAkB,QAAQ,IAAI,uBAAuB,EAE3D,GAAG,KAAK,mBAAoBA,EAAiB,CAAE,IAAK,EAAM,CAAC,CAC7D,CAAC,EAED,QAAQ,IAAI,oBAAqB,EAAI,EACvC,EAEAN,GAAiB",
6
+ "names": ["Status", "StatusByPriority", "FAILED", "BROKEN", "PASSED", "SKIPPED", "Stage", "LabelName", "Severity", "ContentType", "LinkType", "NoopTestRuntime", "attachment", "_this", "_asyncToGenerator", "warning", "attachmentFromPath", "_this2", "description", "_this3", "descriptionHtml", "_this4", "displayName", "_this5", "historyId", "_this6", "labels", "_this7", "links", "_this8", "parameter", "_this9", "step", "name", "body", "_this10", "stepDisplayName", "_this11", "stepParameter", "_this12", "testCaseId", "_this13", "console", "log", "noopRuntime", "ALLURE_TEST_RUNTIME_KEY", "setGlobalTestRuntime", "runtime", "globalThis", "getGlobalTestRuntimeFunction", "getGlobalTestRuntime", "testRuntime", "_testRuntime", "noopRuntime", "getGlobalTestRuntimeWithAutoconfig", "_testRuntime2", "eval", "then", "_getGlobalTestRuntime", "_getGlobalTestRuntime2", "err", "console", "log", "allureIdRegexp", "_wrapRegExp", "id", "allureIdRegexpGlobal", "RegExp", "allureLabelRegexp", "name", "value", "allureLabelRegexpGlobal", "hasStepMessage", "messages", "some", "message", "type", "getStepsMessagesPair", "reduce", "acc", "push", "unfinishedStepIdx", "findLastIndex", "step", "length", "getUnfinishedStepsMessages", "grouppedStepsMessage", "filter", "isPromise", "obj", "then", "callRuntimeMethod", "method", "_len", "arguments", "length", "args", "Array", "_key", "runtime", "getGlobalTestRuntimeWithAutoconfig", "isPromise", "then", "testRuntime", "label", "name", "value", "labels", "_len2", "labelsList", "_key2", "link", "url", "type", "links", "_len3", "linksList", "_key3", "parameter", "options", "description", "markdown", "descriptionHtml", "html", "displayName", "historyId", "testCaseId", "attachment", "content", "opts", "contentType", "stepContext", "displayName", "name", "callRuntimeMethod", "parameter", "value", "mode", "step", "body", "issue", "url", "link", "LinkType", "ISSUE", "tms", "TMS", "allureId", "label", "LabelName", "ALLURE_ID", "epic", "EPIC", "feature", "FEATURE", "story", "STORY", "suite", "SUITE", "parentSuite", "PARENT_SUITE", "subSuite", "SUB_SUITE", "owner", "OWNER", "severity", "SEVERITY", "layer", "LAYER", "tag", "TAG", "tags", "_len4", "arguments", "length", "tagsList", "Array", "_key4", "map", "uint8ArrayToBase64", "data", "normalizeAttachmentContentEncoding", "encoding", "getSuitePath", "test", "path", "currentSuite", "AllureCypressTestRuntime", "labels", "links", "name", "value", "options", "markdown", "html", "content", "attachmentRawContent", "encoding", "actualEncoding", "normalizeAttachmentContentEncoding", "attachmentContent", "uint8ArrayToBase64", "path", "body", "result", "Status", "Stage", "mode", "message", "messages", "EVENT_TEST_BEGIN", "EVENT_TEST_FAIL", "EVENT_TEST_PASS", "initializeAllure", "test", "testRuntime", "getSuitePath", "setGlobalTestRuntime", "getGlobalTestRuntime", "runtimeMessages", "getUnfinishedStepsMessages", "err", "_", "details", "ContentType", "hasStepMessage", "unfinishedStepsMessages", "failedStepsStatus"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import type { Stage, Status, StatusDetails } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\n\nexport type CypressTestStartRuntimeMessage = {\n type: \"cypress_start\";\n data: {\n isInteractive: boolean;\n absolutePath: string;\n specPath: string[];\n filename: string;\n start: number;\n };\n};\n\nexport type CypressTestEndRuntimeMessage = {\n type: \"cypress_end\";\n data: {\n stage: Stage;\n status: Status;\n statusDetails?: StatusDetails;\n stop: number;\n };\n};\n\nexport type CypressScreenshotRuntimeMessage = {\n type: \"cypress_screenshot\";\n data: {\n path: string;\n name: string;\n };\n};\n\nexport type CypressRuntimeMessage =\n | RuntimeMessage\n | CypressScreenshotRuntimeMessage\n | CypressTestStartRuntimeMessage\n | CypressTestEndRuntimeMessage;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/model.ts"],"sourcesContent":["import type { Stage, Status, StatusDetails } from \"allure-js-commons\";\nimport type { RuntimeMessage } from \"allure-js-commons/sdk\";\n\nexport type CypressTestStartRuntimeMessage = {\n type: \"cypress_start\";\n data: {\n isInteractive: boolean;\n absolutePath: string;\n specPath: string[];\n filename: string;\n start: number;\n };\n};\n\nexport type CypressTestEndRuntimeMessage = {\n type: \"cypress_end\";\n data: {\n stage: Stage;\n status: Status;\n statusDetails?: StatusDetails;\n stop: number;\n };\n};\n\nexport type CypressRuntimeMessage = RuntimeMessage | CypressTestStartRuntimeMessage | CypressTestEndRuntimeMessage;\n"],"mappings":"","ignoreList":[]}
@@ -6,10 +6,9 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
6
6
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
8
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- import { readFileSync } from "node:fs";
10
9
  import { ContentType, LabelName, Stage } from "allure-js-commons";
11
10
  import { extractMetadataFromString } from "allure-js-commons/sdk";
12
- import { FileSystemWriter, ReporterRuntime, getSuitesLabels } from "allure-js-commons/sdk/reporter";
11
+ import { FileSystemWriter, ReporterRuntime, getSuiteLabels } from "allure-js-commons/sdk/reporter";
13
12
  export class AllureCypress {
14
13
  constructor(config) {
15
14
  _defineProperty(this, "runtime", void 0);
@@ -37,7 +36,7 @@ export class AllureCypress {
37
36
  if (startMessage.type !== "cypress_start" || endMessage.type !== "cypress_end") {
38
37
  throw new Error("INTERNAL ERROR: Invalid message sequence");
39
38
  }
40
- var suiteLabels = getSuitesLabels(startMessage.data.specPath.slice(0, -1));
39
+ var suiteLabels = getSuiteLabels(startMessage.data.specPath.slice(0, -1));
41
40
  var testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];
42
41
  var titleMetadata = extractMetadataFromString(testTitle);
43
42
  var testUuid = this.runtime.startTest({
@@ -58,24 +57,7 @@ export class AllureCypress {
58
57
  result.labels.push(...suiteLabels);
59
58
  result.labels.push(...titleMetadata.labels);
60
59
  this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {
61
- testUuid,
62
- customHandler: message => {
63
- var type = message.type;
64
- if (type === "cypress_screenshot") {
65
- var {
66
- name,
67
- path
68
- } = message.data;
69
- // False positive by eslint (path is string)
70
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
71
- var screenshotBody = readFileSync(path);
72
- this.runtime.writeAttachment({
73
- name,
74
- content: screenshotBody,
75
- contentType: ContentType.PNG
76
- }, testUuid);
77
- }
78
- }
60
+ testUuid
79
61
  });
80
62
  }, testUuid);
81
63
  this.runtime.updateTest(result => {
@@ -107,24 +89,12 @@ export class AllureCypress {
107
89
  if (!testUuids) {
108
90
  return;
109
91
  }
110
- var videoSource;
111
92
  for (var uuid of testUuids) {
112
- if (!cypressResult.video) {
113
- this.runtime.writeTest(uuid);
114
- continue;
115
- }
116
- if (!videoSource) {
117
- videoSource = this.runtime.writeAttachmentFromPath("Video", cypressResult.video, {
93
+ // TODO add it to spec scope to remove duplicates.
94
+ if (cypressResult.video) {
95
+ this.runtime.writeAttachmentFromPath("Video", cypressResult.video, {
118
96
  contentType: ContentType.MP4
119
97
  }, uuid);
120
- } else {
121
- this.runtime.updateTest(result => {
122
- result.attachments.push({
123
- name: "Video",
124
- source: videoSource,
125
- type: ContentType.MP4
126
- });
127
- }, uuid);
128
98
  }
129
99
  this.runtime.writeTest(uuid);
130
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.js","names":["readFileSync","ContentType","LabelName","Stage","extractMetadataFromString","FileSystemWriter","ReporterRuntime","getSuitesLabels","AllureCypress","constructor","config","_defineProperty","Map","_ref","resultsDir","rest","_objectWithoutProperties","_excluded","runtime","_objectSpread","writer","pushTestUuid","absolutePath","uuid","currentUuids","testsUuidsByCypressAbsolutePath","get","set","attachToCypress","on","allureReportTest","messages","startMessage","endMessage","length","type","Error","suiteLabels","data","specPath","slice","testTitle","titleMetadata","testUuid","startTest","name","cleanTitle","start","fullName","concat","filename","join","stage","RUNNING","updateTest","result","labels","push","LANGUAGE","value","FRAMEWORK","applyRuntimeMessages","customHandler","message","path","screenshotBody","writeAttachment","content","contentType","PNG","status","statusDetails","stopTest","stop","Date","now","isInteractive","writeTest","endSpec","spec","cypressResult","testUuids","absolute","delete","videoSource","video","writeAttachmentFromPath","MP4","attachments","source","allureCypress","allureConfig","allureCypressReporter"],"sources":["../../src/reporter.ts"],"sourcesContent":["import type Cypress from \"cypress\";\nimport { readFileSync } from \"node:fs\";\nimport { ContentType, LabelName, Stage } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport { FileSystemWriter, ReporterRuntime, getSuitesLabels } from \"allure-js-commons/sdk/reporter\";\nimport type { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from \"./model.js\";\n\nexport type AllureCypressConfig = {\n resultsDir?: string;\n links?: {\n type: string;\n urlTemplate: string;\n }[];\n};\n\nexport class AllureCypress {\n runtime: ReporterRuntime;\n\n testsUuidsByCypressAbsolutePath = new Map<string, string[]>();\n\n constructor(config?: AllureCypressConfig) {\n const { resultsDir = \"./allure-results\", ...rest } = config || {};\n\n this.runtime = new ReporterRuntime({\n writer: new FileSystemWriter({\n resultsDir,\n }),\n ...rest,\n });\n }\n\n private pushTestUuid(absolutePath: string, uuid: string) {\n const currentUuids = this.testsUuidsByCypressAbsolutePath.get(absolutePath) || [];\n\n this.testsUuidsByCypressAbsolutePath.set(absolutePath, [...currentUuids, uuid]);\n }\n\n attachToCypress(on: Cypress.PluginEvents) {\n on(\"task\", {\n allureReportTest: (messages: CypressRuntimeMessage[]) => {\n const startMessage = messages[0] as CypressTestStartRuntimeMessage;\n const endMessage = messages[messages.length - 1] as CypressTestEndRuntimeMessage;\n\n if (startMessage.type !== \"cypress_start\" || endMessage.type !== \"cypress_end\") {\n throw new Error(\"INTERNAL ERROR: Invalid message sequence\");\n }\n\n const suiteLabels = getSuitesLabels(startMessage.data.specPath.slice(0, -1));\n const testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];\n const titleMetadata = extractMetadataFromString(testTitle);\n const testUuid = this.runtime.startTest({\n name: titleMetadata.cleanTitle || testTitle,\n start: startMessage.data.start,\n fullName: `${startMessage.data.filename}#${startMessage.data.specPath.join(\" \")}`,\n stage: Stage.RUNNING,\n });\n\n this.runtime.updateTest((result) => {\n result.labels.push({\n name: LabelName.LANGUAGE,\n value: \"javascript\",\n });\n result.labels.push({\n name: LabelName.FRAMEWORK,\n value: \"cypress\",\n });\n result.labels.push(...suiteLabels);\n result.labels.push(...titleMetadata.labels);\n\n this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {\n testUuid,\n customHandler: (message) => {\n const type = message.type;\n\n if (type === \"cypress_screenshot\") {\n const { name, path } = message.data;\n // False positive by eslint (path is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const screenshotBody = readFileSync(path);\n\n this.runtime.writeAttachment(\n {\n name,\n content: screenshotBody,\n contentType: ContentType.PNG,\n },\n testUuid,\n );\n }\n },\n });\n }, testUuid);\n this.runtime.updateTest((result) => {\n result.stage = endMessage.data.stage;\n result.status = endMessage.data.status;\n\n if (!endMessage.data.statusDetails) {\n return;\n }\n\n result.statusDetails = endMessage.data.statusDetails;\n }, testUuid);\n\n this.runtime.stopTest({ uuid: testUuid, stop: Date.now() });\n\n if (startMessage.data.isInteractive) {\n this.runtime.writeTest(testUuid);\n } else {\n // False positive by eslint (testUuid is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n this.pushTestUuid(startMessage.data.absolutePath, testUuid);\n }\n\n return null;\n },\n });\n }\n\n endSpec(spec: Cypress.Spec, cypressResult: CypressCommandLine.RunResult) {\n const testUuids = this.testsUuidsByCypressAbsolutePath.get(spec.absolute);\n this.testsUuidsByCypressAbsolutePath.delete(spec.absolute);\n\n if (!testUuids) {\n return;\n }\n\n let videoSource: string | undefined;\n\n for (const uuid of testUuids) {\n if (!cypressResult.video) {\n this.runtime.writeTest(uuid);\n continue;\n }\n\n if (!videoSource) {\n videoSource = this.runtime.writeAttachmentFromPath(\n \"Video\",\n cypressResult.video,\n {\n contentType: ContentType.MP4,\n },\n uuid,\n );\n } else {\n this.runtime.updateTest((result) => {\n result.attachments.push({\n name: \"Video\",\n source: videoSource!,\n type: ContentType.MP4,\n });\n }, uuid);\n }\n\n this.runtime.writeTest(uuid);\n }\n }\n}\n\nexport const allureCypress = (on: Cypress.PluginEvents, allureConfig?: AllureCypressConfig) => {\n const allureCypressReporter = new AllureCypress(allureConfig);\n\n allureCypressReporter.attachToCypress(on);\n\n on(\"after:spec\", (spec, result) => {\n allureCypressReporter.endSpec(spec, result);\n });\n\n return allureCypressReporter;\n};\n"],"mappings":";;;;;;;;AACA,SAASA,YAAY,QAAQ,SAAS;AACtC,SAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,QAAQ,mBAAmB;AACjE,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,eAAe,QAAQ,gCAAgC;AAWnG,OAAO,MAAMC,aAAa,CAAC;EAKzBC,WAAWA,CAACC,MAA4B,EAAE;IAAAC,eAAA;IAAAA,eAAA,0CAFR,IAAIC,GAAG,CAAmB,CAAC;IAG3D,IAAAC,IAAA,GAAqDH,MAAM,IAAI,CAAC,CAAC;MAA3D;QAAEI,UAAU,GAAG;MAA4B,CAAC,GAAAD,IAAA;MAANE,IAAI,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;IAEhD,IAAI,CAACC,OAAO,GAAG,IAAIZ,eAAe,CAAAa,aAAA;MAChCC,MAAM,EAAE,IAAIf,gBAAgB,CAAC;QAC3BS;MACF,CAAC;IAAC,GACCC,IAAI,CACR,CAAC;EACJ;EAEQM,YAAYA,CAACC,YAAoB,EAAEC,IAAY,EAAE;IACvD,IAAMC,YAAY,GAAG,IAAI,CAACC,+BAA+B,CAACC,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C,MAAM;QACL,IAAI,CAACL,OAAO,CAACoC,UAAU,CAAEC,MAAM,IAAK;UAClCA,MAAM,CAACiC,WAAW,CAAC/B,IAAI,CAAC;YACtBZ,IAAI,EAAE,OAAO;YACb4C,MAAM,EAAEL,WAAY;YACpBjD,IAAI,EAAElC,WAAW,CAACsF;UACpB,CAAC,CAAC;QACJ,CAAC,EAAEhE,IAAI,CAAC;MACV;MAEA,IAAI,CAACL,OAAO,CAAC2D,SAAS,CAACtD,IAAI,CAAC;IAC9B;EACF;AACF;AAEA,OAAO,IAAMmE,aAAa,GAAGA,CAAC7D,EAAwB,EAAE8D,YAAkC,KAAK;EAC7F,IAAMC,qBAAqB,GAAG,IAAIpF,aAAa,CAACmF,YAAY,CAAC;EAE7DC,qBAAqB,CAAChE,eAAe,CAACC,EAAE,CAAC;EAEzCA,EAAE,CAAC,YAAY,EAAE,CAACkD,IAAI,EAAExB,MAAM,KAAK;IACjCqC,qBAAqB,CAACd,OAAO,CAACC,IAAI,EAAExB,MAAM,CAAC;EAC7C,CAAC,CAAC;EAEF,OAAOqC,qBAAqB;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"reporter.js","names":["ContentType","LabelName","Stage","extractMetadataFromString","FileSystemWriter","ReporterRuntime","getSuiteLabels","AllureCypress","constructor","config","_defineProperty","Map","_ref","resultsDir","rest","_objectWithoutProperties","_excluded","runtime","_objectSpread","writer","pushTestUuid","absolutePath","uuid","currentUuids","testsUuidsByCypressAbsolutePath","get","set","attachToCypress","on","allureReportTest","messages","startMessage","endMessage","length","type","Error","suiteLabels","data","specPath","slice","testTitle","titleMetadata","testUuid","startTest","name","cleanTitle","start","fullName","concat","filename","join","stage","RUNNING","updateTest","result","labels","push","LANGUAGE","value","FRAMEWORK","applyRuntimeMessages","status","statusDetails","stopTest","stop","Date","now","isInteractive","writeTest","endSpec","spec","cypressResult","testUuids","absolute","delete","video","writeAttachmentFromPath","contentType","MP4","allureCypress","allureConfig","allureCypressReporter"],"sources":["../../src/reporter.ts"],"sourcesContent":["import type Cypress from \"cypress\";\nimport { ContentType, LabelName, Stage } from \"allure-js-commons\";\nimport { extractMetadataFromString } from \"allure-js-commons/sdk\";\nimport { FileSystemWriter, ReporterRuntime, getSuiteLabels } from \"allure-js-commons/sdk/reporter\";\nimport type { CypressRuntimeMessage, CypressTestEndRuntimeMessage, CypressTestStartRuntimeMessage } from \"./model.js\";\n\nexport type AllureCypressConfig = {\n resultsDir?: string;\n links?: {\n type: string;\n urlTemplate: string;\n }[];\n};\n\nexport class AllureCypress {\n runtime: ReporterRuntime;\n\n testsUuidsByCypressAbsolutePath = new Map<string, string[]>();\n\n constructor(config?: AllureCypressConfig) {\n const { resultsDir = \"./allure-results\", ...rest } = config || {};\n\n this.runtime = new ReporterRuntime({\n writer: new FileSystemWriter({\n resultsDir,\n }),\n ...rest,\n });\n }\n\n private pushTestUuid(absolutePath: string, uuid: string) {\n const currentUuids = this.testsUuidsByCypressAbsolutePath.get(absolutePath) || [];\n\n this.testsUuidsByCypressAbsolutePath.set(absolutePath, [...currentUuids, uuid]);\n }\n\n attachToCypress(on: Cypress.PluginEvents) {\n on(\"task\", {\n allureReportTest: (messages: CypressRuntimeMessage[]) => {\n const startMessage = messages[0] as CypressTestStartRuntimeMessage;\n const endMessage = messages[messages.length - 1] as CypressTestEndRuntimeMessage;\n\n if (startMessage.type !== \"cypress_start\" || endMessage.type !== \"cypress_end\") {\n throw new Error(\"INTERNAL ERROR: Invalid message sequence\");\n }\n\n const suiteLabels = getSuiteLabels(startMessage.data.specPath.slice(0, -1));\n const testTitle = startMessage.data.specPath[startMessage.data.specPath.length - 1];\n const titleMetadata = extractMetadataFromString(testTitle);\n const testUuid = this.runtime.startTest({\n name: titleMetadata.cleanTitle || testTitle,\n start: startMessage.data.start,\n fullName: `${startMessage.data.filename}#${startMessage.data.specPath.join(\" \")}`,\n stage: Stage.RUNNING,\n });\n\n this.runtime.updateTest((result) => {\n result.labels.push({\n name: LabelName.LANGUAGE,\n value: \"javascript\",\n });\n result.labels.push({\n name: LabelName.FRAMEWORK,\n value: \"cypress\",\n });\n result.labels.push(...suiteLabels);\n result.labels.push(...titleMetadata.labels);\n\n this.runtime.applyRuntimeMessages(messages.slice(1, messages.length - 1), {\n testUuid,\n });\n }, testUuid);\n this.runtime.updateTest((result) => {\n result.stage = endMessage.data.stage;\n result.status = endMessage.data.status;\n\n if (!endMessage.data.statusDetails) {\n return;\n }\n\n result.statusDetails = endMessage.data.statusDetails;\n }, testUuid);\n\n this.runtime.stopTest({ uuid: testUuid, stop: Date.now() });\n\n if (startMessage.data.isInteractive) {\n this.runtime.writeTest(testUuid);\n } else {\n // False positive by eslint (testUuid is string)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n this.pushTestUuid(startMessage.data.absolutePath, testUuid);\n }\n\n return null;\n },\n });\n }\n\n endSpec(spec: Cypress.Spec, cypressResult: CypressCommandLine.RunResult) {\n const testUuids = this.testsUuidsByCypressAbsolutePath.get(spec.absolute);\n this.testsUuidsByCypressAbsolutePath.delete(spec.absolute);\n\n if (!testUuids) {\n return;\n }\n\n for (const uuid of testUuids) {\n // TODO add it to spec scope to remove duplicates.\n if (cypressResult.video) {\n this.runtime.writeAttachmentFromPath(\n \"Video\",\n cypressResult.video,\n {\n contentType: ContentType.MP4,\n },\n uuid,\n );\n }\n\n this.runtime.writeTest(uuid);\n }\n }\n}\n\nexport const allureCypress = (on: Cypress.PluginEvents, allureConfig?: AllureCypressConfig) => {\n const allureCypressReporter = new AllureCypress(allureConfig);\n\n allureCypressReporter.attachToCypress(on);\n\n on(\"after:spec\", (spec, result) => {\n allureCypressReporter.endSpec(spec, result);\n });\n\n return allureCypressReporter;\n};\n"],"mappings":";;;;;;;;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,KAAK,QAAQ,mBAAmB;AACjE,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,cAAc,QAAQ,gCAAgC;AAWlG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CAAC;IAC9B;EACF;AACF;AAEA,OAAO,IAAMyD,aAAa,GAAGA,CAACnD,EAAwB,EAAEoD,YAAkC,KAAK;EAC7F,IAAMC,qBAAqB,GAAG,IAAI1E,aAAa,CAACyE,YAAY,CAAC;EAE7DC,qBAAqB,CAACtD,eAAe,CAACC,EAAE,CAAC;EAEzCA,EAAE,CAAC,YAAY,EAAE,CAAC0C,IAAI,EAAEhB,MAAM,KAAK;IACjC2B,qBAAqB,CAACZ,OAAO,CAACC,IAAI,EAAEhB,MAAM,CAAC;EAC7C,CAAC,CAAC;EAEF,OAAO2B,qBAAqB;AAC9B,CAAC","ignoreList":[]}
@@ -1,11 +1,9 @@
1
1
  /// <reference types="node" />
2
- import type { ContentType, Label, LabelName, Link, LinkType, ParameterMode, ParameterOptions } from "allure-js-commons";
2
+ import type { AttachmentOptions, Label, Link, ParameterMode, ParameterOptions } from "allure-js-commons";
3
3
  import type { TestRuntime } from "allure-js-commons/sdk/runtime";
4
4
  import type { CypressRuntimeMessage } from "./model.js";
5
5
  export declare class AllureCypressTestRuntime implements TestRuntime {
6
- label(name: LabelName | string, value: string): PromiseLike<void>;
7
6
  labels(...labels: Label[]): PromiseLike<void>;
8
- link(url: string, type?: LinkType | string, name?: string): PromiseLike<void>;
9
7
  links(...links: Link[]): PromiseLike<void>;
10
8
  parameter(name: string, value: string, options?: ParameterOptions): PromiseLike<void>;
11
9
  description(markdown: string): PromiseLike<void>;
@@ -13,7 +11,8 @@ export declare class AllureCypressTestRuntime implements TestRuntime {
13
11
  displayName(name: string): PromiseLike<void>;
14
12
  historyId(value: string): PromiseLike<void>;
15
13
  testCaseId(value: string): PromiseLike<void>;
16
- attachment(name: string, content: Buffer | string, type: string | ContentType): PromiseLike<void>;
14
+ attachment(name: string, content: Buffer | string, options: AttachmentOptions): PromiseLike<void>;
15
+ attachmentFromPath(name: string, path: string, options: Omit<AttachmentOptions, "encoding">): PromiseLike<void>;
17
16
  step<T = void>(name: string, body: () => T | PromiseLike<T>): Cypress.Chainable<T>;
18
17
  stepDisplayName(name: string): PromiseLike<void>;
19
18
  stepParameter(name: string, value: string, mode?: ParameterMode): PromiseLike<void>;
@@ -19,11 +19,4 @@ export type CypressTestEndRuntimeMessage = {
19
19
  stop: number;
20
20
  };
21
21
  };
22
- export type CypressScreenshotRuntimeMessage = {
23
- type: "cypress_screenshot";
24
- data: {
25
- path: string;
26
- name: string;
27
- };
28
- };
29
- export type CypressRuntimeMessage = RuntimeMessage | CypressScreenshotRuntimeMessage | CypressTestStartRuntimeMessage | CypressTestEndRuntimeMessage;
22
+ export type CypressRuntimeMessage = RuntimeMessage | CypressTestStartRuntimeMessage | CypressTestEndRuntimeMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allure-cypress",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.3",
4
4
  "description": "Allure Cypress integration",
5
5
  "keywords": [
6
6
  "cypress",
@@ -46,14 +46,14 @@
46
46
  "compile:cjs-node": "babel --config-file ./babel.cjs.json ./src --ignore './src/index.ts' --out-dir ./dist/cjs --extensions '.ts' --source-maps",
47
47
  "compile:esm-browser": "esbuild ./src/index.ts --bundle --minify --sourcemap --format=esm --outfile=./dist/esm/index.js --external:allure-playwright",
48
48
  "compile:cjs-browser": "esbuild ./src/index.ts --bundle --minify --sourcemap --format=cjs --outfile=./dist/cjs/index.js --external:allure-playwright",
49
- "compile:types": "tsc --declaration --emitDeclarationOnly",
49
+ "compile:types": "tsc",
50
50
  "compile:fixup": "node ./scripts/fixup.mjs",
51
51
  "lint": "eslint ./src ./test --ext .ts",
52
52
  "lint:fix": "eslint ./src ./test --ext .ts --fix",
53
- "test": "vitest run --dir ./test/spec"
53
+ "test": "vitest run"
54
54
  },
55
55
  "dependencies": {
56
- "allure-js-commons": "3.0.0-beta.1"
56
+ "allure-js-commons": "3.0.0-beta.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/cli": "^7.24.6",
@@ -69,7 +69,7 @@
69
69
  "@types/node": "^20.6.3",
70
70
  "@typescript-eslint/eslint-plugin": "^7.0.0",
71
71
  "@typescript-eslint/parser": "^7.0.0",
72
- "allure-vitest": "3.0.0-beta.1",
72
+ "allure-vitest": "3.0.0-beta.3",
73
73
  "babel-plugin-add-module-exports": "^1.0.4",
74
74
  "cypress": "^13.6.0",
75
75
  "enquirer": "^2.3.6",
File without changes
File without changes