New:Socket for Asana Is Now Available.Learn more
Get Started

@currents/playwright

Package Overview
Dependencies
Maintainers
3
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@currents/playwright - npm Package Compare versions

Comparing version
1.23.3
to
2.0.0-alpha.0
+183
dist/config-B9q-aV6V.d.ts
/**
* The last known status of the current orchestration session, contains results from all the machines participating in the orchestration.
*
* @example
* When all the tests are completed, the status will look like this:
* ```json
* {
* specs: {
* overall: 10,
* claimed: 5,
* completed: 3,
* passes: 2,
* failures: 1,
* },
* tests: {
* overall: 100,
* failures: 10,
* passes: 80,
* ignored: 5,
* flaky: 5,
* },
* }
* ```
*
*
* @example
* If no results were reported, all the value are `-1`
*
* ```json
* {
* specs: {
* overall: -1,
* claimed: -1,
* completed: -1,
* passes: -1,
* failures: -1,
* },
* tests: {
* overall: -1,
* failures: -1,
* passes: -1,
* ignored: -1,
* flaky: -1,
* },
* }
* ```
*/
type OrchestrationStatus = {
specs: {
overall: number;
claimed: number;
completed: number;
passes: number;
failures: number;
};
tests: {
overall: number;
failures: number;
passes: number;
ignored: number;
flaky: number;
};
};
type ConsoleOutputPreset = "none" | "summary" | "detailed";
declare const ConsoleOutputPreset: {
readonly None: "none";
readonly Summary: "summary";
readonly Detailed: "detailed";
};
type ResetSignal = "SIGUSR1" | "SIGUSR2";
type CurrentsConfigOrchestration = {
/**
* OS signal to use for resetting the currently running spec files.
*/
resetSignal?: ResetSignal;
/**
* Prevents injecting Currents reporter when running orchestrated tasks. Requires manually adding Currents reporter to Playwright configuration.
*/
skipReporterInjection?: boolean;
/**
* An optional callback that will be called when the orchestration completed. * @see {@link OrchestrationStatus} for the returned data structure
*
* @param result the last knowns orchestration status
* @returns
*/
onFinish?: (status: OrchestrationStatus) => Promise<void>;
/**
* Configuration for setting the batch size for the orchestration. If provided batched orchestration will be executed.
*/
batchSize?: "auto" | number;
/**
* Path where `pwc-p discover` writes its discovery output, and where
* `pwc-p run` reads it from when `--pwc-discovery-output` is not provided on the CLI.
*/
discoveryOutputFile?: string;
};
type CurrentsConfigCoverage = {
/**
* The projects for which coverage will be collected.
*
* If set to `true`, coverage will be collected for all projects.
* If set to an array of project names, coverage will be collected only for those specified projects.
* If set to an empty array, coverage will be collected for all projects.
* If not set or set to `false`, coverage collection will be disabled.
*/
projects?: boolean | string[];
/**
* The directory where the coverage report will be read from.
*/
dir?: string;
};
type CurrentsConfig = {
/**
* The id of the build to record the test run. Read more: https://docs.currents.dev/guides/ci-build-id
*/
ciBuildId?: string;
/**
* The id of the project to record the test run.
*/
projectId: string;
/**
* The record key to be used to record the results on the remote dashboard. Read more: https://docs.currents.dev/guides/record-key
*/
recordKey: string;
/**
* A list of tags to be added to the test run.
*/
tag?: string[];
/**
* experimental - enable reporting test-level results
*/
enableTestResults?: boolean;
/**
* remove tags from test names, for example `Test name @smoke` becomes `Test name`
*/
removeTitleTags?: boolean;
/**
* Disable reporting tags defined on the test or suite level,
* or extracted from the test title
*/
disableTestTags?: boolean;
/** @deprecated - use disableTestTags instead */
disableTitleTags?: boolean;
/**
* Abort the run after the specified number of failed tests. Overrides the default Currents Project settings.
* If set, must be a positive integer or "false" to disable
*/
cancelAfterFailures?: number | false;
/**
* Path to the full test suite file for orchestration and reporting
*/
testSuiteFile?: string;
/**
* Unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId
*/
machineId?: string;
/**
* The orchestration id to be used to record the results on the remote dashboard. See: https://docs.currents.dev/?q=orchestrationId
*/
orchestrationId?: string;
/**
* Path to the file where the run summary output will be written.
* See: https://docs.currents.dev/?q=outputFile
*/
outputFile?: string;
/**
* Configuration for Currents Orchestration
*/
orchestration?: CurrentsConfigOrchestration;
/**
* Configuration for Currents Coverage
*/
coverage?: CurrentsConfigCoverage;
/**
* Reporter console output: "none" (no stdout), "summary" (intro, one line per test, summary), "detailed" (full per-test output).
* Extensible for future options (e.g. dot-style reporter).
*/
consoleOutput?: ConsoleOutputPreset;
};
export { type CurrentsConfig as C, type OrchestrationStatus as O, ConsoleOutputPreset as a };
+0
-5
#! /usr/bin/env node
declare function runScript(): Promise<{
exitCode: number;
}>;
export { runScript };
+82
-42
#! /usr/bin/env node
"use strict";var _o=Object.create;var z=Object.defineProperty;var No=Object.getOwnPropertyDescriptor;var Do=Object.getOwnPropertyNames;var Ao=Object.getPrototypeOf,Fo=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var de=(e,t)=>{for(var r in t)z(e,r,{get:t[r],enumerable:!0})},Ot=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Do(t))!Fo.call(e,s)&&s!==r&&z(e,s,{get:()=>t[s],enumerable:!(o=No(t,s))||o.enumerable});return e};var c=(e,t,r)=>(r=e!=null?_o(Ao(e)):{},Ot(t||!e||!e.__esModule?z(r,"default",{value:e,enumerable:!0}):r,e)),Uo=e=>Ot(z({},"__esModule",{value:!0}),e);var n=u(()=>{"use strict"});var H,Tt=u(()=>{"use strict";n();H=class extends Error{}});var It,Et=u(()=>{"use strict";n();It={guide:{ciBuildId:"https://docs.currents.dev/guides/ci-build-id",integration:"https://docs.currents.dev/integration-with-playwright/currents-playwright"}}});function vt(e){Lo.push(e)}var Lo,ge=u(()=>{"use strict";n();Lo=[]});function _t(e){return{...e&&Object.prototype.hasOwnProperty.call(kt,e)?kt[e]:Pt}}var I,jo,$o,Pt,kt,J=u(()=>{"use strict";n();I={None:"none",Summary:"summary",Detailed:"detailed"},jo={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},$o={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},Pt={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},kt={[I.None]:jo,[I.Summary]:$o,[I.Detailed]:Pt}});var Nt,Dt,At=u(()=>{"use strict";n();Nt=[],Dt=[]});function Ft(e){fe=e}function Mo(e){return fe?!!fe[e]:!0}function U(e,t){vt(t),Mo(e)&&console.log(t)}var w,K,fe,y,d,x,V,Wo,L,Bn,qn,Gn,zn,Hn,Jn,Kn,Vn,Xn,p,Yn,Ut=u(()=>{"use strict";n();w=c(require("chalk")),K=c(require("util"));J();h();ge();At();fe=null;y=(...e)=>{U("introAndSummary",K.default.format(...e))},d=(...e)=>{let t=K.default.format(...e);Dt.push(t),l("WARNING: ",t),U("warningsAndErrors",w.default.bgYellow.black(" WARNING ")+" "+t)},x=(...e)=>{let t=K.default.format(...e);Nt.push(t),l("ERROR: ",t),U("warningsAndErrors",w.default.bgRed.white(" ERROR ")+" "+t)},V=()=>{U("introAndSummary",`
`+Wo()+`
`)},Wo=()=>w.default.dim(Array(64).fill("=").join("")),L=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&U("introAndSummary",Array(t).fill("").join(`
`))},Bn=w.default.cyan,qn=w.default.blueBright,Gn=w.default.red,zn=w.default.yellow,Hn=w.default.green,Jn=w.default.gray,Kn=w.default.white,Vn=w.default.black,Xn=w.default.magenta,p=w.default.dim,Yn=w.default.bold});var S=u(()=>{"use strict";n();ge();Ut()});function X(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new me.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}function jt(e){if(!e)return;let t=["SIGUSR1","SIGUSR2"];if(!t.includes(e.toUpperCase().trim()))throw new me.CommanderError(255,"Invalid argument provided.","--pwc-reset-signal must be one of ("+t.join(", ")+"), provided: "+e);return e.toUpperCase().trim()}var me,he=u(()=>{"use strict";n();me=require("commander")});function R(e){return b[e]?.env}function $t(e){return b[e].cli}function Mt(e){return b[e].name}function Wt(){return{projectId:process.env[b.projectId.env],recordKey:process.env[b.recordKey.env],ciBuildId:process.env[b.ciBuildId.env],tag:process.env[b.tag.env]?process.env[b.tag.env]?.split(",").map(e=>e.trim()):void 0,cancelAfterFailures:X(process.env[b.cancelAfterFailures.env]),disableTestTags:process.env[b.disableTestTags.env]||process.env[b.disableTitleTags.env],consoleOutput:process.env[b.consoleOutput.env],testSuiteFile:process.env[b.testSuiteFile.env],machineId:process.env[b.machineId.env],orchestrationId:process.env[b.orchestrationId.env]}}var b,ye=u(()=>{"use strict";n();he();b={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"}}});function Gt(e){return{ciBuildId:e.ciBuildId,projectId:e.projectId,recordKey:e.key,tag:e.tag,removeTitleTags:e.pwcRemoveTitleTags,cancelAfterFailures:e.pwcCancelAfterFailures,disableTestTags:e.pwcDisableTestTags||e.pwcDisableTitleTags,testSuiteFile:e.pwcTestSuiteFile,machineId:e.pwcMachineId,outputFile:e.pwcOutputFile,consoleOutput:e.pwcConsoleOutput,pwcConfigPath:e.pwcConfig,orchestration:{resetSignal:e.pwcResetSignal,skipReporterInjection:e.pwcSkipReporterInjection,batchSize:e.pwcBatchSize},coverage:{projects:e.pwcCoverage,dir:e.pwcCoverageDir}}}function Y(){if(Ce)return Ce;if(process.env.CURRENTS_PWC_CLI_CONFIG_PATH)try{let e=JSON.parse(qt.default.readFileSync(process.env.CURRENTS_PWC_CLI_CONFIG_PATH).toString());return Bt("Options from serialized CLI config file: %o",e),Ce=e,e}catch(e){return Bt("Could not read CLI config file: %o",e),{}}return{}}var qt,Bt,Ce,we=u(()=>{"use strict";n();qt=c(require("fs"));h();Bt=l.extend("cli-options-serializer");Ce=null});function zt(e,t,r={validationFn:qo}){be("reporter options: %o",e),be("config file options: %o",t);let o={...O(xe),...O(t),...O(e),...O(Y()),...O(Wt()),orchestration:{...O(xe.orchestration),...O(t?.orchestration),...O(e?.orchestration),...O(Y().orchestration)},coverage:{...O(xe.coverage),...O(t?.coverage),...O(e?.coverage),...O(Y().coverage)}};o.disableTitleTags!==void 0&&(o.disableTestTags=o.disableTestTags||o.disableTitleTags),r.validationFn(o),Z=o,Ft(_t(Z?.consoleOutput)),be("resolved currents config: %o",Z)}function qo(e){Bo.forEach(t=>{if(!e[t])throw x(`${Mt(t)} is required for Currents Reporter. Use the following methods:
- environment variable: ${p(R(t))}
- CLI flag: ${p($t(t))}
- reporter configuration option ${p(t)} in ${p("playwright.config.ts")}
"use strict";var en=Object.create;var Oe=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var p=(e,t)=>()=>(e&&(t=e(e=0)),t);var At=(e,t)=>{for(var r in t)Oe(e,r,{get:t[r],enumerable:!0})},sn=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rn(t))!nn.call(e,i)&&i!==r&&Oe(e,i,{get:()=>t[i],enumerable:!(o=tn(t,i))||o.enumerable});return e};var u=(e,t,r)=>(r=e!=null?en(on(e)):{},sn(t||!e||!e.__esModule?Oe(r,"default",{value:e,enumerable:!0}):r,e));var n=p(()=>{"use strict"});var Z,Dt=p(()=>{"use strict";n();Z=class extends Error{}});var Ft,Ut=p(()=>{"use strict";n();Ft={guide:{ciBuildId:"https://docs.currents.dev/guides/ci-build-id",integration:"https://docs.currents.dev/integration-with-playwright/currents-playwright"}}});function Lt(e){an.push(e)}var an,be=p(()=>{"use strict";n();an=[]});function Mt(e){return{...e&&Object.prototype.hasOwnProperty.call($t,e)?$t[e]:jt}}var E,cn,un,jt,$t,Q=p(()=>{"use strict";n();E={None:"none",Summary:"summary",Detailed:"detailed"},cn={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},un={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},jt={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},$t={[E.None]:cn,[E.Summary]:un,[E.Detailed]:jt}});var Wt,Bt,qt=p(()=>{"use strict";n();Wt=[],Bt=[]});function Se(e){ve=e}function pn(e){return ve?!!ve[e]:!0}function D(e,t){Lt(t),pn(e)&&console.log(t)}var x,j,ve,f,g,Ht,h,ee,ln,M,hs,ws,ys,Cs,xs,Os,bs,vs,Ss,s,Rs,zt=p(()=>{"use strict";n();x=u(require("chalk")),j=u(require("util"));Q();y();be();qt();ve=null;f=(...e)=>{D("introAndSummary",j.default.format(...e))},g=(...e)=>{let t=j.default.format(...e);Bt.push(t),l("WARNING: ",t),D("warningsAndErrors",x.default.bgYellow.black(" WARNING ")+" "+t)},Ht=(...e)=>{D("introAndSummary",x.default.green.bold(j.default.format(...e)))},h=(...e)=>{let t=j.default.format(...e);Wt.push(t),l("ERROR: ",t),D("warningsAndErrors",x.default.bgRed.white(" ERROR ")+" "+t)},ee=()=>{D("introAndSummary",`
`+ln()+`
`)},ln=()=>x.default.dim(Array(64).fill("=").join("")),M=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&D("introAndSummary",Array(t).fill("").join(`
`))},hs=x.default.cyan,ws=x.default.blueBright,ys=x.default.red,Cs=x.default.yellow,xs=x.default.green,Os=x.default.gray,bs=x.default.white,vs=x.default.black,Ss=x.default.magenta,s=x.default.dim,Rs=x.default.bold});var v=p(()=>{"use strict";n();be();zt()});function te(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new Re.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}function Jt(e){if(!e)return;let t=["SIGUSR1","SIGUSR2"];if(!t.includes(e.toUpperCase().trim()))throw new Re.CommanderError(255,"Invalid argument provided.","--pwc-reset-signal must be one of ("+t.join(", ")+"), provided: "+e);return e.toUpperCase().trim()}var Re,Te=p(()=>{"use strict";n();Re=require("commander")});function b(e){return C[e]?.env}function Vt(e){return C[e].cli}function Kt(e){return C[e].name}function Ee(){return{projectId:process.env[C.projectId.env],recordKey:process.env[C.recordKey.env],ciBuildId:process.env[C.ciBuildId.env],tag:process.env[C.tag.env]?process.env[C.tag.env]?.split(",").map(e=>e.trim()):void 0,cancelAfterFailures:te(process.env[C.cancelAfterFailures.env]),disableTestTags:process.env[C.disableTestTags.env]||process.env[C.disableTitleTags.env],consoleOutput:process.env[C.consoleOutput.env],testSuiteFile:process.env[C.testSuiteFile.env],machineId:process.env[C.machineId.env],orchestrationId:process.env[C.orchestrationId.env],outputFile:process.env[C.outputFile.env],orchestration:{discoveryOutputFile:process.env[C.discoveryOutputFile.env]}}}var C,Ie=p(()=>{"use strict";n();Te();C={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"},discoveryOutputFile:{name:"Discovery Output File",env:"CURRENTS_DISCOVERY_OUTPUT_FILE",cli:"--pwc-discovery-output"}}});function re(e){return{ciBuildId:e.ciBuildId,projectId:e.projectId,recordKey:e.key,tag:e.tag,removeTitleTags:e.pwcRemoveTitleTags,cancelAfterFailures:e.pwcCancelAfterFailures,disableTestTags:e.pwcDisableTestTags||e.pwcDisableTitleTags,testSuiteFile:e.pwcTestSuiteFile,machineId:e.pwcMachineId,outputFile:e.pwcOutputFile,consoleOutput:e.pwcConsoleOutput,pwcConfigPath:e.pwcConfig,orchestration:{resetSignal:e.pwcResetSignal,skipReporterInjection:e.pwcSkipReporterInjection,batchSize:e.pwcBatchSize,discoveryOutputFile:e.pwcDiscoveryOutput},coverage:{projects:e.pwcCoverage,dir:e.pwcCoverageDir}}}function oe(){if(Pe)return Pe;if(process.env.CURRENTS_PWC_CLI_CONFIG_PATH)try{let e=JSON.parse(Yt.default.readFileSync(process.env.CURRENTS_PWC_CLI_CONFIG_PATH).toString());return Xt("Options from serialized CLI config file: %o",e),Pe=e,e}catch(e){return Xt("Could not read CLI config file: %o",e),{}}return{}}var Yt,Xt,Pe,ke=p(()=>{"use strict";n();Yt=u(require("fs"));y();Xt=l.extend("cli-options-serializer");Pe=null});function ne(e,t,r={validationFn:gn}){_e("reporter options: %o",e),_e("config file options: %o",t);let o={...S(Ne),...S(t),...S(e),...S(oe()),...S(Ee()),orchestration:{...S(Ne.orchestration),...S(t?.orchestration),...S(e?.orchestration),...S(oe().orchestration),...S(Ee().orchestration)},coverage:{...S(Ne.coverage),...S(t?.coverage),...S(e?.coverage),...S(oe().coverage)}};o.disableTitleTags!==void 0&&(o.disableTestTags=o.disableTestTags||o.disableTitleTags),r.validationFn(o),W=o,Se(Mt(W?.consoleOutput)),_e("resolved currents config: %o",W)}function gn(e){dn.forEach(t=>{if(!e[t])throw h(`${Kt(t)} is required for Currents Reporter. Use the following methods:
- environment variable: ${s(b(t))}
- CLI flag: ${s(Vt(t))}
- reporter configuration option ${s(t)} in ${s("playwright.config.ts")}
\u{1F4D6} ${It.guide.integration}`),new H("Missing required config variable")})}function O(e){return Object.entries(e??{}).reduce((t,[r,o])=>o===void 0?t:{...t,[r]:o},{})}function E(){return Z}var be,Bo,xe,Z,Re=u(()=>{"use strict";n();h();Tt();Et();S();J();ye();we();J();be=l.extend("config"),Bo=["projectId","recordKey"],xe={removeTitleTags:!1,disableTestTags:!1,consoleOutput:I.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},Z=null});function Ht(e,t){return e.reduceRight(([r,o],s)=>(o.includes(s,-1)?o.splice(o.lastIndexOf(s)):r.unshift(s),[r,o]),[[],[...t]])[0]}function Jt(e,t){let r=new Set(t),o=[];for(let s=0;s<e.length;s++){let i=e[s],g=i.indexOf("="),f=g!==-1?i.slice(0,g):i;r.has(f)?g===-1&&s+1<e.length&&s++:o.push(i)}return o}var Go,Kt=u(()=>{"use strict";n();Go=require("lodash");S()});var v=u(()=>{"use strict";n();Re();ye();we();Kt()});var Xt,Vt=u(()=>{Xt={name:"@currents/playwright",version:"1.23.3",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/randomstring":"^1.3.0","@types/regexp.escape":"^2.0.0","@types/shelljs":"^0.10.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.13.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsconfig:"*",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4",wtfnode:"^0.10.1"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.0.0","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var Q,Se=u(()=>{"use strict";n();Vt();Q=Xt.version});function te(e={}){let t=Yt.default.create(e);return t.interceptors.request.use(r=>{let o={...r},s=t.getUri(r),i=Qt.default.getProxyForUrl(s);return i&&(Ho("Using HTTP proxy %s for %s ",i,s),o.proxy=!1,o.httpsAgent=Jo(i)),o}),t}function Jo(e){return ee||(ee=new Zt.HttpsProxyAgent(e),ee)}var Yt,Zt,Qt,Ho,ee,Oe=u(()=>{"use strict";n();Yt=c(require("axios")),Zt=require("https-proxy-agent"),Qt=c(require("proxy-from-env"));h();Ho=l.extend("axios");ee=null});var Te,er,tr=u(()=>{"use strict";n();Te=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",er=()=>3e4});var Ko,Ws,Ie=u(()=>{"use strict";n();Ko=c(require("ws"));h();Ws=l.extend("ws")});var rr,Xs,or,nr=u(()=>{"use strict";n();rr=c(require("events"));Re();h();Ie();Ee();Xs=l.extend("pubsub"),or=new rr.default});var ve,ir,sr,ar,ur=u(()=>{"use strict";n();S();nr();ve={cancellationReason:null},ir=e=>{ve.cancellationReason||(ve.cancellationReason=e)},sr=()=>ve.cancellationReason,ar=({showWarning:e=!0}={})=>{let t=sr();t&&(e&&d("%s",t),or.emit("runCancelled",t))}});var Ee=u(()=>{"use strict";n();ur()});var cr,j,ke=u(()=>{"use strict";n();cr=require("nanoid"),j=(0,cr.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var lr,Vo,pr,dr=u(()=>{"use strict";n();lr=require("ts-pattern"),Vo={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},pr=()=>Vo});function yr(e){(0,C.match)(e).when(fr.isAxiosError,Xo).otherwise(()=>{d("Unexpected error while sending network request: %s",e)})}function Xo(e){return(0,C.match)(e).with({code:"ECONNABORTED"},()=>{d("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{d("Network connection aborted")}).with({code:"ECONNRESET"},()=>{d("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{d("Network connection timeout")}).with({response:C.P.not(C.P.nullish)},t=>{Yo(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{d(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:$(e)})})}function Yo(e,{status:t,data:r}){(0,C.match)(t).with(401,()=>{d(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{d(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,r)}).with(429,()=>{d(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{Zo(e,r)}).otherwise(()=>{d(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:$(e)})})}function Zo(e,t){(0,C.match)(t).with({code:Pe.MISSING_SUITE,message:C.P.string,errors:C.P.array(C.P.string)},async r=>{let{message:o,errors:s}=r;L(1),x(...gr(o,s)),re({id:j(),text:(0,mr.default)(pr(),null,2)}).then(i=>{x(`Please share this URL with Currents support for further investigation:
${i}`)}).catch(i=>{d("Failed to upload debug artifact: %s",i)}),L(1)}).with({code:Pe.RUN_CANCELLED,message:C.P.string},r=>{ir(r.message),ar()}).with({code:Pe.RUN_EXPIRED,message:C.P.string},r=>{d(r.message)}).with({message:C.P.string,errors:C.P.array(C.P.string)},r=>{let{message:o,errors:s}=r;L(1),d(...gr(o,s)),L(1)}).otherwise(()=>{d(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:$(e)})})}function gr(e,t){return hr.default.isString(e)?t?.length===0?[e]:[e,`
\u{1F4D6} ${Ft.guide.integration}`),new Z("Missing required config variable")})}function S(e){return Object.entries(e??{}).reduce((t,[r,o])=>o===void 0?t:{...t,[r]:o},{})}function R(){return W}function Zt(){Se(null),W=null}var _e,dn,Ne,W,Ae=p(()=>{"use strict";n();y();Dt();Ut();v();Q();Ie();ke();Q();_e=l.extend("config"),dn=["projectId","recordKey"],Ne={removeTitleTags:!1,disableTestTags:!1,consoleOutput:E.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},W=null});var mn,Qt=p(()=>{"use strict";n();mn=require("lodash");v()});var I=p(()=>{"use strict";n();Ae();Ie();ke();Qt()});var tr,er=p(()=>{tr={name:"@currents/playwright",version:"2.0.0-alpha.0",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/regexp.escape":"^2.0.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.14.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.1.1","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","!src/*.md","!src/**/*.md","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var B,De=p(()=>{"use strict";n();er();B=tr.version});function ie(e={}){let t=rr.default.create(e);return t.interceptors.request.use(r=>{let o={...r},i=t.getUri(r),c=nr.default.getProxyForUrl(i);return c&&(hn("Using HTTP proxy %s for %s ",c,i),o.proxy=!1,o.httpsAgent=wn(c)),o}),t}function wn(e){return se||(se=new or.HttpsProxyAgent(e),se)}var rr,or,nr,hn,se,Fe=p(()=>{"use strict";n();rr=u(require("axios")),or=require("https-proxy-agent"),nr=u(require("proxy-from-env"));y();hn=l.extend("axios");se=null});var Ue,sr,ir=p(()=>{"use strict";n();Ue=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",sr=()=>3e4});var yn,fi,Le=p(()=>{"use strict";n();yn=u(require("ws"));y();fi=l.extend("ws")});var ar,Si,cr,ur=p(()=>{"use strict";n();ar=u(require("events"));Ae();y();Le();$e();Si=l.extend("pubsub"),cr=new ar.default});var je,lr,pr,dr,gr=p(()=>{"use strict";n();v();ur();je={cancellationReason:null},lr=e=>{je.cancellationReason||(je.cancellationReason=e)},pr=()=>je.cancellationReason,dr=({showWarning:e=!0}={})=>{let t=pr();t&&(e&&g("%s",t),cr.emit("runCancelled",t))}});var $e=p(()=>{"use strict";n();gr()});var mr,q,Me=p(()=>{"use strict";n();mr=require("nanoid"),q=(0,mr.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var fr,Cn,hr,wr=p(()=>{"use strict";n();fr=require("ts-pattern"),Cn={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},hr=()=>Cn});function br(e){(0,O.match)(e).when(Cr.isAxiosError,xn).otherwise(()=>{g("Unexpected error while sending network request: %s",e)})}function xn(e){return(0,O.match)(e).with({code:"ECONNABORTED"},()=>{g("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{g("Network connection aborted")}).with({code:"ECONNRESET"},()=>{g("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{g("Network connection timeout")}).with({response:O.P.not(O.P.nullish)},t=>{On(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{g(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:H(e)})})}function On(e,{status:t,data:r}){(0,O.match)(t).with(401,()=>{g(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{g(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,r)}).with(429,()=>{g(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{bn(e,r)}).otherwise(()=>{g(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:H(e)})})}function bn(e,t){(0,O.match)(t).with({code:We.MISSING_SUITE,message:O.P.string,errors:O.P.array(O.P.string)},async r=>{let{message:o,errors:i}=r;M(1),h(...yr(o,i)),ae({id:q(),text:(0,xr.default)(hr(),null,2)}).then(c=>{h(`Please share this URL with Currents support for further investigation:
${c}`)}).catch(c=>{g("Failed to upload debug artifact: %s",c)}),M(1)}).with({code:We.RUN_CANCELLED,message:O.P.string},r=>{lr(r.message),dr()}).with({code:We.RUN_EXPIRED,message:O.P.string},r=>{g(r.message)}).with({message:O.P.string,errors:O.P.array(O.P.string)},r=>{let{message:o,errors:i}=r;M(1),g(...yr(o,i)),M(1)}).otherwise(()=>{g(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:H(e)})})}function yr(e,t){return Or.default.isString(e)?t?.length===0?[e]:[e,`
${(t??[]).map(r=>` - ${r}`).join(`
`)}
`]:["Unexpected network error"]}function $(e){return e?.response?.headers["apigw-requestid"]}var fr,mr,hr,C,Pe,_e=u(()=>{"use strict";n();fr=require("axios"),mr=c(require("json-stringify-safe")),hr=c(require("lodash")),C=require("ts-pattern");Ee();ke();S();Ne();dr();Pe={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function xr(e,t,r){let o=r.method?.toUpperCase(),s=r.url,i=$(t),g=(0,Cr.default)(Ae(e)),f=`Network request '${o} ${s}' failed: '${t.message}'.${i?` Request ID: ${i}.`:""} Next attempt is in ${g} (${e}/${r["axios-retry"]?.retries||Fe()}).`;wr(f),d(f)}var De,Cr,wr,Ae,br,Fe,Rr=u(()=>{"use strict";n();De=require("axios"),Cr=c(require("pretty-ms"));h();S();_e();wr=l.extend("http"),Ae=e=>[3*1e3,15*1e3,30*1e3][e-1],br=e=>(wr("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,De.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,De.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),Fe=()=>3});function on(){let e=te({baseURL:Te(),timeout:er(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:r}=t,o={...rn,...r};return o.enableCompression&&(0,kr.default)(t.data)>o.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await tn((0,Ir.default)(t.data))}):t}),e.interceptors.request.use(t=>{let r=t["axios-retry"]?.retryCount??0,o=E();t.headers.set({...en,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,vr.nanoid)(),"x-pwc-request-attempt":r,"x-currents-key":o?.recordKey??null}),o?.orchestrationId&&t.headers.set("x-currents-orchestration-id",o.orchestrationId),o?.machineId&&t.headers.set("x-currents-machine-id",o.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let s={...Er.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return r?Sr("network request retry: %o",Or({...s,isRetry:!0})):Sr("network request: %o",Or(s)),t}),(0,Tr.default)(e,{retries:Fe(),retryCondition:br,retryDelay:Ae,shouldResetTimeout:!0,onRetry:xr}),e}function Nr(){return oe||(oe=on(),oe)}function Or(e){return{method:e.method,baseUrl:Te(),url:e.url,data:e.isRetry?"<retry>":nn(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function nn(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var Tr,Ir,Er,vr,kr,Pr,_r,Sr,Qo,en,tn,oe,rn,Dr=u(()=>{"use strict";n();Tr=c(require("axios-retry")),Ir=c(require("json-stringify-safe")),Er=c(require("lodash")),vr=require("nanoid"),kr=c(require("object-sizeof")),Pr=require("util"),_r=c(require("zlib"));v();h();Se();Oe();tr();Rr();Sr=l.extend("http"),Qo=1024*1024*1,en={"x-pw-version":"0.0.0","x-pwc-version":Q},tn=(0,Pr.promisify)(_r.default.gzip),oe=null,rn={enableCompression:!1,compressThresholdBytes:Qo}});async function N(e,t=Nr){try{let r=await t().request(e);return Ar("network response: %o",{...Fr.default.omit(r,"request","config"),url:r.config.url,method:r.config.method}),r}catch(r){let o=r;throw Ar("network error: %o",{code:o.code,message:o.message,url:o.config?.url,method:o.config?.method,status:o.response?.status,headers:o.response?.headers,data:o.response?.data}),yr(o),o}}var Fr,Ar,Ur=u(()=>{"use strict";n();Fr=c(require("lodash"));h();Dr();_e();Ar=l.extend("http")});var Ue=u(()=>{"use strict";n();Ur()});var Lr={};de(Lr,{getDebugUrl:()=>sn});var sn,jr=u(()=>{"use strict";n();Ue();sn=({runId:e,type:t})=>N({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(r=>r.data)});function an(e,t){return Br({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function Br(e,t,r){let o=await Mr.default.readFile(e.path);return Le("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(o)}),qr(o,e.uploadUrl,t,r)}async function un(e,t,r){return Le("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),qr(e.buffer,e.uploadUrl,t,r)}async function cn(e,t,r,o){return te().request({method:"put",url:t,data:e,onUploadProgress:o,headers:{"Content-Disposition":"inline","Content-Type":r}})}async function qr(...e){await(0,$r.default)(async()=>{await cn(...e)},{retries:5,onRetry:(t,r)=>{if(Le(`Upload failed %d out of 5 attempts: %s
%o`,r,t.message,t.response?.data),r===5){x(`Cannot upload after ${r} times: ${t.message}`);return}d(`Upload failed ${r} out of 5 attempts: ${t.message}`)}})}var $r,Mr,Le,Wr,Gr=u(()=>{"use strict";n();$r=c(require("async-retry")),Mr=c(require("fs/promises"));h();Oe();S();Le=l.extend("upload"),Wr=(s=>(s.PNG="image/png",s.WEBM="video/webm",s.TEXT="text/plain",s.ZIP="application/zip",s))(Wr||{})});var zr={};de(zr,{ContentType:()=>Wr,sendBuffer:()=>un,sendPath:()=>Br,uploadText:()=>an});var Hr=u(()=>{"use strict";n();Gr()});async function re(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(jr(),Lr));try{let{readUrl:r,uploadUrl:o}=await t({runId:e.id,type:"pw-debug"}),{uploadText:s,sendBuffer:i}=await Promise.resolve().then(()=>(Hr(),zr));return"text"in e&&await i({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:o},"text/plain",void 0),"path"in e&&await s(e.path,o),r}catch{return null}}var je,$e=u(()=>{"use strict";n();je=c(require("debug"))});function ln(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var Jr,D,Me=u(()=>{"use strict";n();Jr=require("@commander-js/extra-typings"),D=new Jr.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(ln).env("CURRENTS_DEBUG")});var Kr,Vr,Xr=u(()=>{"use strict";n();Kr=require("@commander-js/extra-typings");Me();Vr=()=>new Kr.Command().allowUnknownOption().allowExcessArguments(!0).addOption(D).helpOption(!1)});var k,Yr,Be,Zr,Qr,We,P,M=u(()=>{"use strict";n();k=c(require("debug")),Yr=c(require("fs")),Be=c(require("path")),Zr=c(require("util")),Qr=require("fs/promises");ke();S();Xr();$e();k.default.useColors=function(){return!1};We=k.default.log,P=class e{constructor(t="core"){this.source=t;this.pipelines={};if(this.mode=Vr().parse().opts().pwcDebug??!1,this.debug=(0,k.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let r=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(k.default.enable(r),!this.shouldUploadRemoteDebug())return this;let o=j(),s=Be.default.resolve(".currents-debug"),i=Be.default.resolve(s,`${o}.log`);(0,Qr.mkdir)(s,{recursive:!0}),y(p(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),p(i));let g=Yr.default.createWriteStream(i,{flags:"a"});return k.default.log=(...f)=>{this.mode&&(g.write(`${Zr.default.formatWithOptions({colors:!1},...f)}
`),this.shouldMuteLocalStdout()||We(...f))},this.pipelines[o]={id:o,writeStream:g,type:this.source,tempFilePath:i},this}static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let r=Object.keys(this.pipelines);r.length===0&&(this.debug("No debug pipelines found"),k.default.log=We);for(let o of r)await this.uploadDebug(o,t??j())}catch{}finally{k.default.log=We}}async uploadDebug(t,r){let o=this.pipelines[t];if(!o){this.debug("No debug pipeline found for id %s",t);return}y(p(`\u{1F47E} ${o.type} debug log written:`),p(o?.tempFilePath));try{let s=await re({id:r,path:o.tempFilePath});o?.writeStream.end(),y(p(`\u{1F47E} ${o.type} debug log uploaded:`),p(s))}catch(s){d(`Failed to upload ${o.type}} debug log ${p(o.tempFilePath)}: ${s.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var Ne=u(()=>{"use strict";n();$e();M()});var l,h=u(()=>{"use strict";n();Ne();l=(0,je.default)("currents")});var xn={};de(xn,{runScript:()=>Po});module.exports=Uo(xn);n();var Zu=require("source-map-support/register"),St=require("commander");h();S();M();n();var bt=require("ts-pattern");v();n();var W=c(require("path")),eo=require("url"),to=c(require("jiti")),ro=[".ts",".js",".mjs"];function pn(e){return e.replace(/\\/g,"/")}function oo(e){e||(e="currents.config");let t=process.cwd(),r=(0,to.default)(t,{interopDefault:!0,cache:!1,extensions:[...ro]}),o=dn(e,{cwd:t,jiti:r});return o?{config:o.config,configFile:pn(o.configFile)}:{config:{},configFile:""}}function dn(e,t){let r=gn(e,t);if(!r)return null;let o=W.default.extname(r);if(!ro.includes(o))return null;let s;try{s=t.jiti(r)}catch{return null}let i=s?.default??s??null;if(i instanceof Function){try{i=i()}catch{return null}i&&i instanceof Promise&&(i=null)}return{config:i??{},configFile:r}}function gn(e,t){let r=o=>{let s=t.jiti.esmResolve(o,{try:!0});return s?(0,eo.fileURLToPath)(s):void 0};return r(W.default.resolve(t.cwd,e))||r(W.default.resolve(t.cwd,".config",e.replace(/\.config$/,"")))||r(W.default.resolve(t.cwd,".config",e))||e}h();n();n();var no={resetSignalReceived:null},so=({resetSignalReceived:e})=>{no.resetSignalReceived=e},io=()=>no;S();n();var Ve=require("ts-pattern");v();h();n();var qe;async function ne(){if(qe)return qe;let{execa:e}=await import("execa");return qe=e,e}M();n();Ie();n();var ao=c(require("http"));h();var uo=c(require("lil-http-terminator")),se=require("ts-pattern"),co=c(require("ws")),A=l.extend("wss"),q=null,B=null,Ge=null,_=()=>(0,se.match)(q?.address()).with({port:se.P.number},e=>e.port).otherwise(()=>0),lo=async()=>{if(A("terminating wss server: %d",_()),!Ge){A("no wss server");return}let{success:e,code:t,message:r,error:o}=await Ge.terminate();e||(t==="TIMED_OUT"&&o(r),t==="SERVER_ERROR"&&o(r,o),t==="INTERNAL_ERROR"&&o(r,o)),A("terminated wss server: %d",_())},po=e=>{B||(q=ao.default.createServer().on("listening",()=>{if(!q)throw new Error("Server not initialized");B=new co.WebSocketServer({server:q});let t=`wss://localhost:${_()}`;A("starting wss",t),B.on("connection",function(o){o.on("message",function(i){A("received %s: %o",t,JSON.parse(i.toString())?.type),e.forEach(g=>g(i.toString()))})}),B.on("close",()=>{A("wss closed"),B=null})}).listen(),Ge=(0,uo.default)({server:q}))};n();var yo=c(require("fs")),ae=require("lodash"),Ke=c(require("tmp")),Co=c(require("regexp.escape"));v();h();n();var mo=c(require("fs")),fn=require("path");v();h();n();var ze=c(require("fs")),go=require("tmp-promise"),fo=async()=>{let{path:e}=await(0,go.file)();return e};var F=l.extend("last-failed");function ho({suite:e,groupId:t,specFiles:r,lastRunData:o}){let s=mn({suite:e,groupId:t,specFiles:r,lastRunData:o});if(!s)return F("No updated data generated for task %s",t),!1;try{return hn(s),F("Successfully updated last run file for task %s",t),!0}catch(i){return F("Failed to update last run file for task %s: %O",t,i),!1}}function mn({suite:e,groupId:t,specFiles:r,lastRunData:o}){let s=e.find(f=>f.name===t);if(!s)return F("No group suite found for task %s",t),null;let i=o.find(f=>f.project===t);if(!i?.data)return F("No last run data found for group %s",t),null;let g=s.tests.filter(f=>r.includes(f.spec)&&i.data.failedTests.includes(f.testId)).map(f=>f.testId);return g.length?{data:{status:i.data.status,failedTests:g},path:i.path,project:i.project}:(F("No failed test IDs found for task %s",t),null)}function hn(e){return mo.default.writeFileSync(e.path,JSON.stringify(e.data,null,2))}n();var He={OR8N_SUITE_FILE_PREFIX:"currents-or8n-",FIXTURES_DIR_PREFIX:"currents-fixtures-",FIXTURES_CONFIG_ERR_FILE:"config_fixture_error.log",FIXTURES_WARNING_FILE_PREFIX:"config_fixture_warning"};S();M();n();Ue();var G=class{async create(t){return N({url:"/orchestration-v1",method:"POST",data:JSON.stringify(t)})}async createTask(t){return N({url:`/orchestration-v1/${t.id}/task`,method:"POST",data:JSON.stringify({machineId:t.machineId,runId:t.runId})})}async resetRun(t){return N({url:`/runs/v1/${t.runId}/reset`,method:"PUT",data:JSON.stringify({...t,isBatchedOr8n:!0})})}};var Je=l.extend("or8n-task-executor"),ie=class{constructor(t,r,o,s,i,g,f=null,T,Rn,Sn=new G){this.cliManager=t;this.or8nId=r;this.runId=o;this.machineId=s;this.cliArgs=i;this.suite=g;this.lastRunData=f;this.resolve=T;this.reject=Rn;this.batchedOrchestrationAPI=Sn;this.suiteFile=null;this.fixturesDir=null;this.taskResultList=[];this.taskResultPromiseList=[];this.orchestrationStatus=yn;this.runInEventMode=!0;this.lastRunData?this.runInEventMode=!1:"CURRENTS_OR8N_EVENT_MODE"in process.env&&(this.runInEventMode=process.env.CURRENTS_OR8N_EVENT_MODE==="true")}runOrchestrationLoop(){return this.suiteFile||(this.suiteFile=Ke.default.fileSync({prefix:He.OR8N_SUITE_FILE_PREFIX,postfix:".json"}),yo.default.writeFileSync(this.suiteFile.name,JSON.stringify(this.suite,null,2))),this.fixturesDir||(this.fixturesDir=Ke.default.dirSync({prefix:He.FIXTURES_DIR_PREFIX,unsafeCleanup:!0})),this.batchTaskLoopImpl()}async batchTaskLoopImpl(){try{if(io().resetSignalReceived){V(),y(`\u{1F6A5} Machine ${p(this.machineId)} has stopped processing tasks due to a reset signal.`),this.resolveTaskLoop();return}let{data:t}=await this.batchedOrchestrationAPI.createTask({machineId:this.machineId,id:this.or8nId,runId:this.runId});if(t.run&&(this.orchestrationStatus.specs=t.run.progress.specs,this.orchestrationStatus.tests=t.run.progress.tests,V(),y([` Orchestration progress: ${p(`${t.run?.progress?.specs?.completed??"-"}/${t.run?.progress?.specs?.overall??"-"} spec files completed`)}`].join(`
`))),!t.batch){await this.gracefullyResolveTaskLoop(),V(),y("\u{1F3C1} Orchestration session finished");return}let r=t.batch.groupId,o=(0,ae.orderBy)(t.batch.tasks,"score","desc"),s=t.batch?.tasks?.[0]?.batchSize;y(["",`\u{1F310} Executing orchestrated task: ${p(`[${r}] ${o.map(T=>T.spec).join(", ")} `)}`,`\u2139\uFE0F Batch size: ${s}`].join(`
`));let i=this.lastRunData?ho({suite:this.suite,groupId:r,specFiles:o.map(T=>T.spec),lastRunData:this.lastRunData??[]}):!1;Je('"Last failed" flag: %o',i);let g=this.runPWTask({task:{spec:o.map(T=>({spec:T.spec,workerIndex:T.workerIndex})),groupId:r},suiteFilePath:this.suiteFile.name,fixturesDir:this.fixturesDir.name,isLastFailed:i});this.taskResultPromiseList.push(g);let f=await g;o.forEach(T=>{this.taskResultList.push({task:{spec:T.spec,groupId:r},exitStatus:f.exitCode??1})})}catch(t){this.reject(t)}this.runInEventMode||(Je("Running in loop mode, executing the orchestration loop again"),this.runOrchestrationLoop())}async runPWTask({task:t,suiteFilePath:r,fixturesDir:o,isLastFailed:s=!1}){let i=E(),g=["test",...i?.orchestration?.skipReporterInjection?[]:["--reporter",[...this.cliManager.getCLIReporters(),"@currents/playwright"].join(",")],`--project=${t.groupId}`,...Ht(Jt(this.cliManager.program.args,["--project"]),[...this.cliArgs]),...s?["--last-failed"]:[],"--",...this.orderSpecsByWorkerIndex(t.spec).map(T=>(0,Co.default)(T))],f={...process.env,CURRENTS_PWCP_WSS_PORT:_().toString(),CURRENTS_MACHINE_ID:this.machineId,CURRENTS_ORCHESTRATION_ID:this.or8nId,CURRENTS_PWC_CLI_CONFIG_PATH:await this.cliManager.getConfigFilePath(),CURRENTS_TEST_SUITE_FILE:r,CURRENTS_FIXTURES_TMP_DIR:o,CURRENTS_CI_BUILD_ID:i?.ciBuildId,CURRENTS_DEBUG:String(P.factory("pwc-p").getDebugMode()),CURRENTS_OR8N_EVENT_MODE:this.runInEventMode};return i?.outputFile&&(f.CURRENTS_OR8N_SEND_RESULTS_TO_WSS="true"),Je("Running task %o",g),(await ne())("playwright",g,{stdio:"inherit",reject:!1,env:f})}orderSpecsByWorkerIndex(t){let r=(0,ae.groupBy)(t,o=>o.workerIndex.toString());return Object.keys(r).sort().map(o=>r[o]).flat().map(o=>o.spec)}async gracefullyResolveTaskLoop(){await Promise.all(this.taskResultPromiseList),this.resolveTaskLoop()}resolveTaskLoop(t={}){this.resolve({runId:this.runId,machineId:this.machineId,orchestrationId:this.or8nId,orchestrationStatus:this.orchestrationStatus,taskResultList:this.taskResultList,...t})}async machineReset(){let t=new G;try{y(`\u{1F6A5} Resetting tests: ${p(`machineId: ${this.machineId}, runId: ${this.runId}`)}`),await t.resetRun({machineId:this.machineId,runId:this.runId}),y(`\u{1F6A5} Success resetting tests: ${p(`machineId: ${this.machineId}, runId: ${this.runId}`)}`)}catch{d("Reset request failed.")}}},yn={specs:{overall:-1,claimed:-1,completed:-1,passes:-1,failures:-1},tests:{overall:-1,failures:-1,passes:-1,ignored:-1,flaky:-1}};var ue=l.extend("or8n-manager"),ce=class{constructor(t){this.cliManager=t;this.CREATE_TIMEOUT_MS=60*1e3;this.orchestrationSessionProgress=new Promise((r,o)=>{this.resolveOrchestrationSession=r,this.rejectOrchestrationSession=o})}eventsHandler(t){let r=JSON.parse(t);ue("Received ws event",r),(0,Ve.match)(r.type).when(o=>o.startsWith("discovery")||o.startsWith("orchestration"),o=>(0,Ve.match)(o).with("discovery:creation-success",()=>{(this.taskExecutor=new ie(this.cliManager,r.payload.id,r.payload.runId,r.payload.machineId,r.payload.cliArgs??[],r.payload.suite,r.payload.lastRunData,this.resolveOrchestrationSession,this.rejectOrchestrationSession)).runOrchestrationLoop()}).with("discovery:creation-failure",()=>{this.rejectOrchestrationSession(new Error("Failed to create orchestration session"))}).with("orchestration:run-cancelled",()=>{this.taskExecutor?this.taskExecutor.resolveTaskLoop({cancelled:!0}):this.rejectOrchestrationSession("Orchestration cancelled")}).with("orchestration:task-finished",()=>{this.taskExecutor.runOrchestrationLoop()}).otherwise(()=>{this.rejectOrchestrationSession(new Error(`Unknown discovery event ${r.type} received from orchestration service`))})).otherwise(()=>{})}async initOrchestration(t){let r=["test","--list","--reporter","@currents/playwright/orchestration",...t.cliOptions.lastFailed?["--last-failed"]:[],...t.program.args];ue("Orchestration discovery args: %o",r),ue(`Debug discovery command:
%s`,`DEBUG=*,-babel* CURRENTS_PWCP_DRY_RUN=1 CURRENTS_CI_BUILD_ID=debug CURRENTS_PROJECT_ID=debug CURRENTS_RECORD_KEY=debug npx playwright ${r.join(" ")}`);let s=await(await ne())("playwright",r,{stdio:"inherit",reject:!1,timeout:this.CREATE_TIMEOUT_MS,env:{CURRENTS_CI_BUILD_ID:E()?.ciBuildId,CURRENTS_PWC_CLI_CONFIG_PATH:await t.getConfigFilePath(),CURRENTS_PWCP_WSS_PORT:_().toString(),...process.env,CURRENTS_DEBUG:String(P.factory("pwc-p").getDebugMode())}});if(ue("Orchestration discovery result: %O",s),s.timedOut)throw new Error(`Failed to start orchestration within ${this.CREATE_TIMEOUT_MS}ms`);if(!s||s.exitCode!==0)throw new Error("Failed discovery for orchestration session");return s}};n();var wo=c(require("fs"));h();S();var bu=l.extend("output");async function bo(e){let t=" ".repeat(e.options?.ident??2);y(`${t}\u{1F4BE} JSON output file: ${p(e.outputFile)}`);try{wo.default.writeFileSync(e.outputFile,JSON.stringify(e.summary,null,2))}catch(r){x("Error writing JSON summary",r.message)}}n();var Eo=c(require("fs"));v();h();n();var mt=require("@commander-js/extra-typings"),ht=c(require("chalk"));Se();S();n();var m=require("@commander-js/extra-typings"),xo=require("commander");v();he();Me();var Xe=new m.Option("--pwc-config <path>","path to currents config file (currents.config.[ts|js])").env(R("currentsConfigFile")),Ye=new m.Option("--ci-build-id <id>","the unique identifier for a run").env(R("ciBuildId")),Ze=new m.Option("-k, --key <record-key>","your secret Record Key obtained from Currents").env(R("recordKey")),Qe=new m.Option("-p, --project-id <project>","the project ID for results reporting obtained from Currents").env(R("projectId")),et=new m.Option("-t, --tag <tag>","comma-separated tag(s) for recorded runs in Currents").argParser(dt),tt=new m.Option("--pwc-remove-title-tags","remove tags from test names in Currents, e.g. `Test name @smoke` becomes `Test name` in the dashboard"),rt=new m.Option("--pwc-disable-title-tags","[DEPRECATED] Use --pwc-disable-test-tags instead"),ot=new m.Option("--pwc-disable-test-tags","disable reporting tags defined on the test or suite level, or extracted from the test title"),nt=new m.Option("--pwc-cancel-after-failures <number | false>","abort the cloud run after the specified number of failed tests detected. Overrides the default Currents Project settings. If set, must be a positive integer or 'false' to disable automatic cancellations").env(R("cancelAfterFailures")).argParser(X),st=new m.Option("--pwc-output-file <string>","path to the file where the run summary output will be written.").env(R("outputFile")),it=new m.Option("--pwc-console-output <preset>","reporter console output: none (no stdout), summary (intro + one line per test + summary), detailed (full output)").choices(Object.values(I)).env(R("consoleOutput")),at=new m.Option("--pwc-test-suite-file <path>","path to the full test suite file for orchestration and reporting").env(R("testSuiteFile")).hideHelp(),ut=new m.Option("--pwc-machine-id <string>","unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId").env(R("machineId")),ct=new m.Option("--pwc-orchestration-id <string>","unique identifier of the orchestration session this run belongs to. See: https://docs.currents.dev/?q=orchestrationId").env(R("orchestrationId")).hideHelp();var lt=new m.Option("--pwc-inspect","enable inspect mode, run playwright with --inspect-brk flag or developments and debugging").default(!1).hideHelp(),Ro=new m.Option("--pwc-reset-signal <'SIGUSR1' | 'SIGUSR2'>","specify a process signal to listen for to trigger a reset of the current in progress tests. Only avaiable on OSes with POSIX signal support.").argParser(jt),pt=new m.Option("--reporter <reporter>","Reporter to use, comma-separated").argParser(dt).hideHelp(),So=new m.Option("--last-failed","Run last failed tests").default(!1).hideHelp(),Oo=new m.Option("--pwc-skip-reporter-injection","Do not inject @currents/playwright reporter via CLI, use the reporter specified in the playwright config");function dt(e,t=[]){return e?t.concat(e.split(",").map(r=>r.trim())):t}var gt=new m.Option("--pwc-coverage [projects...]","Comma-separated list of projects to collect coverage for, e.g. `project1,project2`. If no projects are specified, coverage will be collected for all projects.").argParser(dt),ft=new m.Option("--pwc-coverage-dir <path>","Path to the directory where coverage reports will be read from"),To=new m.Option("--pwc-batch-size <'auto' | number>","Set the number of parallel workers for orchestration. Use 'auto' to match the number of Playwright workers. If a number is provided, it must be a positive integer.").default("auto").env(R("batchSize")).argParser(e=>{if(e==="auto")return e;let t=Number(e);if(!isNaN(t)&&Number.isInteger(t)&&t>0)return t;throw new xo.InvalidArgumentError('Provide either "auto" or a positive integer.')});var yt=(e=Ct())=>e.version(Q),Cn=`
----------------------------------------------------
`]:["Unexpected network error"]}function H(e){return e?.response?.headers["apigw-requestid"]}var Cr,xr,Or,O,We,Be=p(()=>{"use strict";n();Cr=require("axios"),xr=u(require("json-stringify-safe")),Or=u(require("lodash")),O=require("ts-pattern");$e();Me();v();qe();wr();We={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function Tr(e,t,r){let o=r.method?.toUpperCase(),i=r.url,c=H(t),w=(0,vr.default)(ze(e)),m=`Network request '${o} ${i}' failed: '${t.message}'.${c?` Request ID: ${c}.`:""} Next attempt is in ${w} (${e}/${r["axios-retry"]?.retries||Ge()}).`;Sr(m),g(m)}var He,vr,Sr,ze,Rr,Ge,Er=p(()=>{"use strict";n();He=require("axios"),vr=u(require("pretty-ms"));y();v();Be();Sr=l.extend("http"),ze=e=>[3*1e3,15*1e3,30*1e3][e-1],Rr=e=>(Sr("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,He.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,He.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),Ge=()=>3});function En(){let e=ie({baseURL:Ue(),timeout:sr(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:r}=t,o={...Tn,...r};return o.enableCompression&&(0,Dr.default)(t.data)>o.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await Rn((0,_r.default)(t.data))}):t}),e.interceptors.request.use(t=>{let r=t["axios-retry"]?.retryCount??0,o=R();t.headers.set({...Sn,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,Ar.nanoid)(),"x-pwc-request-attempt":r,"x-currents-key":o?.recordKey??null}),o?.orchestrationId&&t.headers.set("x-currents-orchestration-id",o.orchestrationId),o?.machineId&&t.headers.set("x-currents-machine-id",o.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let i={...Nr.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return r?Ir("network request retry: %o",Pr({...i,isRetry:!0})):Ir("network request: %o",Pr(i)),t}),(0,kr.default)(e,{retries:Ge(),retryCondition:Rr,retryDelay:ze,shouldResetTimeout:!0,onRetry:Tr}),e}function Lr(){return ce||(ce=En(),ce)}function Pr(e){return{method:e.method,baseUrl:Ue(),url:e.url,data:e.isRetry?"<retry>":In(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function In(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var kr,_r,Nr,Ar,Dr,Fr,Ur,Ir,vn,Sn,Rn,ce,Tn,$r=p(()=>{"use strict";n();kr=u(require("axios-retry")),_r=u(require("json-stringify-safe")),Nr=u(require("lodash")),Ar=require("nanoid"),Dr=u(require("object-sizeof")),Fr=require("util"),Ur=u(require("zlib"));I();y();De();Fe();ir();Er();Ir=l.extend("http"),vn=1024*1024*1,Sn={"x-pw-version":"0.0.0","x-pwc-version":B},Rn=(0,Fr.promisify)(Ur.default.gzip),ce=null,Tn={enableCompression:!1,compressThresholdBytes:vn}});async function F(e,t=Lr){try{let r=await t().request(e);return jr("network response: %o",{...Mr.default.omit(r,"request","config"),url:r.config.url,method:r.config.method}),r}catch(r){let o=r;throw jr("network error: %o",{code:o.code,message:o.message,url:o.config?.url,method:o.config?.method,status:o.response?.status,headers:o.response?.headers,data:o.response?.data}),br(o),o}}var Mr,jr,Wr=p(()=>{"use strict";n();Mr=u(require("lodash"));y();$r();Be();jr=l.extend("http")});var Je=p(()=>{"use strict";n();Wr()});var Br={};At(Br,{getDebugUrl:()=>Pn});var Pn,qr=p(()=>{"use strict";n();Je();Pn=({runId:e,type:t})=>F({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(r=>r.data)});function kn(e,t){return Jr({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function Jr(e,t,r){let o=await zr.default.readFile(e.path);return Ve("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(o)}),Vr(o,e.uploadUrl,t,r)}async function _n(e,t,r){return Ve("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),Vr(e.buffer,e.uploadUrl,t,r)}async function Nn(e,t,r,o){return ie().request({method:"put",url:t,data:e,onUploadProgress:o,headers:{"Content-Disposition":"inline","Content-Type":r}})}async function Vr(...e){await(0,Hr.default)(async()=>{await Nn(...e)},{retries:5,onRetry:(t,r)=>{if(Ve(`Upload failed %d out of 5 attempts: %s
%o`,r,t.message,t.response?.data),r===5){h(`Cannot upload after ${r} times: ${t.message}`);return}g(`Upload failed ${r} out of 5 attempts: ${t.message}`)}})}var Hr,zr,Ve,Gr,Kr=p(()=>{"use strict";n();Hr=u(require("async-retry")),zr=u(require("fs/promises"));y();Fe();v();Ve=l.extend("upload"),Gr=(i=>(i.PNG="image/png",i.WEBM="video/webm",i.TEXT="text/plain",i.ZIP="application/zip",i))(Gr||{})});var Xr={};At(Xr,{ContentType:()=>Gr,sendBuffer:()=>_n,sendPath:()=>Jr,uploadText:()=>kn});var Yr=p(()=>{"use strict";n();Kr()});async function ae(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(qr(),Br));try{let{readUrl:r,uploadUrl:o}=await t({runId:e.id,type:"pw-debug"}),{uploadText:i,sendBuffer:c}=await Promise.resolve().then(()=>(Yr(),Xr));return"text"in e&&await c({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:o},"text/plain",void 0),"path"in e&&await i(e.path,o),r}catch{return null}}var Ke,Xe=p(()=>{"use strict";n();Ke=u(require("debug"))});function An(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var Zr,_,Ye=p(()=>{"use strict";n();Zr=require("@commander-js/extra-typings"),_=new Zr.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(An).env("CURRENTS_DEBUG")});var Qr,eo,to=p(()=>{"use strict";n();Qr=require("@commander-js/extra-typings");Ye();eo=()=>new Qr.Command().allowUnknownOption().allowExcessArguments(!0).addOption(_).helpOption(!1)});var P,ro,Qe,oo,no,Ze,k,z=p(()=>{"use strict";n();P=u(require("debug")),ro=u(require("fs")),Qe=u(require("path")),oo=u(require("util")),no=require("fs/promises");Me();v();to();Xe();P.default.useColors=function(){return!1};Ze=P.default.log,k=class e{constructor(t="core"){this.source=t;if(this.mode=eo().parse().opts().pwcDebug??!1,this.debug=(0,P.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let r=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(P.default.enable(r),!this.shouldUploadRemoteDebug())return this;let o=q(),i=Qe.default.resolve(".currents-debug"),c=Qe.default.resolve(i,`${o}.log`);(0,no.mkdir)(i,{recursive:!0}),f(s(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),s(c));let w=ro.default.createWriteStream(c,{flags:"a"});return P.default.log=(...m)=>{this.mode&&(w.write(`${oo.default.formatWithOptions({colors:!1},...m)}
`),this.shouldMuteLocalStdout()||Ze(...m))},this.pipelines[o]={id:o,writeStream:w,type:this.source,tempFilePath:c},this}source;static instance;static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}pipelines={};mode;debug;getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let r=Object.keys(this.pipelines);r.length===0&&(this.debug("No debug pipelines found"),P.default.log=Ze);for(let o of r)await this.uploadDebug(o,t??q())}catch{}finally{P.default.log=Ze}}async uploadDebug(t,r){let o=this.pipelines[t];if(!o){this.debug("No debug pipeline found for id %s",t);return}f(s(`\u{1F47E} ${o.type} debug log written:`),s(o?.tempFilePath));try{let i=await ae({id:r,path:o.tempFilePath});o?.writeStream.end(),f(s(`\u{1F47E} ${o.type} debug log uploaded:`),s(i))}catch(i){g(`Failed to upload ${o.type}} debug log ${s(o.tempFilePath)}: ${i.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var qe=p(()=>{"use strict";n();Xe();z()});var l,y=p(()=>{"use strict";n();qe();l=(0,Ke.default)("currents")});n();var Nu=require("source-map-support/register");n();var Nt=require("commander");y();v();z();var Xo=require("axios");n();var Po=u(require("fs"));I();y();n();var et=u(require("fs")),so=require("tmp-promise"),io=async()=>{let{path:e}=await(0,so.file)();return e};n();var G=require("@commander-js/extra-typings"),pe=u(require("chalk")),xt=require("commander");De();v();n();var d=require("@commander-js/extra-typings"),ao=require("commander");I();Te();Ye();var ue=new d.Option("--pwc-config <path>","path to currents config file (currents.config.[ts|js])").env(b("currentsConfigFile")),tt=new d.Option("--ci-build-id <id>","the unique identifier for a run").env(b("ciBuildId")),rt=new d.Option("-k, --key <record-key>","your secret Record Key obtained from Currents").env(b("recordKey")),ot=new d.Option("-p, --project-id <project>","the project ID for results reporting obtained from Currents").env(b("projectId")),nt=new d.Option("-t, --tag <tag>","comma-separated tag(s) for recorded runs in Currents").argParser(wt),st=new d.Option("--pwc-remove-title-tags","remove tags from test names in Currents, e.g. `Test name @smoke` becomes `Test name` in the dashboard"),it=new d.Option("--pwc-disable-title-tags","[DEPRECATED] Use --pwc-disable-test-tags instead"),at=new d.Option("--pwc-disable-test-tags","disable reporting tags defined on the test or suite level, or extracted from the test title"),ct=new d.Option("--pwc-cancel-after-failures <number | false>","abort the cloud run after the specified number of failed tests detected. Overrides the default Currents Project settings. If set, must be a positive integer or 'false' to disable automatic cancellations").env(b("cancelAfterFailures")).argParser(te),ut=new d.Option("--pwc-output-file <string>","path to the file where the run summary output will be written.").env(b("outputFile")),pt=new d.Option("--pwc-discovery-output <file>","path used by `pwc-p discover` to write its discovery output and by `pwc-p run` to read it").env(b("discoveryOutputFile")),co=new d.Option("--list","ignored (discover always runs playwright with --list)").hideHelp(),uo=new d.Option("--reporter <reporters>","ignored (discover always runs playwright with --reporter=list)").hideHelp(),lt=new d.Option("--pwc-console-output <preset>","reporter console output: none (no stdout), summary (intro + one line per test + summary), detailed (full output)").choices(Object.values(E)).env(b("consoleOutput")),dt=new d.Option("--pwc-test-suite-file <path>","path to the full test suite file for orchestration and reporting").env(b("testSuiteFile")).hideHelp(),gt=new d.Option("--pwc-machine-id <string>","unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId").env(b("machineId")),mt=new d.Option("--pwc-orchestration-id <string>","unique identifier of the orchestration session this run belongs to. See: https://docs.currents.dev/?q=orchestrationId").env(b("orchestrationId")).hideHelp();var ft=new d.Option("--pwc-inspect","enable inspect mode, run playwright with --inspect-brk flag or developments and debugging").default(!1).hideHelp(),po=new d.Option("--pwc-reset-signal <'SIGUSR1' | 'SIGUSR2'>","specify a process signal to listen for to trigger a reset of the current in progress tests. Only avaiable on OSes with POSIX signal support.").argParser(Jt),ht=new d.Option("--reporter <reporter>","Reporter to use, comma-separated").argParser(wt).hideHelp(),lo=new d.Option("-c, --config <file>","Playwright configuration file path"),go=new d.Option("--tsconfig <path>","Path to a single tsconfig applicable to all imported files"),mo=new d.Option("--test-list <file>","Path to a file containing a list of tests to run (Playwright --test-list)"),fo=new d.Option("--project <name...>","Only run tests from the specified Playwright projects (variadic)"),ho=new d.Option("-j, --workers <workers>","Number of concurrent workers or percentage of logical CPU cores per shard"),wo=new d.Option("--timeout <ms>","Per-test timeout in milliseconds"),yo=new d.Option("--headed","Run tests in headed browsers"),Co=new d.Option("--output <dir>","Folder for output artifacts"),xo=new d.Option("--ignore-snapshots","Ignore screenshot and snapshot expectations"),Oo=new d.Option("--fail-on-flaky-tests","Fail the run if any test is flagged as flaky");function bo(e){return[...e.config?["--config",e.config]:[],...e.tsconfig?["--tsconfig",e.tsconfig]:[],...e.testList?["--test-list",e.testList]:[],...(e.project??[]).flatMap(t=>["--project",t])]}function vo(e){return[...e.config?["--config",e.config]:[],...e.tsconfig?["--tsconfig",e.tsconfig]:[],...e.testList?["--test-list",e.testList]:[],...e.workers?["--workers",e.workers]:[],...e.timeout?["--timeout",e.timeout]:[],...e.headed?["--headed"]:[],...e.output?["--output",e.output]:[],...e.ignoreSnapshots?["--ignore-snapshots"]:[],...e.failOnFlakyTests?["--fail-on-flaky-tests"]:[]]}var So=new d.Option("--pwc-skip-reporter-injection","Do not inject @currents/playwright reporter via CLI, use the reporter specified in the playwright config");function wt(e,t=[]){return e?t.concat(e.split(",").map(r=>r.trim())):t}var yt=new d.Option("--pwc-coverage [projects...]","Comma-separated list of projects to collect coverage for, e.g. `project1,project2`. If no projects are specified, coverage will be collected for all projects.").argParser(wt),Ct=new d.Option("--pwc-coverage-dir <path>","Path to the directory where coverage reports will be read from"),Ro=new d.Option("--pwc-batch-size <'auto' | number>","Set the number of parallel workers for orchestration. Use 'auto' to match the number of Playwright workers. If a number is provided, it must be a positive integer.").default("auto").env(b("batchSize")).argParser(e=>{if(e==="auto")return e;let t=Number(e);if(!isNaN(t)&&Number.isInteger(t)&&t>0)return t;throw new ao.InvalidArgumentError('Provide either "auto" or a positive integer.')});var le=(e=bt())=>e.version(B),de=`----------------------------------------------------
\u{1F4D6} Documentation: https://docs.currents.dev
\u{1F919} Support: support@currents.dev
----------------------------------------------------
----------------------------------------------------`,Dn=`
${de}
${ht.default.bold("Examples")}
${pe.default.bold("Examples")}
Run all tests in the current directory:
${p("pwc --key <record-key> --project-id <id> --ci-build-id <build-id>")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id>")}
Run only tests filtered by the tag "@smoke":
${p("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
Run playwright tests and add tags "tagA", "tagB" to the recorded run:
${p("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
Provide playwright arguments and flags:
${p("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000 --shard 1/2")}
`,wn=`
----------------------------------------------------
\u{1F4D6} Documentation: https://docs.currents.dev
\u{1F919} Support: support@currents.dev
----------------------------------------------------
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000 --shard 1/2")}
`,To=`
${ht.default.bold("Examples")}
${pe.default.bold("Examples")}
Orchestrate all tests in the current directory:
${p("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id>")}
Discover tests (writes the test discovery output for ${s("pwc-p run")}):
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --pwc-discovery-output tests.txt")}
Orchestrate only tests filtered by the tag "@smoke":
${p("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
Orchestrate with extra Playwright runtime flags (supported subset only):
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> -j 4 --timeout 60000")}
Filter with grep / last-failed (${s("pwc-p discover")} passes flags through to Playwright):
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt --grep @smoke")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --pwc-discovery-output tests.txt")}
Orchestrate playwright tests and add tags "tagA", "tagB" to the recorded run:
${p("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
`,Fn=`
${de}${To}`,Un=`
${de}
Add additional playwright arguments and flags:
${p("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000")}
`,Ct=()=>new mt.Command().name("pwc").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u{1F3AD} Run Playwright tests on CI using https://currents.dev
${Cn}`).addOption(Ye).addOption(Ze).addOption(Qe).addOption(et).addOption(Xe).addOption(tt).addOption(ot).addOption(rt).addOption(nt).addOption(st).addOption(it).addOption(at).addOption(ut).addOption(ct).addOption(lt).addOption(D).addOption(gt).addOption(ft).addOption(pt).action(function(){this.opts().pwcDisableTitleTags&&d(`${p("--pwc-disable-title-tags")} has been renamed to ${p("--pwc-disable-test-tags")}.`)}),Io=()=>new mt.Command().name("pwc-p").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u2728 Orchestrate \u{1F3AD} Playwright tests on CI using https://currents.dev
${wn}`).addOption(Ye).addOption(Ze).addOption(Qe).addOption(et).addOption(Xe).addOption(tt).addOption(ot).addOption(rt).addOption(nt).addOption(st).addOption(it).addOption(at).addOption(ut).addOption(ct).addOption(Ro).addOption(lt).addOption(D).addOption(pt).addOption(So).addOption(Oo).addOption(gt).addOption(ft).addOption(To).action(function(){this.opts().pwcDisableTitleTags&&d(`${p("--pwc-disable-title-tags")} has been renamed to ${p("--pwc-disable-test-tags")}.`)});var wt=l.extend("cli-manager"),le=class{constructor(t={isOrchestration:!1}){this.configFilePath=null;this.program=t.isOrchestration?yt(Io()):yt(Ct()),this.cliOptions=this.program.parse().opts(),wt("CLI options: %o",this.cliOptions),this.parsedConfig=Gt(this.cliOptions),wt("Parsed config from CLI options: %o",this.parsedConfig)}getCLIReporters(){return this.cliOptions.reporter?.filter(t=>!/@currents/.test(t))||[]}async getConfigFilePath(){if(this.configFilePath)return this.configFilePath;let t=await fo();return Eo.default.writeFileSync(t,JSON.stringify(this.parsedConfig)),wt("CLI options temp file path: %s",t),this.configFilePath=t,t}};var bn=l.extend("pwc-p-runner");async function vo(){try{let e=new le({isOrchestration:!0}),t=oo(e.cliOptions.pwcConfig);Object.keys(t.config).length>0&&y(" Using config file:",p(t.configFile)),zt(e.parsedConfig,t.config);let r=E(),o=new ce(e),s=new xt,i=r?.orchestration?.resetSignal;i&&(y(`\u{1F6A5} Will reset tests on ${i}. PID: ${process.pid}`),process.on(i,async()=>{y(`\u{1F6A5} Received ${i}`),so({resetSignalReceived:!0}),o.taskExecutor?await o.taskExecutor.machineReset():y("\u{1F6A5} Reset signal acknowledged.")})),await po([o.eventsHandler.bind(o),s.eventsHandler.bind(s)]);let[g]=await Promise.all([o.orchestrationSessionProgress,o.initOrchestration(e)]);if(r?.outputFile&&await bo({outputFile:r?.outputFile,summary:s.getSummary(),options:{ident:0}}),bn("orchestration session raw result: %o",g),typeof r?.orchestration?.onFinish=="function")try{await r.orchestration.onFinish(g.orchestrationStatus)}catch{}return{...g,success:!g.cancelled&&g.taskResultList.every(f=>f.exitStatus===0)}}finally{await lo()}}var xt=class{constructor(){this.results=[]}eventsHandler(t){let r=JSON.parse(t);(0,bt.match)(r.type).when(o=>o.startsWith("execution:"),o=>(0,bt.match)(o).with("execution:summary",s=>{this.results.push(r.payload)}).otherwise(()=>{d("Unknown execution event received from orchestrated task",{event:r})})).otherwise(()=>{})}getSummary(){if(!this.results.length)return{runId:null,ciBuildId:null,url:null,results:{tests:{passed:0,failed:0,skipped:0,overall:0,flaky:0}},details:[]};let t=this.results.flatMap(o=>o.details),r=this.results.reduce((o,s)=>({passed:o.passed+s.results.tests.passed,failed:o.failed+s.results.tests.failed,skipped:o.skipped+s.results.tests.skipped,overall:o.overall+s.results.tests.overall,flaky:o.flaky+s.results.tests.flaky}),{passed:0,failed:0,skipped:0,overall:0,flaky:0});return{...this.results[0],results:{tests:r},details:t}}};var ko=require("axios"),pe=l.extend("pwc-p");require("dotenv").config({quiet:!0});var Rt=P.factory("pwc-p");async function Po(){try{let e=await vo();return pe("orchestration session result: %o",e),await Rt.finalize({runId:e.runId}),{exitCode:e.success===!0?0:1}}catch(e){return pe("orchestration session error: %o",e),e instanceof St.CommanderError?(x(e.message),{exitCode:e.exitCode}):(0,ko.isAxiosError)(e)?{exitCode:1}:(x(e),{exitCode:1})}}Po().then(e=>{pe("execa result: %o",e),process.exit(e.exitCode??0)}).catch(async e=>{e instanceof St.CommanderError&&(x(e.message),await Rt.finalize(),process.exit(e.exitCode)),pe("execa failed: %o",e),x(e),await Rt.finalize(),process.exit(1)});0&&(module.exports={runScript});
${s("pwc-p discover")} records which tests match your filters; ${s("pwc-p run")} executes them in parallel via Currents.
See ${pe.default.bold("Commands")} below for summaries and examples, or ${s("pwc-p discover --help")} / ${s("pwc-p run --help")} for every flag.
`,Ln=`Runs test discovery with the same argv passthrough as ${s("pwc")} (${s("-c")}/${s("--config")}, ${s("--grep")}, ${s("--last-failed")}, projects, etc.).
Writes discovery output to ${s("--pwc-discovery-output")}, ${s("CURRENTS_DISCOVERY_OUTPUT_FILE")}, or ${s("orchestration.discoveryOutputFile")} for ${s("pwc-p run")}.
Example:
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt")}`,$n=`Orchestrates Playwright runs in parallel through Currents.
Playwright filter flags (${s("--grep")}, ${s("--last-failed")}, etc.) are not accepted here: run ${s("pwc-p discover")} first, then pass ${s("--pwc-discovery-output")}, ${s("--test-list")}, or ${s("orchestration.discoveryOutputFile")}.
${To}`,jn=new Set(["--grep","-g","--grep-invert","--last-failed"]);function Eo(e){return/unknown option '?([^'\s]+)'?/i.exec(e)?.[1]??null}function Ot(e){return e.code==="commander.helpDisplayed"||e.code==="commander.help"||e.code==="commander.version"}function Mn(e){if(!(e instanceof xt.CommanderError))throw e;if(e.code==="commander.unknownOption"){let t=Eo(e.message);t&&jn.has(t)&&(h(`pwc-p run does not accept Playwright filter flags (${t}) directly.
Run discovery first, then pass the list to pwc-p run:
`+s(" pwc-p discover --pwc-discovery-output tests.txt [...filters]")+`
`+s(" pwc-p run ... --pwc-discovery-output tests.txt")),process.exit(e.exitCode)),t==="--shard"&&(h("--shard conflicts with pwc-p orchestration. Remove --shard; pwc-p distributes work via the orchestration session."),process.exit(e.exitCode)),(t==="--update-snapshots"||t==="-u")&&(h(`--update-snapshots is not supported under pwc-p run (parallel shards would race on snapshot files).
Update snapshots in a single-process run instead:
`+s(" pwc --update-snapshots ...")+`
`+s(" playwright test --update-snapshots ...")),process.exit(e.exitCode))}throw e.code==="commander.excessArguments"&&(h(`pwc-p run does not support positional arguments (spec paths or test names).
Run discovery first, then pass the list to pwc-p run:
`+s(" pwc-p discover --pwc-discovery-output tests.txt [...]")+`
`+s(" pwc-p run ... --pwc-discovery-output tests.txt")),process.exit(e.exitCode)),e}function Wn(e){if(!(e instanceof xt.CommanderError))throw e;if(e.code==="commander.unknownOption"||e.code==="commander.unknownCommand"||e.code==="commander.excessArguments"){let r=e.code==="commander.unknownOption"?Eo(e.message):null,o=r?`option ${r}`:"argument";h(`pwc-p does not accept ${o} directly - it now requires a subcommand.
Run orchestrated tests:
`+s(" pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> [...]")+`
Discover tests up front:
`+s(" pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt")+`
`+s(" pwc-p run ... --pwc-discovery-output tests.txt")+`
See ${s("pwc-p --help")}, ${s("pwc-p run --help")}, ${s("pwc-p discover --help")}.`),process.exit(e.exitCode)}throw e}var bt=()=>new G.Command().name("pwc").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u{1F3AD} Run Playwright tests on CI using https://currents.dev
${Dn}`).addOption(tt).addOption(rt).addOption(ot).addOption(nt).addOption(ue).addOption(st).addOption(at).addOption(it).addOption(ct).addOption(ut).addOption(lt).addOption(dt).addOption(gt).addOption(mt).addOption(ft).addOption(_).addOption(yt).addOption(Ct).addOption(ht).action(function(){this.opts().pwcDisableTitleTags&&g(`${s("--pwc-disable-title-tags")} has been renamed to ${s("--pwc-disable-test-tags")}.`)}),Bn=()=>new G.Command().name("discover").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").summary(Ln).description(`${de}
Run test discovery and write the result to a file consumed by ${s("pwc-p run")} (${s("--pwc-discovery-output")}) or wired via ${s("orchestration.discoveryOutputFile")} in currents.config.`).addOption(ue).addOption(pt).addOption(co).addOption(uo).addOption(_),qn=()=>le(Bn()),Hn=()=>new G.Command().name("run").usage("[options]").allowExcessArguments(!1).showHelpAfterError("(add --help for additional information)").exitOverride(Mn).summary($n).description(`\u2728 Orchestrate \u{1F3AD} Playwright tests on CI using https://currents.dev
${Fn}`).addOption(tt).addOption(rt).addOption(ot).addOption(nt).addOption(ue).addOption(st).addOption(at).addOption(it).addOption(ct).addOption(ut).addOption(lt).addOption(dt).addOption(gt).addOption(mt).addOption(po).addOption(ft).addOption(_).addOption(ht).addOption(lo).addOption(go).addOption(mo).addOption(fo).addOption(ho).addOption(wo).addOption(yo).addOption(Co).addOption(xo).addOption(Oo).addOption(So).addOption(yt).addOption(Ct).addOption(Ro).addOption(pt);function Io(e){let t=new G.Command().name("pwc-p").version(B).description(`\u2728 Orchestrate \u{1F3AD} Playwright tests on CI using https://currents.dev
${Un}`).allowExcessArguments(!1).exitOverride(Wn).showHelpAfterError("(add --help for additional information)"),r=qn();r.action(async function(){await e.discover(this)});let o=le(Hn());return o.action(async function(){this.opts().pwcDisableTitleTags&&g(`${s("--pwc-disable-title-tags")} has been renamed to ${s("--pwc-disable-test-tags")}.`),await e.run(this)}),t.addCommand(r),t.addCommand(o),t}var vt=l.extend("cli-manager"),ge=class{program;cliOptions;parsedConfig;configFilePath=null;constructor(t={isOrchestration:!1}){if(t.isOrchestration){if(!t.runCommand)throw new Error("CLIManager: orchestration mode requires `runCommand` (parsed `pwc-p run` Commander instance).");this.program=t.runCommand,this.cliOptions=t.runCommand.opts()}else this.program=le(bt()),this.cliOptions=this.program.parse().opts();vt("CLI options: %o",this.cliOptions),this.parsedConfig=re(this.cliOptions),vt("Parsed config from CLI options: %o",this.parsedConfig)}getCLIReporters(){return this.cliOptions.reporter?.filter(t=>!/@currents/.test(t))||[]}async getConfigFilePath(){if(this.configFilePath)return this.configFilePath;let t=await io();return Po.default.writeFileSync(t,JSON.stringify(this.parsedConfig)),vt("CLI options temp file path: %s",t),this.configFilePath=t,this.configFilePath}};n();var Rt=u(require("fs")),fe=u(require("path")),Ao=require("stream/promises");I();n();var J=u(require("path")),ko=require("url"),_o=u(require("jiti")),No=[".ts",".js",".mjs"];function zn(e){return e.replace(/\\/g,"/")}function me(e){e||(e="currents.config");let t=process.cwd(),r=(0,_o.default)(t,{interopDefault:!0,cache:!1,extensions:[...No]}),o=Gn(e,{cwd:t,jiti:r});return o?{config:o.config,configFile:zn(o.configFile)}:{config:{},configFile:""}}function Gn(e,t){let r=Jn(e,t);if(!r)return null;let o=J.default.extname(r);if(!No.includes(o))return null;let i;try{i=t.jiti(r)}catch{return null}let c=i?.default??i??null;if(c instanceof Function){try{c=c()}catch{return null}c&&c instanceof Promise&&(c=null)}return{config:c??{},configFile:r}}function Jn(e,t){let r=o=>{let i=t.jiti.esmResolve(o,{try:!0});return i?(0,ko.fileURLToPath)(i):void 0};return r(J.default.resolve(t.cwd,e))||r(J.default.resolve(t.cwd,".config",e.replace(/\.config$/,"")))||r(J.default.resolve(t.cwd,".config",e))||e}n();var St;async function U(){if(St)return St;let{execa:e}=await import("execa");return St=e,e}v();async function Do(e){try{let t=e.opts(),r=me(t.pwcConfig);ne(re(t),r.config,{validationFn:()=>{}});let o=R()?.orchestration?.discoveryOutputFile,i=o?fe.default.resolve(process.cwd(),o):void 0;if(!i)return h(`Discovery output file is required. Set one of:
--pwc-discovery-output <file>
environment variable CURRENTS_DISCOVERY_OUTPUT_FILE
currents.config: orchestration.discoveryOutputFile`),1;Rt.default.mkdirSync(fe.default.dirname(i),{recursive:!0});let c=e.args,m=(await U())("playwright",["test","--list","--reporter=list",...c],{stdio:["inherit","pipe","inherit"],reject:!1}),T=Rt.default.createWriteStream(i);if(!m.stdout)return 1;m.stdout.pipe(T);let $=await m;try{await(0,Ao.finished)(T)}catch(Qo){return h("Failed to write discovery output: %o",Qo),$.exitCode&&$.exitCode!==0?$.exitCode:1}if($.exitCode!==0)return $.exitCode??1;let Zo=fe.default.relative(process.cwd(),i)||i;return f(""),Ht(`Discovery output written to: ${i}`),f(""),f("Use it with:"),f(s(` pwc-p run --pwc-discovery-output ${Zo}`)),0}finally{Zt()}}n();var Vo=u(require("fs")),kt=require("ts-pattern");I();y();n();n();var Fo={resetSignalReceived:null},Uo=({resetSignalReceived:e})=>{Fo.resetSignalReceived=e},Lo=()=>Fo;v();n();var Pt=require("ts-pattern");I();y();z();n();Le();n();var $o=u(require("http"));y();var jo=u(require("lil-http-terminator")),he=require("ts-pattern"),Mo=u(require("ws")),L=l.extend("wss"),K=null,V=null,Tt=null,N=()=>(0,he.match)(K?.address()).with({port:he.P.number},e=>e.port).otherwise(()=>0),Wo=async()=>{if(L("terminating wss server: %d",N()),!Tt){L("no wss server");return}let{success:e,code:t,message:r,error:o}=await Tt.terminate();e||(t==="TIMED_OUT"&&o(r),t==="SERVER_ERROR"&&o(r,o),t==="INTERNAL_ERROR"&&o(r,o)),L("terminated wss server: %d",N())},Bo=e=>{V||(K=$o.default.createServer().on("listening",()=>{if(!K)throw new Error("Server not initialized");V=new Mo.WebSocketServer({server:K});let t=`wss://localhost:${N()}`;L("starting wss",t),V.on("connection",function(o){o.on("message",function(c){L("received %s: %o",t,JSON.parse(c.toString())?.type),e.forEach(w=>w(c.toString()))})}),V.on("close",()=>{L("wss closed"),V=null})}).listen(),Tt=(0,jo.default)({server:K}))};n();var Ho=u(require("fs")),ye=require("lodash"),It=u(require("tmp")),zo=u(require("regexp.escape"));I();y();n();var Et={OR8N_SUITE_FILE_PREFIX:"currents-or8n-",FIXTURES_DIR_PREFIX:"currents-fixtures-",FIXTURES_CONFIG_ERR_FILE:"config_fixture_error.log",FIXTURES_WARNING_FILE_PREFIX:"config_fixture_warning"};v();z();n();Je();var X=class{async create(t){return F({url:"/orchestration-v1",method:"POST",data:JSON.stringify(t)})}async createTask(t){return F({url:`/orchestration-v1/${t.id}/task`,method:"POST",data:JSON.stringify({machineId:t.machineId,runId:t.runId})})}async resetRun(t){return F({url:`/runs/v1/${t.runId}/reset`,method:"PUT",data:JSON.stringify({...t,isBatchedOr8n:!0})})}};var qo=l.extend("or8n-task-executor"),we=class{constructor(t,r,o,i,c,w,m,T=new X){this.cliManager=t;this.or8nId=r;this.runId=o;this.machineId=i;this.suite=c;this.resolve=w;this.reject=m;this.batchedOrchestrationAPI=T;"CURRENTS_OR8N_EVENT_MODE"in process.env&&(this.runInEventMode=process.env.CURRENTS_OR8N_EVENT_MODE==="true")}cliManager;or8nId;runId;machineId;suite;resolve;reject;batchedOrchestrationAPI;suiteFile=null;fixturesDir=null;taskResultList=[];taskResultPromiseList=[];orchestrationStatus=Vn;runInEventMode=!0;runOrchestrationLoop(){return this.suiteFile||(this.suiteFile=It.default.fileSync({prefix:Et.OR8N_SUITE_FILE_PREFIX,postfix:".json"}),Ho.default.writeFileSync(this.suiteFile.name,JSON.stringify(this.suite,null,2))),this.fixturesDir||(this.fixturesDir=It.default.dirSync({prefix:Et.FIXTURES_DIR_PREFIX,unsafeCleanup:!0})),this.batchTaskLoopImpl()}async batchTaskLoopImpl(){try{if(Lo().resetSignalReceived){ee(),f(`\u{1F6A5} Machine ${s(this.machineId)} has stopped processing tasks due to a reset signal.`),this.resolveTaskLoop();return}let{data:t}=await this.batchedOrchestrationAPI.createTask({machineId:this.machineId,id:this.or8nId,runId:this.runId});if(t.run&&(this.orchestrationStatus.specs=t.run.progress.specs,this.orchestrationStatus.tests=t.run.progress.tests,ee(),f([` Orchestration progress: ${s(`${t.run?.progress?.specs?.completed??"-"}/${t.run?.progress?.specs?.overall??"-"} spec files completed`)}`].join(`
`))),!t.batch){await this.gracefullyResolveTaskLoop(),ee(),f("\u{1F3C1} Orchestration session finished");return}let r=t.batch.groupId,o=(0,ye.orderBy)(t.batch.tasks,"score","desc"),i=t.batch?.tasks?.[0]?.batchSize;f(["",`\u{1F310} Executing orchestrated task: ${s(`[${r}] ${o.map(m=>m.spec).join(", ")} `)}`,`\u2139\uFE0F Batch size: ${i}`].join(`
`));let c=this.runPWTask({task:{spec:o.map(m=>({spec:m.spec,workerIndex:m.workerIndex})),groupId:r},suiteFilePath:this.suiteFile.name,fixturesDir:this.fixturesDir.name});this.taskResultPromiseList.push(c);let w=await c;o.forEach(m=>{this.taskResultList.push({task:{spec:m.spec,groupId:r},exitStatus:w.exitCode??1})})}catch(t){this.reject(t)}this.runInEventMode||(qo("Running in loop mode, executing the orchestration loop again"),this.runOrchestrationLoop())}async runPWTask({task:t,suiteFilePath:r,fixturesDir:o}){let i=R(),c=this.cliManager.cliOptions,w=["test",...i?.orchestration?.skipReporterInjection?[]:["--reporter",[...this.cliManager.getCLIReporters(),"@currents/playwright"].join(",")],`--project=${t.groupId}`,...vo(c),"--",...this.orderSpecsByWorkerIndex(t.spec).map(T=>(0,zo.default)(T))],m={...process.env,CURRENTS_PWCP_WSS_PORT:N().toString(),CURRENTS_MACHINE_ID:this.machineId,CURRENTS_ORCHESTRATION_ID:this.or8nId,CURRENTS_PWC_CLI_CONFIG_PATH:await this.cliManager.getConfigFilePath(),CURRENTS_TEST_SUITE_FILE:r,CURRENTS_FIXTURES_TMP_DIR:o,CURRENTS_CI_BUILD_ID:i?.ciBuildId,CURRENTS_DEBUG:String(k.factory("pwc-p").getDebugMode()),CURRENTS_OR8N_EVENT_MODE:this.runInEventMode};return i?.outputFile&&(m.CURRENTS_OR8N_SEND_RESULTS_TO_WSS="true"),qo("Running task %o",w),(await U())("playwright",w,{stdio:"inherit",reject:!1,env:m})}orderSpecsByWorkerIndex(t){let r=(0,ye.groupBy)(t,o=>o.workerIndex.toString());return Object.keys(r).sort().map(o=>r[o]).flat().map(o=>o.spec)}async gracefullyResolveTaskLoop(){await Promise.all(this.taskResultPromiseList),this.resolveTaskLoop()}resolveTaskLoop(t={}){this.resolve({runId:this.runId,machineId:this.machineId,orchestrationId:this.or8nId,orchestrationStatus:this.orchestrationStatus,taskResultList:this.taskResultList,...t})}async machineReset(){let t=new X;try{f(`\u{1F6A5} Resetting tests: ${s(`machineId: ${this.machineId}, runId: ${this.runId}`)}`),await t.resetRun({machineId:this.machineId,runId:this.runId}),f(`\u{1F6A5} Success resetting tests: ${s(`machineId: ${this.machineId}, runId: ${this.runId}`)}`)}catch{g("Reset request failed.")}}},Vn={specs:{overall:-1,claimed:-1,completed:-1,passes:-1,failures:-1},tests:{overall:-1,failures:-1,passes:-1,ignored:-1,flaky:-1}};var Ce=l.extend("or8n-manager"),xe=class{constructor(t){this.cliManager=t;this.orchestrationSessionProgress=new Promise((r,o)=>{this.resolveOrchestrationSession=r,this.rejectOrchestrationSession=o})}cliManager;orchestrationSessionProgress;taskExecutor;CREATE_TIMEOUT_MS=60*1e3;resolveOrchestrationSession;rejectOrchestrationSession;eventsHandler(t){let r=JSON.parse(t);Ce("Received ws event",r),(0,Pt.match)(r.type).when(o=>o.startsWith("discovery")||o.startsWith("orchestration"),o=>(0,Pt.match)(o).with("discovery:creation-success",()=>{(this.taskExecutor=new we(this.cliManager,r.payload.id,r.payload.runId,r.payload.machineId,r.payload.suite,this.resolveOrchestrationSession,this.rejectOrchestrationSession)).runOrchestrationLoop()}).with("discovery:creation-failure",()=>{this.rejectOrchestrationSession(new Error("Failed to create orchestration session"))}).with("orchestration:run-cancelled",()=>{this.taskExecutor?this.taskExecutor.resolveTaskLoop({cancelled:!0}):this.rejectOrchestrationSession("Orchestration cancelled")}).with("orchestration:task-finished",()=>{this.taskExecutor.runOrchestrationLoop()}).otherwise(()=>{this.rejectOrchestrationSession(new Error(`Unknown discovery event ${r.type} received from orchestration service`))})).otherwise(()=>{})}async initOrchestration(t){let r=t.cliOptions,o=["test","--list","--reporter","@currents/playwright/orchestration",...bo(r)];Ce("Orchestration discovery args: %o",o),Ce(`Debug discovery command:
%s`,`DEBUG=*,-babel* CURRENTS_PWCP_DRY_RUN=1 CURRENTS_CI_BUILD_ID=debug CURRENTS_PROJECT_ID=debug CURRENTS_RECORD_KEY=debug npx playwright ${o.join(" ")}`);let c=await(await U())("playwright",o,{stdio:"inherit",reject:!1,timeout:this.CREATE_TIMEOUT_MS,env:{CURRENTS_CI_BUILD_ID:R()?.ciBuildId,CURRENTS_PWC_CLI_CONFIG_PATH:await t.getConfigFilePath(),CURRENTS_PWCP_WSS_PORT:N().toString(),...process.env,CURRENTS_DEBUG:String(k.factory("pwc-p").getDebugMode())}});if(Ce("Orchestration discovery result: %O",c),c.timedOut)throw new Error(`Failed to start orchestration within ${this.CREATE_TIMEOUT_MS}ms`);if(!c||c.exitCode!==0)throw new Error("Failed discovery for orchestration session");return c}};n();var Go=u(require("fs"));y();v();var pu=l.extend("output");async function Jo(e){let t=" ".repeat(e.options?.ident??2);f(`${t}\u{1F4BE} JSON output file: ${s(e.outputFile)}`);try{Go.default.writeFileSync(e.outputFile,JSON.stringify(e.summary,null,2))}catch(r){h("Error writing JSON summary",r.message)}}var Kn=l.extend("pwc-p-runner");async function Ko(e){try{let t=me(e.cliOptions.pwcConfig);Object.keys(t.config).length>0&&f(" Using config file:",s(t.configFile)),ne(e.parsedConfig,t.config);let r=R(),o=r?.orchestration?.discoveryOutputFile;if(!e.cliOptions.testList&&o){if(!Vo.default.existsSync(o))throw new Error(`orchestration.discoveryOutputFile "${o}" does not exist. Run \`pwc-p discover\` first or pass --pwc-discovery-output explicitly.`);e.cliOptions.testList=o}let i=new xe(e),c=new _t,w=r?.orchestration?.resetSignal;w&&(f(`\u{1F6A5} Will reset tests on ${w}. PID: ${process.pid}`),process.on(w,async()=>{f(`\u{1F6A5} Received ${w}`),Uo({resetSignalReceived:!0}),i.taskExecutor?await i.taskExecutor.machineReset():f("\u{1F6A5} Reset signal acknowledged.")})),await Bo([i.eventsHandler.bind(i),c.eventsHandler.bind(c)]);let[m]=await Promise.all([i.orchestrationSessionProgress,i.initOrchestration(e)]);if(r?.outputFile&&await Jo({outputFile:r?.outputFile,summary:c.getSummary(),options:{ident:0}}),Kn("orchestration session raw result: %o",m),typeof r?.orchestration?.onFinish=="function")try{await r.orchestration.onFinish(m.orchestrationStatus)}catch{}return{...m,success:!m.cancelled&&m.taskResultList.every(T=>T.exitStatus===0)}}finally{await Wo()}}var _t=class{results=[];eventsHandler(t){let r=JSON.parse(t);(0,kt.match)(r.type).when(o=>o.startsWith("execution:"),o=>(0,kt.match)(o).with("execution:summary",i=>{this.results.push(r.payload)}).otherwise(()=>{g("Unknown execution event received from orchestrated task",{event:r})})).otherwise(()=>{})}getSummary(){if(!this.results.length)return{runId:null,ciBuildId:null,url:null,results:{tests:{passed:0,failed:0,skipped:0,overall:0,flaky:0}},details:[]};let t=this.results.flatMap(o=>o.details),r=this.results.reduce((o,i)=>({passed:o.passed+i.results.tests.passed,failed:o.failed+i.results.tests.failed,skipped:o.skipped+i.results.tests.skipped,overall:o.overall+i.results.tests.overall,flaky:o.flaky+i.results.tests.flaky}),{passed:0,failed:0,skipped:0,overall:0,flaky:0});return{...this.results[0],results:{tests:r},details:t}}};var Y=l.extend("pwc-p");require("dotenv").config({quiet:!0});var Xn=k.factory("pwc-p"),A=async e=>{try{await Xn.finalize(e?{runId:e}:void 0)}catch(t){Y("remoteDebug.finalize() failed: %o",t)}};async function Yn(){let e=0;try{return await Io({discover:async r=>{e=await Do(r),await A()},run:async r=>{let o=new ge({isOrchestration:!0,runCommand:r}),i=await Ko(o);Y("orchestration session result: %o",i),await A(i.runId),e=i.success===!0?0:1}}).parseAsync(),{exitCode:e}}catch(t){return Y("orchestration session error: %o",t),t instanceof Nt.CommanderError?(Ot(t)||h(t.message),await A(),{exitCode:t.exitCode}):(0,Xo.isAxiosError)(t)?(await A(),{exitCode:1}):(h(t),await A(),{exitCode:1})}}function Yo(){Yn().then(e=>{Y("execa result: %o",e),process.exit(e.exitCode??0)}).catch(async e=>{e instanceof Nt.CommanderError&&(Ot(e)||h(e.message),await A(),process.exit(e.exitCode)),Y("execa failed: %o",e),h(e),await A(),process.exit(1)})}Yo();
//# sourceMappingURL=pwc-p.js.map
#! /usr/bin/env node
"use strict";var br=Object.create;var M=Object.defineProperty;var wr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Or=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var i=(e,t)=>()=>(e&&(t=e(e=0)),t);var We=(e,t)=>{for(var o in t)M(e,o,{get:t[o],enumerable:!0})},Rr=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of xr(t))!Tr.call(e,a)&&a!==o&&M(e,a,{get:()=>t[a],enumerable:!(n=wr(t,a))||n.enumerable});return e};var p=(e,t,o)=>(o=e!=null?br(Or(e)):{},Rr(t||!e||!e.__esModule?M(o,"default",{value:e,enumerable:!0}):o,e));var r=i(()=>{"use strict"});var Me=i(()=>{"use strict";r()});var qe=i(()=>{"use strict";r()});function Be(e){Er.push(e)}var Er,q=i(()=>{"use strict";r();Er=[]});var b,vr,Sr,Ir,lo,I=i(()=>{"use strict";r();b={None:"none",Summary:"summary",Detailed:"detailed"},vr={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},Sr={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},Ir={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},lo={[b.None]:vr,[b.Summary]:Sr,[b.Detailed]:Ir}});var Ge,ze,He=i(()=>{"use strict";r();Ge=[],ze=[]});function Pr(e){return Ke?!!Ke[e]:!0}function A(e,t){Be(t),Pr(e)&&console.log(t)}var m,P,Ke,D,u,w,R,To,Ro,Eo,vo,So,Io,Po,Ao,Do,d,ko,Ve=i(()=>{"use strict";r();m=p(require("chalk")),P=p(require("util"));I();h();q();He();Ke=null;D=(...e)=>{A("introAndSummary",P.default.format(...e))},u=(...e)=>{let t=P.default.format(...e);ze.push(t),c("WARNING: ",t),A("warningsAndErrors",m.default.bgYellow.black(" WARNING ")+" "+t)},w=(...e)=>{let t=P.default.format(...e);Ge.push(t),c("ERROR: ",t),A("warningsAndErrors",m.default.bgRed.white(" ERROR ")+" "+t)},R=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&A("introAndSummary",Array(t).fill("").join(`
`))},To=m.default.cyan,Ro=m.default.blueBright,Eo=m.default.red,vo=m.default.yellow,So=m.default.green,Io=m.default.gray,Po=m.default.white,Ao=m.default.black,Do=m.default.magenta,d=m.default.dim,ko=m.default.bold});var y=i(()=>{"use strict";r();q();Ve()});function G(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new B.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}function Je(e){if(!e)return;let t=["SIGUSR1","SIGUSR2"];if(!t.includes(e.toUpperCase().trim()))throw new B.CommanderError(255,"Invalid argument provided.","--pwc-reset-signal must be one of ("+t.join(", ")+"), provided: "+e);return e.toUpperCase().trim()}var B,z=i(()=>{"use strict";r();B=require("commander")});function C(e){return Dr[e]?.env}var Dr,H=i(()=>{"use strict";r();z();Dr={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"}}});function Xe(e){return{ciBuildId:e.ciBuildId,projectId:e.projectId,recordKey:e.key,tag:e.tag,removeTitleTags:e.pwcRemoveTitleTags,cancelAfterFailures:e.pwcCancelAfterFailures,disableTestTags:e.pwcDisableTestTags||e.pwcDisableTitleTags,testSuiteFile:e.pwcTestSuiteFile,machineId:e.pwcMachineId,outputFile:e.pwcOutputFile,consoleOutput:e.pwcConsoleOutput,pwcConfigPath:e.pwcConfig,orchestration:{resetSignal:e.pwcResetSignal,skipReporterInjection:e.pwcSkipReporterInjection,batchSize:e.pwcBatchSize},coverage:{projects:e.pwcCoverage,dir:e.pwcCoverageDir}}}var kr,Go,K=i(()=>{"use strict";r();kr=p(require("fs"));h();Go=c.extend("cli-options-serializer")});function Ye(){return Nr}var pn,cn,Nr,V=i(()=>{"use strict";r();h();Me();qe();y();I();H();K();I();pn=c.extend("config"),cn={removeTitleTags:!1,disableTestTags:!1,consoleOutput:b.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},Nr=null});var Ur,Ze=i(()=>{"use strict";r();Ur=require("lodash");y()});var k=i(()=>{"use strict";r();V();H();K();Ze()});var et,Qe=i(()=>{et={name:"@currents/playwright",version:"1.23.3",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/randomstring":"^1.3.0","@types/regexp.escape":"^2.0.0","@types/shelljs":"^0.10.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.13.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsconfig:"*",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4",wtfnode:"^0.10.1"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.0.0","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var N,J=i(()=>{"use strict";r();Qe();N=et.version});function _(e={}){let t=tt.default.create(e);return t.interceptors.request.use(o=>{let n={...o},a=t.getUri(o),g=ot.default.getProxyForUrl(a);return g&&(Fr("Using HTTP proxy %s for %s ",g,a),n.proxy=!1,n.httpsAgent=jr(g)),n}),t}function jr(e){return U||(U=new rt.HttpsProxyAgent(e),U)}var tt,rt,ot,Fr,U,X=i(()=>{"use strict";r();tt=p(require("axios")),rt=require("https-proxy-agent"),ot=p(require("proxy-from-env"));h();Fr=c.extend("axios");U=null});var Y,nt,st=i(()=>{"use strict";r();Y=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",nt=()=>3e4});var Lr,Un,it=i(()=>{"use strict";r();Lr=p(require("ws"));h();Un=c.extend("ws")});var at,Bn,ut,pt=i(()=>{"use strict";r();at=p(require("events"));V();h();it();Z();Bn=c.extend("pubsub"),ut=new at.default});var Q,lt,ct,dt,gt=i(()=>{"use strict";r();y();pt();Q={cancellationReason:null},lt=e=>{Q.cancellationReason||(Q.cancellationReason=e)},ct=()=>Q.cancellationReason,dt=({showWarning:e=!0}={})=>{let t=ct();t&&(e&&u("%s",t),ut.emit("runCancelled",t))}});var Z=i(()=>{"use strict";r();gt()});var ft,E,ee=i(()=>{"use strict";r();ft=require("nanoid"),E=(0,ft.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var mt,$r,ht,Ct=i(()=>{"use strict";r();mt=require("ts-pattern"),$r={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},ht=()=>$r});function Ot(e){(0,f.match)(e).when(bt.isAxiosError,Wr).otherwise(()=>{u("Unexpected error while sending network request: %s",e)})}function Wr(e){return(0,f.match)(e).with({code:"ECONNABORTED"},()=>{u("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{u("Network connection aborted")}).with({code:"ECONNRESET"},()=>{u("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{u("Network connection timeout")}).with({response:f.P.not(f.P.nullish)},t=>{Mr(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{u(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:v(e)})})}function Mr(e,{status:t,data:o}){(0,f.match)(t).with(401,()=>{u(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{u(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,o)}).with(429,()=>{u(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{qr(e,o)}).otherwise(()=>{u(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:v(e)})})}function qr(e,t){(0,f.match)(t).with({code:te.MISSING_SUITE,message:f.P.string,errors:f.P.array(f.P.string)},async o=>{let{message:n,errors:a}=o;R(1),w(...yt(n,a)),F({id:E(),text:(0,wt.default)(ht(),null,2)}).then(g=>{w(`Please share this URL with Currents support for further investigation:
${g}`)}).catch(g=>{u("Failed to upload debug artifact: %s",g)}),R(1)}).with({code:te.RUN_CANCELLED,message:f.P.string},o=>{lt(o.message),dt()}).with({code:te.RUN_EXPIRED,message:f.P.string},o=>{u(o.message)}).with({message:f.P.string,errors:f.P.array(f.P.string)},o=>{let{message:n,errors:a}=o;R(1),u(...yt(n,a)),R(1)}).otherwise(()=>{u(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:v(e)})})}function yt(e,t){return xt.default.isString(e)?t?.length===0?[e]:[e,`
"use strict";var wr=Object.create;var W=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty;var a=(e,t)=>()=>(e&&(t=e(e=0)),t);var xe=(e,t)=>{for(var o in t)W(e,o,{get:t[o],enumerable:!0})},Or=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Cr(t))!xr.call(e,c)&&c!==o&&W(e,c,{get:()=>t[c],enumerable:!(n=yr(t,c))||n.enumerable});return e};var u=(e,t,o)=>(o=e!=null?wr(br(e)):{},Or(t||!e||!e.__esModule?W(o,"default",{value:e,enumerable:!0}):o,e));var r=a(()=>{"use strict"});var Oe=a(()=>{"use strict";r()});var ve=a(()=>{"use strict";r()});function Re(e){vr.push(e)}var vr,B=a(()=>{"use strict";r();vr=[]});var b,Rr,Tr,Er,Eo,P=a(()=>{"use strict";r();b={None:"none",Summary:"summary",Detailed:"detailed"},Rr={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},Tr={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},Er={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},Eo={[b.None]:Rr,[b.Summary]:Tr,[b.Detailed]:Er}});var Te,Ee,Se=a(()=>{"use strict";r();Te=[],Ee=[]});function Sr(e){return Pe?!!Pe[e]:!0}function k(e,t){Re(t),Sr(e)&&console.log(t)}var f,I,Pe,A,l,C,v,$o,jo,Lo,Mo,qo,Wo,Bo,zo,Go,s,Ho,Ie=a(()=>{"use strict";r();f=u(require("chalk")),I=u(require("util"));P();w();B();Se();Pe=null;A=(...e)=>{k("introAndSummary",I.default.format(...e))},l=(...e)=>{let t=I.default.format(...e);Ee.push(t),d("WARNING: ",t),k("warningsAndErrors",f.default.bgYellow.black(" WARNING ")+" "+t)},C=(...e)=>{let t=I.default.format(...e);Te.push(t),d("ERROR: ",t),k("warningsAndErrors",f.default.bgRed.white(" ERROR ")+" "+t)},v=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&k("introAndSummary",Array(t).fill("").join(`
`))},$o=f.default.cyan,jo=f.default.blueBright,Lo=f.default.red,Mo=f.default.yellow,qo=f.default.green,Wo=f.default.gray,Bo=f.default.white,zo=f.default.black,Go=f.default.magenta,s=f.default.dim,Ho=f.default.bold});var y=a(()=>{"use strict";r();B();Ie()});function G(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new z.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}function ke(e){if(!e)return;let t=["SIGUSR1","SIGUSR2"];if(!t.includes(e.toUpperCase().trim()))throw new z.CommanderError(255,"Invalid argument provided.","--pwc-reset-signal must be one of ("+t.join(", ")+"), provided: "+e);return e.toUpperCase().trim()}var z,H=a(()=>{"use strict";r();z=require("commander")});function h(e){return Ir[e]?.env}var Ir,K=a(()=>{"use strict";r();H();Ir={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"},discoveryOutputFile:{name:"Discovery Output File",env:"CURRENTS_DISCOVERY_OUTPUT_FILE",cli:"--pwc-discovery-output"}}});function Ae(e){return{ciBuildId:e.ciBuildId,projectId:e.projectId,recordKey:e.key,tag:e.tag,removeTitleTags:e.pwcRemoveTitleTags,cancelAfterFailures:e.pwcCancelAfterFailures,disableTestTags:e.pwcDisableTestTags||e.pwcDisableTitleTags,testSuiteFile:e.pwcTestSuiteFile,machineId:e.pwcMachineId,outputFile:e.pwcOutputFile,consoleOutput:e.pwcConsoleOutput,pwcConfigPath:e.pwcConfig,orchestration:{resetSignal:e.pwcResetSignal,skipReporterInjection:e.pwcSkipReporterInjection,batchSize:e.pwcBatchSize,discoveryOutputFile:e.pwcDiscoveryOutput},coverage:{projects:e.pwcCoverage,dir:e.pwcCoverageDir}}}var kr,nn,V=a(()=>{"use strict";r();kr=u(require("fs"));w();nn=d.extend("cli-options-serializer")});function De(){return Ar}var vn,Rn,Ar,J=a(()=>{"use strict";r();w();Oe();ve();y();P();K();V();P();vn=d.extend("config"),Rn={removeTitleTags:!1,disableTestTags:!1,consoleOutput:b.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},Ar=null});var Dr,Ue=a(()=>{"use strict";r();Dr=require("lodash");y()});var D=a(()=>{"use strict";r();J();K();V();Ue()});var Fe,Ne=a(()=>{Fe={name:"@currents/playwright",version:"2.0.0-alpha.0",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/regexp.escape":"^2.0.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.14.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.1.1","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","!src/*.md","!src/**/*.md","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var U,X=a(()=>{"use strict";r();Ne();U=Fe.version});function F(e={}){let t=_e.default.create(e);return t.interceptors.request.use(o=>{let n={...o},c=t.getUri(o),g=je.default.getProxyForUrl(c);return g&&(Nr("Using HTTP proxy %s for %s ",g,c),n.proxy=!1,n.httpsAgent=Fr(g)),n}),t}function Fr(e){return N||(N=new $e.HttpsProxyAgent(e),N)}var _e,$e,je,Nr,N,Y=a(()=>{"use strict";r();_e=u(require("axios")),$e=require("https-proxy-agent"),je=u(require("proxy-from-env"));w();Nr=d.extend("axios");N=null});var Z,Le,Me=a(()=>{"use strict";r();Z=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",Le=()=>3e4});var _r,Vn,qe=a(()=>{"use strict";r();_r=u(require("ws"));w();Vn=d.extend("ws")});var We,os,Be,ze=a(()=>{"use strict";r();We=u(require("events"));J();w();qe();Q();os=d.extend("pubsub"),Be=new We.default});var ee,He,Ge,Ke,Ve=a(()=>{"use strict";r();y();ze();ee={cancellationReason:null},He=e=>{ee.cancellationReason||(ee.cancellationReason=e)},Ge=()=>ee.cancellationReason,Ke=({showWarning:e=!0}={})=>{let t=Ge();t&&(e&&l("%s",t),Be.emit("runCancelled",t))}});var Q=a(()=>{"use strict";r();Ve()});var Je,R,te=a(()=>{"use strict";r();Je=require("nanoid"),R=(0,Je.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var Xe,$r,Ye,Ze=a(()=>{"use strict";r();Xe=require("ts-pattern"),$r={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},Ye=()=>$r});function ot(e){(0,m.match)(e).when(et.isAxiosError,jr).otherwise(()=>{l("Unexpected error while sending network request: %s",e)})}function jr(e){return(0,m.match)(e).with({code:"ECONNABORTED"},()=>{l("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{l("Network connection aborted")}).with({code:"ECONNRESET"},()=>{l("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{l("Network connection timeout")}).with({response:m.P.not(m.P.nullish)},t=>{Lr(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{l(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:T(e)})})}function Lr(e,{status:t,data:o}){(0,m.match)(t).with(401,()=>{l(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{l(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,o)}).with(429,()=>{l(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{Mr(e,o)}).otherwise(()=>{l(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:T(e)})})}function Mr(e,t){(0,m.match)(t).with({code:re.MISSING_SUITE,message:m.P.string,errors:m.P.array(m.P.string)},async o=>{let{message:n,errors:c}=o;v(1),C(...Qe(n,c)),_({id:R(),text:(0,tt.default)(Ye(),null,2)}).then(g=>{C(`Please share this URL with Currents support for further investigation:
${g}`)}).catch(g=>{l("Failed to upload debug artifact: %s",g)}),v(1)}).with({code:re.RUN_CANCELLED,message:m.P.string},o=>{He(o.message),Ke()}).with({code:re.RUN_EXPIRED,message:m.P.string},o=>{l(o.message)}).with({message:m.P.string,errors:m.P.array(m.P.string)},o=>{let{message:n,errors:c}=o;v(1),l(...Qe(n,c)),v(1)}).otherwise(()=>{l(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:T(e)})})}function Qe(e,t){return rt.default.isString(e)?t?.length===0?[e]:[e,`
${(t??[]).map(o=>` - ${o}`).join(`
`)}
`]:["Unexpected network error"]}function v(e){return e?.response?.headers["apigw-requestid"]}var bt,wt,xt,f,te,re=i(()=>{"use strict";r();bt=require("axios"),wt=p(require("json-stringify-safe")),xt=p(require("lodash")),f=require("ts-pattern");Z();ee();y();oe();Ct();te={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function vt(e,t,o){let n=o.method?.toUpperCase(),a=o.url,g=v(t),S=(0,Tt.default)(se(e)),T=`Network request '${n} ${a}' failed: '${t.message}'.${g?` Request ID: ${g}.`:""} Next attempt is in ${S} (${e}/${o["axios-retry"]?.retries||ie()}).`;Rt(T),u(T)}var ne,Tt,Rt,se,Et,ie,St=i(()=>{"use strict";r();ne=require("axios"),Tt=p(require("pretty-ms"));h();y();re();Rt=c.extend("http"),se=e=>[3*1e3,15*1e3,30*1e3][e-1],Et=e=>(Rt("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,ne.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,ne.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),ie=()=>3});function Kr(){let e=_({baseURL:Y(),timeout:nt(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:o}=t,n={...Hr,...o};return n.enableCompression&&(0,Ut.default)(t.data)>n.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await zr((0,Dt.default)(t.data))}):t}),e.interceptors.request.use(t=>{let o=t["axios-retry"]?.retryCount??0,n=Ye();t.headers.set({...Gr,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,Nt.nanoid)(),"x-pwc-request-attempt":o,"x-currents-key":n?.recordKey??null}),n?.orchestrationId&&t.headers.set("x-currents-orchestration-id",n.orchestrationId),n?.machineId&&t.headers.set("x-currents-machine-id",n.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let a={...kt.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return o?It("network request retry: %o",Pt({...a,isRetry:!0})):It("network request: %o",Pt(a)),t}),(0,At.default)(e,{retries:ie(),retryCondition:Et,retryDelay:se,shouldResetTimeout:!0,onRetry:vt}),e}function jt(){return j||(j=Kr(),j)}function Pt(e){return{method:e.method,baseUrl:Y(),url:e.url,data:e.isRetry?"<retry>":Vr(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function Vr(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var At,Dt,kt,Nt,Ut,_t,Ft,It,Br,Gr,zr,j,Hr,Lt=i(()=>{"use strict";r();At=p(require("axios-retry")),Dt=p(require("json-stringify-safe")),kt=p(require("lodash")),Nt=require("nanoid"),Ut=p(require("object-sizeof")),_t=require("util"),Ft=p(require("zlib"));k();h();J();X();st();St();It=c.extend("http"),Br=1024*1024*1,Gr={"x-pw-version":"0.0.0","x-pwc-version":N},zr=(0,_t.promisify)(Ft.default.gzip),j=null,Hr={enableCompression:!1,compressThresholdBytes:Br}});async function Mt(e,t=jt){try{let o=await t().request(e);return $t("network response: %o",{...Wt.default.omit(o,"request","config"),url:o.config.url,method:o.config.method}),o}catch(o){let n=o;throw $t("network error: %o",{code:n.code,message:n.message,url:n.config?.url,method:n.config?.method,status:n.response?.status,headers:n.response?.headers,data:n.response?.data}),Ot(n),n}}var Wt,$t,qt=i(()=>{"use strict";r();Wt=p(require("lodash"));h();Lt();re();$t=c.extend("http")});var Bt=i(()=>{"use strict";r();qt()});var Gt={};We(Gt,{getDebugUrl:()=>Jr});var Jr,zt=i(()=>{"use strict";r();Bt();Jr=({runId:e,type:t})=>Mt({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(o=>o.data)});function Xr(e,t){return Jt({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function Jt(e,t,o){let n=await Kt.default.readFile(e.path);return ae("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(n)}),Xt(n,e.uploadUrl,t,o)}async function Yr(e,t,o){return ae("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),Xt(e.buffer,e.uploadUrl,t,o)}async function Zr(e,t,o,n){return _().request({method:"put",url:t,data:e,onUploadProgress:n,headers:{"Content-Disposition":"inline","Content-Type":o}})}async function Xt(...e){await(0,Ht.default)(async()=>{await Zr(...e)},{retries:5,onRetry:(t,o)=>{if(ae(`Upload failed %d out of 5 attempts: %s
%o`,o,t.message,t.response?.data),o===5){w(`Cannot upload after ${o} times: ${t.message}`);return}u(`Upload failed ${o} out of 5 attempts: ${t.message}`)}})}var Ht,Kt,ae,Vt,Yt=i(()=>{"use strict";r();Ht=p(require("async-retry")),Kt=p(require("fs/promises"));h();X();y();ae=c.extend("upload"),Vt=(a=>(a.PNG="image/png",a.WEBM="video/webm",a.TEXT="text/plain",a.ZIP="application/zip",a))(Vt||{})});var Zt={};We(Zt,{ContentType:()=>Vt,sendBuffer:()=>Yr,sendPath:()=>Jt,uploadText:()=>Xr});var Qt=i(()=>{"use strict";r();Yt()});async function F(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(zt(),Gt));try{let{readUrl:o,uploadUrl:n}=await t({runId:e.id,type:"pw-debug"}),{uploadText:a,sendBuffer:g}=await Promise.resolve().then(()=>(Qt(),Zt));return"text"in e&&await g({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:n},"text/plain",void 0),"path"in e&&await a(e.path,n),o}catch{return null}}var ue,pe=i(()=>{"use strict";r();ue=p(require("debug"))});function Qr(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var er,O,ce=i(()=>{"use strict";r();er=require("@commander-js/extra-typings"),O=new er.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(Qr).env("CURRENTS_DEBUG")});var tr,rr,or=i(()=>{"use strict";r();tr=require("@commander-js/extra-typings");ce();rr=()=>new tr.Command().allowUnknownOption().allowExcessArguments(!0).addOption(O).helpOption(!1)});var x,nr,de,sr,ir,le,L,ge=i(()=>{"use strict";r();x=p(require("debug")),nr=p(require("fs")),de=p(require("path")),sr=p(require("util")),ir=require("fs/promises");ee();y();or();pe();x.default.useColors=function(){return!1};le=x.default.log,L=class e{constructor(t="core"){this.source=t;this.pipelines={};if(this.mode=rr().parse().opts().pwcDebug??!1,this.debug=(0,x.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let o=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(x.default.enable(o),!this.shouldUploadRemoteDebug())return this;let n=E(),a=de.default.resolve(".currents-debug"),g=de.default.resolve(a,`${n}.log`);(0,ir.mkdir)(a,{recursive:!0}),D(d(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),d(g));let S=nr.default.createWriteStream(g,{flags:"a"});return x.default.log=(...T)=>{this.mode&&(S.write(`${sr.default.formatWithOptions({colors:!1},...T)}
`),this.shouldMuteLocalStdout()||le(...T))},this.pipelines[n]={id:n,writeStream:S,type:this.source,tempFilePath:g},this}static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let o=Object.keys(this.pipelines);o.length===0&&(this.debug("No debug pipelines found"),x.default.log=le);for(let n of o)await this.uploadDebug(n,t??E())}catch{}finally{x.default.log=le}}async uploadDebug(t,o){let n=this.pipelines[t];if(!n){this.debug("No debug pipeline found for id %s",t);return}D(d(`\u{1F47E} ${n.type} debug log written:`),d(n?.tempFilePath));try{let a=await F({id:o,path:n.tempFilePath});n?.writeStream.end(),D(d(`\u{1F47E} ${n.type} debug log uploaded:`),d(a))}catch(a){u(`Failed to upload ${n.type}} debug log ${d(n.tempFilePath)}: ${a.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var oe=i(()=>{"use strict";r();pe();ge()});var c,h=i(()=>{"use strict";r();oe();c=(0,ue.default)("currents")});r();var Ui=require("source-map-support/register"),yr=require("commander");h();r();var fe;async function ar(){if(fe)return fe;let{execa:e}=await import("execa");return fe=e,e}y();ge();r();var hr=p(require("fs"));k();h();r();var me=p(require("fs")),ur=require("tmp-promise"),pr=async()=>{let{path:e}=await(0,ur.file)();return e};r();var _e=require("@commander-js/extra-typings"),Fe=p(require("chalk"));J();y();r();var l=require("@commander-js/extra-typings"),cr=require("commander");k();z();ce();var he=new l.Option("--pwc-config <path>","path to currents config file (currents.config.[ts|js])").env(C("currentsConfigFile")),Ce=new l.Option("--ci-build-id <id>","the unique identifier for a run").env(C("ciBuildId")),ye=new l.Option("-k, --key <record-key>","your secret Record Key obtained from Currents").env(C("recordKey")),be=new l.Option("-p, --project-id <project>","the project ID for results reporting obtained from Currents").env(C("projectId")),we=new l.Option("-t, --tag <tag>","comma-separated tag(s) for recorded runs in Currents").argParser(ke),xe=new l.Option("--pwc-remove-title-tags","remove tags from test names in Currents, e.g. `Test name @smoke` becomes `Test name` in the dashboard"),Oe=new l.Option("--pwc-disable-title-tags","[DEPRECATED] Use --pwc-disable-test-tags instead"),Te=new l.Option("--pwc-disable-test-tags","disable reporting tags defined on the test or suite level, or extracted from the test title"),Re=new l.Option("--pwc-cancel-after-failures <number | false>","abort the cloud run after the specified number of failed tests detected. Overrides the default Currents Project settings. If set, must be a positive integer or 'false' to disable automatic cancellations").env(C("cancelAfterFailures")).argParser(G),Ee=new l.Option("--pwc-output-file <string>","path to the file where the run summary output will be written.").env(C("outputFile")),ve=new l.Option("--pwc-console-output <preset>","reporter console output: none (no stdout), summary (intro + one line per test + summary), detailed (full output)").choices(Object.values(b)).env(C("consoleOutput")),Se=new l.Option("--pwc-test-suite-file <path>","path to the full test suite file for orchestration and reporting").env(C("testSuiteFile")).hideHelp(),Ie=new l.Option("--pwc-machine-id <string>","unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId").env(C("machineId")),Pe=new l.Option("--pwc-orchestration-id <string>","unique identifier of the orchestration session this run belongs to. See: https://docs.currents.dev/?q=orchestrationId").env(C("orchestrationId")).hideHelp();var Ae=new l.Option("--pwc-inspect","enable inspect mode, run playwright with --inspect-brk flag or developments and debugging").default(!1).hideHelp(),lr=new l.Option("--pwc-reset-signal <'SIGUSR1' | 'SIGUSR2'>","specify a process signal to listen for to trigger a reset of the current in progress tests. Only avaiable on OSes with POSIX signal support.").argParser(Je),De=new l.Option("--reporter <reporter>","Reporter to use, comma-separated").argParser(ke).hideHelp(),dr=new l.Option("--last-failed","Run last failed tests").default(!1).hideHelp(),gr=new l.Option("--pwc-skip-reporter-injection","Do not inject @currents/playwright reporter via CLI, use the reporter specified in the playwright config");function ke(e,t=[]){return e?t.concat(e.split(",").map(o=>o.trim())):t}var Ne=new l.Option("--pwc-coverage [projects...]","Comma-separated list of projects to collect coverage for, e.g. `project1,project2`. If no projects are specified, coverage will be collected for all projects.").argParser(ke),Ue=new l.Option("--pwc-coverage-dir <path>","Path to the directory where coverage reports will be read from"),fr=new l.Option("--pwc-batch-size <'auto' | number>","Set the number of parallel workers for orchestration. Use 'auto' to match the number of Playwright workers. If a number is provided, it must be a positive integer.").default("auto").env(C("batchSize")).argParser(e=>{if(e==="auto")return e;let t=Number(e);if(!isNaN(t)&&Number.isInteger(t)&&t>0)return t;throw new cr.InvalidArgumentError('Provide either "auto" or a positive integer.')});var je=(e=Le())=>e.version(N),eo=`
----------------------------------------------------
`]:["Unexpected network error"]}function T(e){return e?.response?.headers["apigw-requestid"]}var et,tt,rt,m,re,oe=a(()=>{"use strict";r();et=require("axios"),tt=u(require("json-stringify-safe")),rt=u(require("lodash")),m=require("ts-pattern");Q();te();y();ne();Ze();re={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function at(e,t,o){let n=o.method?.toUpperCase(),c=o.url,g=T(t),S=(0,nt.default)(ie(e)),O=`Network request '${n} ${c}' failed: '${t.message}'.${g?` Request ID: ${g}.`:""} Next attempt is in ${S} (${e}/${o["axios-retry"]?.retries||ae()}).`;st(O),l(O)}var se,nt,st,ie,it,ae,pt=a(()=>{"use strict";r();se=require("axios"),nt=u(require("pretty-ms"));w();y();oe();st=d.extend("http"),ie=e=>[3*1e3,15*1e3,30*1e3][e-1],it=e=>(st("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,se.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,se.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),ae=()=>3});function Gr(){let e=F({baseURL:Z(),timeout:Le(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:o}=t,n={...zr,...o};return n.enableCompression&&(0,ft.default)(t.data)>n.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await Br((0,dt.default)(t.data))}):t}),e.interceptors.request.use(t=>{let o=t["axios-retry"]?.retryCount??0,n=De();t.headers.set({...Wr,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,mt.nanoid)(),"x-pwc-request-attempt":o,"x-currents-key":n?.recordKey??null}),n?.orchestrationId&&t.headers.set("x-currents-orchestration-id",n.orchestrationId),n?.machineId&&t.headers.set("x-currents-machine-id",n.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let c={...gt.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return o?ct("network request retry: %o",ut({...c,isRetry:!0})):ct("network request: %o",ut(c)),t}),(0,lt.default)(e,{retries:ae(),retryCondition:it,retryDelay:ie,shouldResetTimeout:!0,onRetry:at}),e}function yt(){return $||($=Gr(),$)}function ut(e){return{method:e.method,baseUrl:Z(),url:e.url,data:e.isRetry?"<retry>":Hr(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function Hr(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var lt,dt,gt,mt,ft,ht,wt,ct,qr,Wr,Br,$,zr,Ct=a(()=>{"use strict";r();lt=u(require("axios-retry")),dt=u(require("json-stringify-safe")),gt=u(require("lodash")),mt=require("nanoid"),ft=u(require("object-sizeof")),ht=require("util"),wt=u(require("zlib"));D();w();X();Y();Me();pt();ct=d.extend("http"),qr=1024*1024*1,Wr={"x-pw-version":"0.0.0","x-pwc-version":U},Br=(0,ht.promisify)(wt.default.gzip),$=null,zr={enableCompression:!1,compressThresholdBytes:qr}});async function Ot(e,t=yt){try{let o=await t().request(e);return bt("network response: %o",{...xt.default.omit(o,"request","config"),url:o.config.url,method:o.config.method}),o}catch(o){let n=o;throw bt("network error: %o",{code:n.code,message:n.message,url:n.config?.url,method:n.config?.method,status:n.response?.status,headers:n.response?.headers,data:n.response?.data}),ot(n),n}}var xt,bt,vt=a(()=>{"use strict";r();xt=u(require("lodash"));w();Ct();oe();bt=d.extend("http")});var Rt=a(()=>{"use strict";r();vt()});var Tt={};xe(Tt,{getDebugUrl:()=>Kr});var Kr,Et=a(()=>{"use strict";r();Rt();Kr=({runId:e,type:t})=>Ot({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(o=>o.data)});function Vr(e,t){return kt({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function kt(e,t,o){let n=await Pt.default.readFile(e.path);return pe("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(n)}),At(n,e.uploadUrl,t,o)}async function Jr(e,t,o){return pe("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),At(e.buffer,e.uploadUrl,t,o)}async function Xr(e,t,o,n){return F().request({method:"put",url:t,data:e,onUploadProgress:n,headers:{"Content-Disposition":"inline","Content-Type":o}})}async function At(...e){await(0,St.default)(async()=>{await Xr(...e)},{retries:5,onRetry:(t,o)=>{if(pe(`Upload failed %d out of 5 attempts: %s
%o`,o,t.message,t.response?.data),o===5){C(`Cannot upload after ${o} times: ${t.message}`);return}l(`Upload failed ${o} out of 5 attempts: ${t.message}`)}})}var St,Pt,pe,It,Dt=a(()=>{"use strict";r();St=u(require("async-retry")),Pt=u(require("fs/promises"));w();Y();y();pe=d.extend("upload"),It=(c=>(c.PNG="image/png",c.WEBM="video/webm",c.TEXT="text/plain",c.ZIP="application/zip",c))(It||{})});var Ut={};xe(Ut,{ContentType:()=>It,sendBuffer:()=>Jr,sendPath:()=>kt,uploadText:()=>Vr});var Nt=a(()=>{"use strict";r();Dt()});async function _(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(Et(),Tt));try{let{readUrl:o,uploadUrl:n}=await t({runId:e.id,type:"pw-debug"}),{uploadText:c,sendBuffer:g}=await Promise.resolve().then(()=>(Nt(),Ut));return"text"in e&&await g({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:n},"text/plain",void 0),"path"in e&&await c(e.path,n),o}catch{return null}}var ce,ue=a(()=>{"use strict";r();ce=u(require("debug"))});function Yr(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var Ft,E,le=a(()=>{"use strict";r();Ft=require("@commander-js/extra-typings"),E=new Ft.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(Yr).env("CURRENTS_DEBUG")});var _t,$t,jt=a(()=>{"use strict";r();_t=require("@commander-js/extra-typings");le();$t=()=>new _t.Command().allowUnknownOption().allowExcessArguments(!0).addOption(E).helpOption(!1)});var x,Lt,ge,Mt,qt,de,j,me=a(()=>{"use strict";r();x=u(require("debug")),Lt=u(require("fs")),ge=u(require("path")),Mt=u(require("util")),qt=require("fs/promises");te();y();jt();ue();x.default.useColors=function(){return!1};de=x.default.log,j=class e{constructor(t="core"){this.source=t;if(this.mode=$t().parse().opts().pwcDebug??!1,this.debug=(0,x.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let o=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(x.default.enable(o),!this.shouldUploadRemoteDebug())return this;let n=R(),c=ge.default.resolve(".currents-debug"),g=ge.default.resolve(c,`${n}.log`);(0,qt.mkdir)(c,{recursive:!0}),A(s(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),s(g));let S=Lt.default.createWriteStream(g,{flags:"a"});return x.default.log=(...O)=>{this.mode&&(S.write(`${Mt.default.formatWithOptions({colors:!1},...O)}
`),this.shouldMuteLocalStdout()||de(...O))},this.pipelines[n]={id:n,writeStream:S,type:this.source,tempFilePath:g},this}source;static instance;static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}pipelines={};mode;debug;getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let o=Object.keys(this.pipelines);o.length===0&&(this.debug("No debug pipelines found"),x.default.log=de);for(let n of o)await this.uploadDebug(n,t??R())}catch{}finally{x.default.log=de}}async uploadDebug(t,o){let n=this.pipelines[t];if(!n){this.debug("No debug pipeline found for id %s",t);return}A(s(`\u{1F47E} ${n.type} debug log written:`),s(n?.tempFilePath));try{let c=await _({id:o,path:n.tempFilePath});n?.writeStream.end(),A(s(`\u{1F47E} ${n.type} debug log uploaded:`),s(c))}catch(c){l(`Failed to upload ${n.type}} debug log ${s(n.tempFilePath)}: ${c.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var ne=a(()=>{"use strict";r();ue();me()});var d,w=a(()=>{"use strict";r();ne();d=(0,ce.default)("currents")});r();var Zi=require("source-map-support/register"),hr=require("commander");w();r();var fe;async function Wt(){if(fe)return fe;let{execa:e}=await import("execa");return fe=e,e}y();me();r();var mr=u(require("fs"));D();w();r();var he=u(require("fs")),Bt=require("tmp-promise"),zt=async()=>{let{path:e}=await(0,Bt.file)();return e};r();var ur=require("@commander-js/extra-typings"),L=u(require("chalk")),fo=require("commander");X();y();r();var p=require("@commander-js/extra-typings"),Gt=require("commander");D();H();le();var Ht=new p.Option("--pwc-config <path>","path to currents config file (currents.config.[ts|js])").env(h("currentsConfigFile")),Kt=new p.Option("--ci-build-id <id>","the unique identifier for a run").env(h("ciBuildId")),Vt=new p.Option("-k, --key <record-key>","your secret Record Key obtained from Currents").env(h("recordKey")),Jt=new p.Option("-p, --project-id <project>","the project ID for results reporting obtained from Currents").env(h("projectId")),Xt=new p.Option("-t, --tag <tag>","comma-separated tag(s) for recorded runs in Currents").argParser(we),Yt=new p.Option("--pwc-remove-title-tags","remove tags from test names in Currents, e.g. `Test name @smoke` becomes `Test name` in the dashboard"),Zt=new p.Option("--pwc-disable-title-tags","[DEPRECATED] Use --pwc-disable-test-tags instead"),Qt=new p.Option("--pwc-disable-test-tags","disable reporting tags defined on the test or suite level, or extracted from the test title"),er=new p.Option("--pwc-cancel-after-failures <number | false>","abort the cloud run after the specified number of failed tests detected. Overrides the default Currents Project settings. If set, must be a positive integer or 'false' to disable automatic cancellations").env(h("cancelAfterFailures")).argParser(G),tr=new p.Option("--pwc-output-file <string>","path to the file where the run summary output will be written.").env(h("outputFile")),Zr=new p.Option("--pwc-discovery-output <file>","path used by `pwc-p discover` to write its discovery output and by `pwc-p run` to read it").env(h("discoveryOutputFile")),Qr=new p.Option("--list","ignored (discover always runs playwright with --list)").hideHelp(),eo=new p.Option("--reporter <reporters>","ignored (discover always runs playwright with --reporter=list)").hideHelp(),rr=new p.Option("--pwc-console-output <preset>","reporter console output: none (no stdout), summary (intro + one line per test + summary), detailed (full output)").choices(Object.values(b)).env(h("consoleOutput")),or=new p.Option("--pwc-test-suite-file <path>","path to the full test suite file for orchestration and reporting").env(h("testSuiteFile")).hideHelp(),nr=new p.Option("--pwc-machine-id <string>","unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId").env(h("machineId")),sr=new p.Option("--pwc-orchestration-id <string>","unique identifier of the orchestration session this run belongs to. See: https://docs.currents.dev/?q=orchestrationId").env(h("orchestrationId")).hideHelp();var ir=new p.Option("--pwc-inspect","enable inspect mode, run playwright with --inspect-brk flag or developments and debugging").default(!1).hideHelp(),to=new p.Option("--pwc-reset-signal <'SIGUSR1' | 'SIGUSR2'>","specify a process signal to listen for to trigger a reset of the current in progress tests. Only avaiable on OSes with POSIX signal support.").argParser(ke),ar=new p.Option("--reporter <reporter>","Reporter to use, comma-separated").argParser(we).hideHelp(),ro=new p.Option("-c, --config <file>","Playwright configuration file path"),oo=new p.Option("--tsconfig <path>","Path to a single tsconfig applicable to all imported files"),no=new p.Option("--test-list <file>","Path to a file containing a list of tests to run (Playwright --test-list)"),so=new p.Option("--project <name...>","Only run tests from the specified Playwright projects (variadic)"),io=new p.Option("-j, --workers <workers>","Number of concurrent workers or percentage of logical CPU cores per shard"),ao=new p.Option("--timeout <ms>","Per-test timeout in milliseconds"),po=new p.Option("--headed","Run tests in headed browsers"),co=new p.Option("--output <dir>","Folder for output artifacts"),uo=new p.Option("--ignore-snapshots","Ignore screenshot and snapshot expectations"),lo=new p.Option("--fail-on-flaky-tests","Fail the run if any test is flagged as flaky");var go=new p.Option("--pwc-skip-reporter-injection","Do not inject @currents/playwright reporter via CLI, use the reporter specified in the playwright config");function we(e,t=[]){return e?t.concat(e.split(",").map(o=>o.trim())):t}var pr=new p.Option("--pwc-coverage [projects...]","Comma-separated list of projects to collect coverage for, e.g. `project1,project2`. If no projects are specified, coverage will be collected for all projects.").argParser(we),cr=new p.Option("--pwc-coverage-dir <path>","Path to the directory where coverage reports will be read from"),mo=new p.Option("--pwc-batch-size <'auto' | number>","Set the number of parallel workers for orchestration. Use 'auto' to match the number of Playwright workers. If a number is provided, it must be a positive integer.").default("auto").env(h("batchSize")).argParser(e=>{if(e==="auto")return e;let t=Number(e);if(!isNaN(t)&&Number.isInteger(t)&&t>0)return t;throw new Gt.InvalidArgumentError('Provide either "auto" or a positive integer.')});var lr=(e=Ce())=>e.version(U),ye=`----------------------------------------------------
\u{1F4D6} Documentation: https://docs.currents.dev
\u{1F919} Support: support@currents.dev
----------------------------------------------------
----------------------------------------------------`,ho=`
${ye}
${Fe.default.bold("Examples")}
${L.default.bold("Examples")}
Run all tests in the current directory:
${d("pwc --key <record-key> --project-id <id> --ci-build-id <build-id>")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id>")}
Run only tests filtered by the tag "@smoke":
${d("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
Run playwright tests and add tags "tagA", "tagB" to the recorded run:
${d("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
Provide playwright arguments and flags:
${d("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000 --shard 1/2")}
`,to=`
----------------------------------------------------
\u{1F4D6} Documentation: https://docs.currents.dev
\u{1F919} Support: support@currents.dev
----------------------------------------------------
${s("pwc --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000 --shard 1/2")}
`,dr=`
${Fe.default.bold("Examples")}
${L.default.bold("Examples")}
Orchestrate all tests in the current directory:
${d("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id>")}
Discover tests (writes the test discovery output for ${s("pwc-p run")}):
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --pwc-discovery-output tests.txt")}
Orchestrate only tests filtered by the tag "@smoke":
${d("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> --grep smoke")}
Orchestrate with extra Playwright runtime flags (supported subset only):
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> -j 4 --timeout 60000")}
Filter with grep / last-failed (${s("pwc-p discover")} passes flags through to Playwright):
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt --grep @smoke")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --pwc-discovery-output tests.txt")}
Orchestrate playwright tests and add tags "tagA", "tagB" to the recorded run:
${d("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
${s("pwc-p run --key <record-key> --project-id <id> --ci-build-id <build-id> --tag tagA --tag tagB")}
`,ji=`
${ye}${dr}`,Li=`
${ye}
Add additional playwright arguments and flags:
${d("pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000")}
`,Le=()=>new _e.Command().name("pwc").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u{1F3AD} Run Playwright tests on CI using https://currents.dev
${eo}`).addOption(Ce).addOption(ye).addOption(be).addOption(we).addOption(he).addOption(xe).addOption(Te).addOption(Oe).addOption(Re).addOption(Ee).addOption(ve).addOption(Se).addOption(Ie).addOption(Pe).addOption(Ae).addOption(O).addOption(Ne).addOption(Ue).addOption(De).action(function(){this.opts().pwcDisableTitleTags&&u(`${d("--pwc-disable-title-tags")} has been renamed to ${d("--pwc-disable-test-tags")}.`)}),mr=()=>new _e.Command().name("pwc-p").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u2728 Orchestrate \u{1F3AD} Playwright tests on CI using https://currents.dev
${to}`).addOption(Ce).addOption(ye).addOption(be).addOption(we).addOption(he).addOption(xe).addOption(Te).addOption(Oe).addOption(Re).addOption(Ee).addOption(ve).addOption(Se).addOption(Ie).addOption(Pe).addOption(lr).addOption(Ae).addOption(O).addOption(De).addOption(dr).addOption(gr).addOption(Ne).addOption(Ue).addOption(fr).action(function(){this.opts().pwcDisableTitleTags&&u(`${d("--pwc-disable-title-tags")} has been renamed to ${d("--pwc-disable-test-tags")}.`)});var $e=c.extend("cli-manager"),$=class{constructor(t={isOrchestration:!1}){this.configFilePath=null;this.program=t.isOrchestration?je(mr()):je(Le()),this.cliOptions=this.program.parse().opts(),$e("CLI options: %o",this.cliOptions),this.parsedConfig=Xe(this.cliOptions),$e("Parsed config from CLI options: %o",this.parsedConfig)}getCLIReporters(){return this.cliOptions.reporter?.filter(t=>!/@currents/.test(t))||[]}async getConfigFilePath(){if(this.configFilePath)return this.configFilePath;let t=await pr();return hr.default.writeFileSync(t,JSON.stringify(this.parsedConfig)),$e("CLI options temp file path: %s",t),this.configFilePath=t,t}};var Cr=c.extend("pwc");require("dotenv").config({quiet:!0});var W=L.factory("pwc");async function ro(){let e=new $;return await(await ar())("playwright",["test","--reporter",["@currents/playwright",...e.getCLIReporters()].join(","),...e.program.args],{stdio:"inherit",reject:!1,env:{...process.env,CURRENTS_DEBUG:String(W.getDebugMode()),CURRENTS_PWC_CLI_CONFIG_PATH:await e.getConfigFilePath()}})}ro().then(async e=>{Cr("execa result: %o",e),await W.finalize(),process.exit(e.exitCode??0)}).catch(async e=>{e instanceof yr.CommanderError&&(w(e.message),await W.finalize(),process.exit(e.exitCode)),Cr("execa failed: %o",e),await W.finalize(),process.exit(1)});
${s("pwc-p discover")} records which tests match your filters; ${s("pwc-p run")} executes them in parallel via Currents.
See ${L.default.bold("Commands")} below for summaries and examples, or ${s("pwc-p discover --help")} / ${s("pwc-p run --help")} for every flag.
`,Mi=`Runs test discovery with the same argv passthrough as ${s("pwc")} (${s("-c")}/${s("--config")}, ${s("--grep")}, ${s("--last-failed")}, projects, etc.).
Writes discovery output to ${s("--pwc-discovery-output")}, ${s("CURRENTS_DISCOVERY_OUTPUT_FILE")}, or ${s("orchestration.discoveryOutputFile")} for ${s("pwc-p run")}.
Example:
${s("pwc-p discover -c ./playwright.config.ts --pwc-discovery-output tests.txt")}`,qi=`Orchestrates Playwright runs in parallel through Currents.
Playwright filter flags (${s("--grep")}, ${s("--last-failed")}, etc.) are not accepted here: run ${s("pwc-p discover")} first, then pass ${s("--pwc-discovery-output")}, ${s("--test-list")}, or ${s("orchestration.discoveryOutputFile")}.
${dr}`;function gr(e){return e.code==="commander.helpDisplayed"||e.code==="commander.help"||e.code==="commander.version"}var Ce=()=>new ur.Command().name("pwc").usage("[options] [playwright arguments and flags]").allowUnknownOption().allowExcessArguments(!0).showHelpAfterError("(add --help for additional information)").description(`\u{1F3AD} Run Playwright tests on CI using https://currents.dev
${ho}`).addOption(Kt).addOption(Vt).addOption(Jt).addOption(Xt).addOption(Ht).addOption(Yt).addOption(Qt).addOption(Zt).addOption(er).addOption(tr).addOption(rr).addOption(or).addOption(nr).addOption(sr).addOption(ir).addOption(E).addOption(pr).addOption(cr).addOption(ar).action(function(){this.opts().pwcDisableTitleTags&&l(`${s("--pwc-disable-title-tags")} has been renamed to ${s("--pwc-disable-test-tags")}.`)});var be=d.extend("cli-manager"),M=class{program;cliOptions;parsedConfig;configFilePath=null;constructor(t={isOrchestration:!1}){if(t.isOrchestration){if(!t.runCommand)throw new Error("CLIManager: orchestration mode requires `runCommand` (parsed `pwc-p run` Commander instance).");this.program=t.runCommand,this.cliOptions=t.runCommand.opts()}else this.program=lr(Ce()),this.cliOptions=this.program.parse().opts();be("CLI options: %o",this.cliOptions),this.parsedConfig=Ae(this.cliOptions),be("Parsed config from CLI options: %o",this.parsedConfig)}getCLIReporters(){return this.cliOptions.reporter?.filter(t=>!/@currents/.test(t))||[]}async getConfigFilePath(){if(this.configFilePath)return this.configFilePath;let t=await zt();return mr.default.writeFileSync(t,JSON.stringify(this.parsedConfig)),be("CLI options temp file path: %s",t),this.configFilePath=t,this.configFilePath}};var fr=d.extend("pwc");require("dotenv").config({quiet:!0});var q=j.factory("pwc");async function wo(){let e=new M;return await(await Wt())("playwright",["test","--reporter",["@currents/playwright",...e.getCLIReporters()].join(","),...e.program.args],{stdio:"inherit",reject:!1,env:{...process.env,CURRENTS_DEBUG:String(q.getDebugMode()),CURRENTS_PWC_CLI_CONFIG_PATH:await e.getConfigFilePath()}})}wo().then(async e=>{fr("execa result: %o",e),await q.finalize(),process.exit(e.exitCode??0)}).catch(async e=>{e instanceof hr.CommanderError&&(gr(e)||C(e.message),await q.finalize(),process.exit(e.exitCode)),fr("execa failed: %o",e),await q.finalize(),process.exit(1)});
//# sourceMappingURL=pwc.js.map
import * as playwright_test from 'playwright/test';
import { BrowserContext } from '@playwright/test';
import { C as CurrentsConfig } from './config-_KX-9D1i.js';
export { a as ConsoleOutputPreset, O as OrchestrationStatus } from './config-_KX-9D1i.js';
import { Reporter, TestCase, TestResult, FullConfig, Suite, TestError, TestStep, FullResult } from '@playwright/test/reporter';
import { C as CurrentsConfig } from './config-B9q-aV6V.js';
export { a as ConsoleOutputPreset, O as OrchestrationStatus } from './config-B9q-aV6V.js';
import { Reporter, FullConfig, TestCase, TestResult, Suite, TestError, TestStep, FullResult } from '@playwright/test/reporter';

@@ -176,5 +176,8 @@ type GhaEventData = {

printsToStdio(): boolean;
version(): "v2";
onConfigure(config: FullConfig): void;
onStdOut(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
onStdErr(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
onBegin(config: FullConfig, suite: Suite): void;
/** Supports v2 (`onBegin(suite)`) and published TS shape (`onBegin(config, suite)`). */
onBegin(configOrSuite: FullConfig | Suite, suite?: Suite): void;
onError(error: TestError): void;

@@ -181,0 +184,0 @@ onStepBegin(test: TestCase, result: TestResult, step: TestStep): void;

import { Suite, FullConfig, Reporter, TestError } from '@playwright/test/reporter';
import { C as CurrentsConfig } from '../config-_KX-9D1i.js';
import { C as CurrentsConfig } from '../config-B9q-aV6V.js';
import { FullConfig as FullConfig$1 } from '@playwright/test';

@@ -7,15 +7,3 @@

type LastRunStatus = "failed" | "passed";
type LastRunFileData = {
status: LastRunStatus;
failedTests: string[];
};
type LastRunDataForProject = {
project: string;
path: string;
data: LastRunFileData | null;
};
type LastRunData = LastRunDataForProject[];
declare function getFullTestSuite(suite: Suite, config: FullConfig): {
declare function getNativeFullTestSuite(suite: Suite, config: FullConfig): {
name: string;

@@ -67,6 +55,6 @@ tags: string[];

pwSuite: Suite | null;
lastRunData: LastRunData | null;
fullSuite: ReturnType<typeof getFullTestSuite> | null;
fullSuite: ReturnType<typeof getNativeFullTestSuite> | null;
printer: OrchestrationPrinter | null;
remoteDebug: RemoteDebug;
private parentNotified;
constructor(reporterOptions: Partial<CurrentsConfig>);

@@ -76,2 +64,3 @@ printsToStdio(): boolean;

onError(err: TestError): void;
onExit(): Promise<void>;
private getOrchestrationAPI;

@@ -78,0 +67,0 @@ onEnd(): Promise<void>;

@@ -1,15 +0,15 @@

"use strict";var pn=Object.create;var K=Object.defineProperty;var En=Object.getOwnPropertyDescriptor;var dn=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var fe=(e,t)=>{for(var r in t)K(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of dn(t))!_n.call(e,s)&&s!==r&&K(e,s,{get:()=>t[s],enumerable:!(n=En(t,s))||n.enumerable});return e};var l=(e,t,r)=>(r=e!=null?pn(gn(e)):{},et(t||!e||!e.__esModule?K(r,"default",{value:e,enumerable:!0}):r,e)),fn=e=>et(K({},"__esModule",{value:!0}),e);var o=u(()=>{"use strict"});var rt,tt=u(()=>{rt={name:"@currents/playwright",version:"1.23.3",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/randomstring":"^1.3.0","@types/regexp.escape":"^2.0.0","@types/shelljs":"^0.10.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.13.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsconfig:"*",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4",wtfnode:"^0.10.1"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.0.0","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var j,Ie=u(()=>{"use strict";o();tt();j=rt.version});function Y(e={}){let t=nt.default.create(e);return t.interceptors.request.use(r=>{let n={...r},s=t.getUri(r),i=st.default.getProxyForUrl(s);return i&&(mn("Using HTTP proxy %s for %s ",i,s),n.proxy=!1,n.httpsAgent=Rn(i)),n}),t}function Rn(e){return W||(W=new ot.HttpsProxyAgent(e),W)}var nt,ot,st,mn,W,me=u(()=>{"use strict";o();nt=l(require("axios")),ot=require("https-proxy-agent"),st=l(require("proxy-from-env"));I();mn=c.extend("axios");W=null});var Re,it,at=u(()=>{"use strict";o();Re=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",it=()=>3e4});function ut(e){Cn.push(e)}var Cn,Ce=u(()=>{"use strict";o();Cn=[]});function pt(e){return{...e&&Object.prototype.hasOwnProperty.call(lt,e)?lt[e]:ct}}var b,Tn,On,ct,lt,V=u(()=>{"use strict";o();b={None:"none",Summary:"summary",Detailed:"detailed"},Tn={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},On={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},ct={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},lt={[b.None]:Tn,[b.Summary]:On,[b.Detailed]:ct}});var Et,dt,gt=u(()=>{"use strict";o();Et=[],dt=[]});function _t(e){Te=e}function Sn(e){return Te?!!Te[e]:!0}function v(e,t){ut(t),Sn(e)&&console.log(t)}var R,$,Te,D,p,T,Oe,Un,G,Se,zo,Xo,Zo,es,ts,rs,ns,os,d,ss,ft=u(()=>{"use strict";o();R=l(require("chalk")),$=l(require("util"));V();I();Ce();gt();Te=null;D=(...e)=>{v("introAndSummary",$.default.format(...e))},p=(...e)=>{let t=$.default.format(...e);dt.push(t),c("WARNING: ",t),v("warningsAndErrors",R.default.bgYellow.black(" WARNING ")+" "+t)},T=(...e)=>{let t=$.default.format(...e);Et.push(t),c("ERROR: ",t),v("warningsAndErrors",R.default.bgRed.white(" ERROR ")+" "+t)},Oe=()=>{v("introAndSummary",`
`+Un()+`
`)},Un=()=>R.default.dim(Array(64).fill("=").join("")),G=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&v("introAndSummary",Array(t).fill("").join(`
`))},Se=R.default.cyan,zo=R.default.blueBright,Xo=R.default.red,Zo=R.default.yellow,es=R.default.green,ts=R.default.gray,rs=R.default.white,ns=R.default.black,os=R.default.magenta,d=R.default.dim,ss=R.default.bold});var S=u(()=>{"use strict";o();Ce();ft()});async function q(e){await Dn(),await new Promise((t,r)=>{if(!A){r(new Error("WebSocket is not initialized"));return}J("sending message to ws: %o, %o",A.url,e),A.send(JSON.stringify(e),n=>{n?r(n):t()})})}function mt(){A&&A.close()}async function Dn(){if(A){J("ws already initialized");return}let e=parseInt(process.env.CURRENTS_PWCP_WSS_PORT);J("setting port to %s",e),await new Promise(t=>{A=new It.default(`ws://localhost:${e}`),A.on("open",()=>{J("ws opened"),t(null)})})}var It,J,A,Ue=u(()=>{"use strict";o();It=l(require("ws"));I();J=c.extend("ws"),A=null});var Rt,ms,Ct,Tt=u(()=>{"use strict";o();Rt=l(require("events"));De();I();Ue();he();ms=c.extend("pubsub"),Ct=new Rt.default});var Le,St,Ot,Ut,ht=u(()=>{"use strict";o();S();Tt();Le={cancellationReason:null},St=e=>{Le.cancellationReason||(Le.cancellationReason=e)},Ot=()=>Le.cancellationReason,Ut=({showWarning:e=!0}={})=>{let t=Ot();t&&(e&&p("%s",t),Ct.emit("runCancelled",t))}});var he=u(()=>{"use strict";o();ht()});var Dt,P,Q=u(()=>{"use strict";o();Dt=require("nanoid"),P=(0,Dt.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var Lt,Ln,At,Nt=u(()=>{"use strict";o();Lt=require("ts-pattern"),Ln={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},At=()=>Ln});function Mt(e){(0,m.match)(e).when(Pt.isAxiosError,An).otherwise(()=>{p("Unexpected error while sending network request: %s",e)})}function An(e){return(0,m.match)(e).with({code:"ECONNABORTED"},()=>{p("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{p("Network connection aborted")}).with({code:"ECONNRESET"},()=>{p("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{p("Network connection timeout")}).with({response:m.P.not(m.P.nullish)},t=>{Nn(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{p(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:F(e)})})}function Nn(e,{status:t,data:r}){(0,m.match)(t).with(401,()=>{p(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{p(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,r)}).with(429,()=>{p(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{Bn(e,r)}).otherwise(()=>{p(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:F(e)})})}function Bn(e,t){(0,m.match)(t).with({code:Ae.MISSING_SUITE,message:m.P.string,errors:m.P.array(m.P.string)},async r=>{let{message:n,errors:s}=r;G(1),T(...Bt(n,s)),z({id:P(),text:(0,yt.default)(At(),null,2)}).then(i=>{T(`Please share this URL with Currents support for further investigation:
${i}`)}).catch(i=>{p("Failed to upload debug artifact: %s",i)}),G(1)}).with({code:Ae.RUN_CANCELLED,message:m.P.string},r=>{St(r.message),Ut()}).with({code:Ae.RUN_EXPIRED,message:m.P.string},r=>{p(r.message)}).with({message:m.P.string,errors:m.P.array(m.P.string)},r=>{let{message:n,errors:s}=r;G(1),p(...Bt(n,s)),G(1)}).otherwise(()=>{p(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:F(e)})})}function Bt(e,t){return bt.default.isString(e)?t?.length===0?[e]:[e,`
"use strict";var so=Object.create;var j=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var ao=Object.getOwnPropertyNames;var uo=Object.getPrototypeOf,lo=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var de=(e,t)=>{for(var r in t)j(e,r,{get:t[r],enumerable:!0})},Xe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ao(t))!lo.call(e,s)&&s!==r&&j(e,s,{get:()=>t[s],enumerable:!(o=io(t,s))||o.enumerable});return e};var l=(e,t,r)=>(r=e!=null?so(uo(e)):{},Xe(t||!e||!e.__esModule?j(r,"default",{value:e,enumerable:!0}):r,e)),co=e=>Xe(j({},"__esModule",{value:!0}),e);var n=u(()=>{"use strict"});var et,Ze=u(()=>{et={name:"@currents/playwright",version:"2.0.0-alpha.0",main:"./dist/index.js",author:{name:"Currents Software Inc",email:"hello@currents.dev",url:"https://currents.dev"},license:"MIT",homepage:"https://currents.dev",repository:{type:"git",url:"https://github.com/currents-dev/currents-playwright-changelog.git"},scripts:{test:"vitest",rm:"rimraf dist",lint:'TIMING=1 eslint "**/*.ts*"',build:"tsup-node --minify --dts",dev:"tsup-node --watch --dts",release:"release-it --verbose","publish:npm":"npm run rm && npm run build && ./publish.js","release-ci":"npm run rm && npm run build && ./publish.js -t latest"},bin:{pwc:"./dist/bin/pwc.js","pwc-p":"./dist/bin/pwc-p.js"},devDependencies:{"@playwright/test":"^1.56.1","@release-it/conventional-changelog":"^11.0.0","@types/async-retry":"^1.4.5","@types/babel__code-frame":"^7.0.3","@types/debug":"^4.1.13","@types/getos":"^3.0.4","@types/istanbul-lib-coverage":"^2.0.6","@types/json-stringify-safe":"^5.0.3","@types/lodash":"^4.17.24","@types/pluralize":"^0.0.33","@types/proxy-from-env":"^1.0.4","@types/regexp.escape":"^2.0.0","@types/stack-utils":"^2.0.3","@types/tmp":"^0.2.6","@types/ws":"^8.18.1",eslint:"^9.39.2","eslint-config-custom":"*",msw:"^2.14.2","release-it":"^20.0.1",rimraf:"^6.1.3",tsup:"^8.5.0",typescript:"^6.0.3",vitest:"^4.1.4"},dependencies:{"@babel/code-frame":"^7.29.0","@commander-js/extra-typings":"^13.1.0","@currents/commit-info":"1.0.1-beta.0","async-retry":"^1.3.3",axios:"^1.16.0","axios-retry":"4.5.0",chalk:"^4.1.2",commander:"^13.1.0","date-fns":"^4.1.0",debug:"^4.4.3",dotenv:"^17.2.3",execa:"^9.6.0",getos:"^3.2.1","https-proxy-agent":"^7.0.5","istanbul-lib-coverage":"^3.2.2",jiti:"2.6.1","json-stringify-safe":"^5.0.1","lil-http-terminator":"^1.2.3",lodash:"^4.18.1",nanoid:"^3.3.8","object-sizeof":"^2.6.5","p-debounce":"^2.1.0","p-map":"^4.0.0","p-queue":"6.6.2",pluralize:"^8.0.0","pretty-ms":"^7.0.1","proxy-from-env":"^1.1.0","regexp.escape":"^2.0.1","safe-regex2":"^5.1.1","source-map-support":"^0.5.21","stack-utils":"^2.0.6",tmp:"^0.2.5","tmp-promise":"^3.0.3","ts-pattern":"^5.8.0",ws:"^8.18.3"},files:["dist","!**/*.map","!**/*/*.map","**/*.LEGAL.txt","!src/*.md","!src/**/*.md","LICENSE.md","README.md","CHANGELOG.md"],keywords:["playwright","playwright dashboard","cloud dashboard","reporter","currents","tests reporter","sorry cypress","ci"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./discovery":{import:"./dist/reporters/discovery.js",require:"./dist/reporters/discovery.js"},"./orchestration":{import:"./dist/orchestration/index.js",require:"./dist/orchestration/index.js"},"./package.json":"./package.json"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},"release-it":{npm:{publish:!1},github:{release:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",header:"# Changelog",ignoreVersion:!0,infile:"../../CHANGELOG.md"}},git:{commitMessage:"chore: release v${version}",tagName:"v${version}"},hooks:{"before:github:release":"npm run --prefix ../../ update-public-changelog"}}}});var W,_e=u(()=>{"use strict";n();Ze();W=et.version});function V(e={}){let t=tt.default.create(e);return t.interceptors.request.use(r=>{let o={...r},s=t.getUri(r),a=ot.default.getProxyForUrl(s);return a&&(po("Using HTTP proxy %s for %s ",a,s),o.proxy=!1,o.httpsAgent=_o(a)),o}),t}function _o(e){return Y||(Y=new rt.HttpsProxyAgent(e),Y)}var tt,rt,ot,po,Y,ge=u(()=>{"use strict";n();tt=l(require("axios")),rt=require("https-proxy-agent"),ot=l(require("proxy-from-env"));m();po=c.extend("axios");Y=null});var Ie,nt,st=u(()=>{"use strict";n();Ie=()=>process.env.CURRENTS_API_URL??"https://cy.currents.dev",nt=()=>3e4});function it(e){go.push(e)}var go,me=u(()=>{"use strict";n();go=[]});function lt(e){return{...e&&Object.prototype.hasOwnProperty.call(at,e)?at[e]:ut}}var y,Io,mo,ut,at,$=u(()=>{"use strict";n();y={None:"none",Summary:"summary",Detailed:"detailed"},Io={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},mo={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},ut={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},at={[y.None]:Io,[y.Summary]:mo,[y.Detailed]:ut}});var ct,Et,pt=u(()=>{"use strict";n();ct=[],Et=[]});function dt(e){fe=e}function fo(e){return fe?!!fe[e]:!0}function x(e,t){it(t),fo(e)&&console.log(t)}var R,J,fe,D,E,T,Ce,Co,G,Re,jn,Wn,Yn,Vn,$n,Jn,Qn,qn,d,zn,_t=u(()=>{"use strict";n();R=l(require("chalk")),J=l(require("util"));$();m();me();pt();fe=null;D=(...e)=>{x("introAndSummary",J.default.format(...e))},E=(...e)=>{let t=J.default.format(...e);Et.push(t),c("WARNING: ",t),x("warningsAndErrors",R.default.bgYellow.black(" WARNING ")+" "+t)},T=(...e)=>{let t=J.default.format(...e);ct.push(t),c("ERROR: ",t),x("warningsAndErrors",R.default.bgRed.white(" ERROR ")+" "+t)},Ce=()=>{x("introAndSummary",`
`+Co()+`
`)},Co=()=>R.default.dim(Array(64).fill("=").join("")),G=(e=2)=>{let t=Math.max(0,Math.floor(e));t!==0&&x("introAndSummary",Array(t).fill("").join(`
`))},Re=R.default.cyan,jn=R.default.blueBright,Wn=R.default.red,Yn=R.default.yellow,Vn=R.default.green,$n=R.default.gray,Jn=R.default.white,Qn=R.default.black,qn=R.default.magenta,d=R.default.dim,zn=R.default.bold});var S=u(()=>{"use strict";n();me();_t()});async function H(e){await To(),await new Promise((t,r)=>{if(!A){r(new Error("WebSocket is not initialized"));return}Q("sending message to ws: %o, %o",A.url,e),A.send(JSON.stringify(e),o=>{o?r(o):t()})})}function It(){A&&A.close()}async function To(){if(A){Q("ws already initialized");return}let e=parseInt(process.env.CURRENTS_PWCP_WSS_PORT);Q("setting port to %s",e),await new Promise(t=>{A=new gt.default(`ws://localhost:${e}`),A.on("open",()=>{Q("ws opened"),t(null)})})}var gt,Q,A,Te=u(()=>{"use strict";n();gt=l(require("ws"));m();Q=c.extend("ws"),A=null});var mt,cs,ft,Ct=u(()=>{"use strict";n();mt=l(require("events"));Ue();m();Te();Oe();cs=c.extend("pubsub"),ft=new mt.default});var Se,Tt,Rt,Ot,Ut=u(()=>{"use strict";n();S();Ct();Se={cancellationReason:null},Tt=e=>{Se.cancellationReason||(Se.cancellationReason=e)},Rt=()=>Se.cancellationReason,Ot=({showWarning:e=!0}={})=>{let t=Rt();t&&(e&&E("%s",t),ft.emit("runCancelled",t))}});var Oe=u(()=>{"use strict";n();Ut()});var St,P,q=u(()=>{"use strict";n();St=require("nanoid"),P=(0,St.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});var ht,Oo,Dt,Lt=u(()=>{"use strict";n();ht=require("ts-pattern"),Oo={outcome:null,scannerConfig:null,currentsConfig:null,internalConfig:null},Dt=()=>Oo});function yt(e){(0,f.match)(e).when(Bt.isAxiosError,Uo).otherwise(()=>{E("Unexpected error while sending network request: %s",e)})}function Uo(e){return(0,f.match)(e).with({code:"ECONNABORTED"},()=>{E("Network connection aborted")}).with({code:"ECONNREFUSED"},()=>{E("Network connection aborted")}).with({code:"ECONNRESET"},()=>{E("Network connection reset")}).with({code:"ETIMEDOUT"},()=>{E("Network connection timeout")}).with({response:f.P.not(f.P.nullish)},t=>{So(t,{status:t.response.status,data:t.response.data})}).otherwise(t=>{E(`[currents] Unexpected network error: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,payload:e.response?.config.data,requestId:F(e)})})}function So(e,{status:t,data:r}){(0,f.match)(t).with(401,()=>{E(`[currents] ${e.response?.config.method} ${e.response?.config.url}} - 401 Unauthorized Request from cloud service`)}).with(400,()=>{E(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 400 Bad Request from cloud service:
%o`,r)}).with(429,()=>{E(`[currents] ${e.response?.config.method} ${e.response?.config.url} - 429 Too Many Requests from cloud service`)}).with(422,()=>{ho(e,r)}).otherwise(()=>{E(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:F(e)})})}function ho(e,t){(0,f.match)(t).with({code:he.MISSING_SUITE,message:f.P.string,errors:f.P.array(f.P.string)},async r=>{let{message:o,errors:s}=r;G(1),T(...At(o,s)),z({id:P(),text:(0,Nt.default)(Dt(),null,2)}).then(a=>{T(`Please share this URL with Currents support for further investigation:
${a}`)}).catch(a=>{E("Failed to upload debug artifact: %s",a)}),G(1)}).with({code:he.RUN_CANCELLED,message:f.P.string},r=>{Tt(r.message),Ot()}).with({code:he.RUN_EXPIRED,message:f.P.string},r=>{E(r.message)}).with({message:f.P.string,errors:f.P.array(f.P.string)},r=>{let{message:o,errors:s}=r;G(1),E(...At(o,s)),G(1)}).otherwise(()=>{E(`[currents] Unexpected network response: %s
%O`,e.message,{method:e.response?.config.method,url:e.response?.config.url,status:e.response?.status,requestId:F(e)})})}function At(e,t){return Pt.default.isString(e)?t?.length===0?[e]:[e,`
${(t??[]).map(r=>` - ${r}`).join(`
`)}
`]:["Unexpected network error"]}function F(e){return e?.response?.headers["apigw-requestid"]}var Pt,yt,bt,m,Ae,Ne=u(()=>{"use strict";o();Pt=require("axios"),yt=l(require("json-stringify-safe")),bt=l(require("lodash")),m=require("ts-pattern");he();Q();S();Be();Nt();Ae={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function Gt(e,t,r){let n=r.method?.toUpperCase(),s=r.url,i=F(t),E=(0,xt.default)(ye(e)),_=`Network request '${n} ${s}' failed: '${t.message}'.${i?` Request ID: ${i}.`:""} Next attempt is in ${E} (${e}/${r["axios-retry"]?.retries||be()}).`;wt(_),p(_)}var Pe,xt,wt,ye,vt,be,Ft=u(()=>{"use strict";o();Pe=require("axios"),xt=l(require("pretty-ms"));I();S();Ne();wt=c.extend("http"),ye=e=>[3*1e3,15*1e3,30*1e3][e-1],vt=e=>(wt("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,Pe.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,Pe.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),be=()=>3});function Qt(e){qt["x-pw-version"]=e??"0.0.0"}function Mn(){let e=Y({baseURL:Re(),timeout:it(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:r}=t,n={...bn,...r};return n.enableCompression&&(0,Vt.default)(t.data)>n.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await yn((0,jt.default)(t.data))}):t}),e.interceptors.request.use(t=>{let r=t["axios-retry"]?.retryCount??0,n=N();t.headers.set({...qt,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,Yt.nanoid)(),"x-pwc-request-attempt":r,"x-currents-key":n?.recordKey??null}),n?.orchestrationId&&t.headers.set("x-currents-orchestration-id",n.orchestrationId),n?.machineId&&t.headers.set("x-currents-machine-id",n.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let s={...Wt.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return r?Ht("network request retry: %o",kt({...s,isRetry:!0})):Ht("network request: %o",kt(s)),t}),(0,Kt.default)(e,{retries:be(),retryCondition:vt,retryDelay:ye,shouldResetTimeout:!0,onRetry:Gt}),e}function zt(){return X||(X=Mn(),X)}function kt(e){return{method:e.method,baseUrl:Re(),url:e.url,data:e.isRetry?"<retry>":xn(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function xn(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var Kt,jt,Wt,Yt,Vt,$t,Jt,Ht,Pn,qt,yn,X,bn,Me=u(()=>{"use strict";o();Kt=l(require("axios-retry")),jt=l(require("json-stringify-safe")),Wt=l(require("lodash")),Yt=require("nanoid"),Vt=l(require("object-sizeof")),$t=require("util"),Jt=l(require("zlib"));y();I();Ie();me();at();Ft();Ht=c.extend("http"),Pn=1024*1024*1,qt={"x-pw-version":"0.0.0","x-pwc-version":j},yn=(0,$t.promisify)(Jt.default.gzip);X=null,bn={enableCompression:!1,compressThresholdBytes:Pn}});async function M(e,t=zt){try{let r=await t().request(e);return Xt("network response: %o",{...Zt.default.omit(r,"request","config"),url:r.config.url,method:r.config.method}),r}catch(r){let n=r;throw Xt("network error: %o",{code:n.code,message:n.message,url:n.config?.url,method:n.config?.method,status:n.response?.status,headers:n.response?.headers,data:n.response?.data}),Mt(n),n}}var Zt,Xt,er=u(()=>{"use strict";o();Zt=l(require("lodash"));I();Me();Ne();Xt=c.extend("http")});var xe=u(()=>{"use strict";o();er()});var tr={};fe(tr,{getDebugUrl:()=>wn});var wn,rr=u(()=>{"use strict";o();xe();wn=({runId:e,type:t})=>M({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(r=>r.data)});function vn(e,t){return ir({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function ir(e,t,r){let n=await or.default.readFile(e.path);return we("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(n)}),ar(n,e.uploadUrl,t,r)}async function Gn(e,t,r){return we("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),ar(e.buffer,e.uploadUrl,t,r)}async function Fn(e,t,r,n){return Y().request({method:"put",url:t,data:e,onUploadProgress:n,headers:{"Content-Disposition":"inline","Content-Type":r}})}async function ar(...e){await(0,nr.default)(async()=>{await Fn(...e)},{retries:5,onRetry:(t,r)=>{if(we(`Upload failed %d out of 5 attempts: %s
%o`,r,t.message,t.response?.data),r===5){T(`Cannot upload after ${r} times: ${t.message}`);return}p(`Upload failed ${r} out of 5 attempts: ${t.message}`)}})}var nr,or,we,sr,ur=u(()=>{"use strict";o();nr=l(require("async-retry")),or=l(require("fs/promises"));I();me();S();we=c.extend("upload"),sr=(s=>(s.PNG="image/png",s.WEBM="video/webm",s.TEXT="text/plain",s.ZIP="application/zip",s))(sr||{})});var lr={};fe(lr,{ContentType:()=>sr,sendBuffer:()=>Gn,sendPath:()=>ir,uploadText:()=>vn});var cr=u(()=>{"use strict";o();ur()});async function z(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(rr(),tr));try{let{readUrl:r,uploadUrl:n}=await t({runId:e.id,type:"pw-debug"}),{uploadText:s,sendBuffer:i}=await Promise.resolve().then(()=>(cr(),lr));return"text"in e&&await i({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:n},"text/plain",void 0),"path"in e&&await s(e.path,n),r}catch{return null}}var ve,Ge=u(()=>{"use strict";o();ve=l(require("debug"))});function Hn(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var pr,Er,dr=u(()=>{"use strict";o();pr=require("@commander-js/extra-typings"),Er=new pr.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(Hn).env("CURRENTS_DEBUG")});var gr,_r,fr=u(()=>{"use strict";o();gr=require("@commander-js/extra-typings");dr();_r=()=>new gr.Command().allowUnknownOption().allowExcessArguments(!0).addOption(Er).helpOption(!1)});var B,Ir,He,mr,Rr,Fe,Z,ke=u(()=>{"use strict";o();B=l(require("debug")),Ir=l(require("fs")),He=l(require("path")),mr=l(require("util")),Rr=require("fs/promises");Q();S();fr();Ge();B.default.useColors=function(){return!1};Fe=B.default.log,Z=class e{constructor(t="core"){this.source=t;this.pipelines={};if(this.mode=_r().parse().opts().pwcDebug??!1,this.debug=(0,B.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let r=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(B.default.enable(r),!this.shouldUploadRemoteDebug())return this;let n=P(),s=He.default.resolve(".currents-debug"),i=He.default.resolve(s,`${n}.log`);(0,Rr.mkdir)(s,{recursive:!0}),D(d(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),d(i));let E=Ir.default.createWriteStream(i,{flags:"a"});return B.default.log=(..._)=>{this.mode&&(E.write(`${mr.default.formatWithOptions({colors:!1},..._)}
`),this.shouldMuteLocalStdout()||Fe(..._))},this.pipelines[n]={id:n,writeStream:E,type:this.source,tempFilePath:i},this}static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let r=Object.keys(this.pipelines);r.length===0&&(this.debug("No debug pipelines found"),B.default.log=Fe);for(let n of r)await this.uploadDebug(n,t??P())}catch{}finally{B.default.log=Fe}}async uploadDebug(t,r){let n=this.pipelines[t];if(!n){this.debug("No debug pipeline found for id %s",t);return}D(d(`\u{1F47E} ${n.type} debug log written:`),d(n?.tempFilePath));try{let s=await z({id:r,path:n.tempFilePath});n?.writeStream.end(),D(d(`\u{1F47E} ${n.type} debug log uploaded:`),d(s))}catch(s){p(`Failed to upload ${n.type}} debug log ${d(n.tempFilePath)}: ${s.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var Be=u(()=>{"use strict";o();Ge();ke()});var c,I=u(()=>{"use strict";o();Be();c=(0,ve.default)("currents")});var ee,Cr=u(()=>{"use strict";o();ee=class extends Error{}});var H,Ke=u(()=>{"use strict";o();H={guide:{ciBuildId:"https://docs.currents.dev/guides/ci-build-id",integration:"https://docs.currents.dev/integration-with-playwright/currents-playwright"}}});function Or(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new Tr.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}var Tr,Sr=u(()=>{"use strict";o();Tr=require("commander")});function te(e){return C[e]?.env}function re(e){return C[e].cli}function Ur(e){return C[e].name}function hr(){return{projectId:process.env[C.projectId.env],recordKey:process.env[C.recordKey.env],ciBuildId:process.env[C.ciBuildId.env],tag:process.env[C.tag.env]?process.env[C.tag.env]?.split(",").map(e=>e.trim()):void 0,cancelAfterFailures:Or(process.env[C.cancelAfterFailures.env]),disableTestTags:process.env[C.disableTestTags.env]||process.env[C.disableTitleTags.env],consoleOutput:process.env[C.consoleOutput.env],testSuiteFile:process.env[C.testSuiteFile.env],machineId:process.env[C.machineId.env],orchestrationId:process.env[C.orchestrationId.env]}}var C,je=u(()=>{"use strict";o();Sr();C={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"}}});function x(){if(We)return We;if(process.env.CURRENTS_PWC_CLI_CONFIG_PATH)try{let e=JSON.parse(Lr.default.readFileSync(process.env.CURRENTS_PWC_CLI_CONFIG_PATH).toString());return Dr("Options from serialized CLI config file: %o",e),We=e,e}catch(e){return Dr("Could not read CLI config file: %o",e),{}}return{}}var Lr,Dr,We,Ye=u(()=>{"use strict";o();Lr=l(require("fs"));I();Dr=c.extend("cli-options-serializer"),We=null});function Ar(e,t,r={validationFn:Je}){Ve("reporter options: %o",e),Ve("config file options: %o",t);let n={...O($e),...O(t),...O(e),...O(x()),...O(hr()),orchestration:{...O($e.orchestration),...O(t?.orchestration),...O(e?.orchestration),...O(x().orchestration)},coverage:{...O($e.coverage),...O(t?.coverage),...O(e?.coverage),...O(x().coverage)}};n.disableTitleTags!==void 0&&(n.disableTestTags=n.disableTestTags||n.disableTitleTags),r.validationFn(n),ne=n,_t(pt(ne?.consoleOutput)),Ve("resolved currents config: %o",ne)}function Je(e){kn.forEach(t=>{if(!e[t])throw T(`${Ur(t)} is required for Currents Reporter. Use the following methods:
`]:["Unexpected network error"]}function F(e){return e?.response?.headers["apigw-requestid"]}var Bt,Nt,Pt,f,he,De=u(()=>{"use strict";n();Bt=require("axios"),Nt=l(require("json-stringify-safe")),Pt=l(require("lodash")),f=require("ts-pattern");Oe();q();S();Le();Lt();he={RUN_CANCELLED:"RUN_CANCELLED",RUN_EXPIRED:"RUN_EXPIRED",MISSING_SUITE:"MISSING_SUITE"}});function wt(e,t,r){let o=r.method?.toUpperCase(),s=r.url,a=F(t),p=(0,bt.default)(Be(e)),C=`Network request '${o} ${s}' failed: '${t.message}'.${a?` Request ID: ${a}.`:""} Next attempt is in ${p} (${e}/${r["axios-retry"]?.retries||Ne()}).`;Mt(C),E(C)}var Ae,bt,Mt,Be,vt,Ne,xt=u(()=>{"use strict";n();Ae=require("axios"),bt=l(require("pretty-ms"));m();S();De();Mt=c.extend("http"),Be=e=>[3*1e3,15*1e3,30*1e3][e-1],vt=e=>(Mt("isRetriableError: %o",{message:e.message,code:"code"in e?e.code:void 0,status:"response"in e?e.response?.status:void 0,headers:"response"in e?e.response?.headers:void 0,data:"response"in e?e.response?.data:void 0,isAxiosError:(0,Ae.isAxiosError)(e)}),"code"in e&&e.code&&["ECONNABORTED","ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENETRESET","ENOTFOUND","EAI_AGAIN"].includes(e.code)?!0:(0,Ae.isAxiosError)(e)?[429,500,502,503,504].includes(e.response?.status??0):!1),Ne=()=>3});function Jt(e){$t["x-pw-version"]=e??"0.0.0"}function Bo(){let e=V({baseURL:Ie(),timeout:nt(),transitional:{clarifyTimeoutError:!0}});return e.interceptors.request.use(async t=>{let{currentsOptions:r}=t,o={...Ao,...r};return o.enableCompression&&(0,Wt.default)(t.data)>o.compressThresholdBytes?(t.headers["Content-Encoding"]="gzip",{...t,data:await Lo((0,kt.default)(t.data))}):t}),e.interceptors.request.use(t=>{let r=t["axios-retry"]?.retryCount??0,o=B();t.headers.set({...$t,"Accept-Encoding":"gzip, deflate, br","x-currents-idempotency-key":t.headers["x-currents-idempotency-key"]??(0,jt.nanoid)(),"x-pwc-request-attempt":r,"x-currents-key":o?.recordKey??null}),o?.orchestrationId&&t.headers.set("x-currents-orchestration-id",o.orchestrationId),o?.machineId&&t.headers.set("x-currents-machine-id",o.machineId),t.headers.get("Content-Type")||t.headers.set("Content-Type","application/json");let s={...Kt.default.pick(t,"method","url","headers"),data:Buffer.isBuffer(t.data)?"buffer":t.data};return r?Gt("network request retry: %o",Ht({...s,isRetry:!0})):Gt("network request: %o",Ht(s)),t}),(0,Ft.default)(e,{retries:Ne(),retryCondition:vt,retryDelay:Be,shouldResetTimeout:!0,onRetry:wt}),e}function Qt(){return X||(X=Bo(),X)}function Ht(e){return{method:e.method,baseUrl:Ie(),url:e.url,data:e.isRetry?"<retry>":No(e.data),headers:{...e.headers,"x-currents-key":"***"}}}function No(e){return e?.results?.raw?{...e,results:{...e.results,raw:"***"}}:e}var Ft,kt,Kt,jt,Wt,Yt,Vt,Gt,Do,$t,Lo,X,Ao,Pe=u(()=>{"use strict";n();Ft=l(require("axios-retry")),kt=l(require("json-stringify-safe")),Kt=l(require("lodash")),jt=require("nanoid"),Wt=l(require("object-sizeof")),Yt=require("util"),Vt=l(require("zlib"));b();m();_e();ge();st();xt();Gt=c.extend("http"),Do=1024*1024*1,$t={"x-pw-version":"0.0.0","x-pwc-version":W},Lo=(0,Yt.promisify)(Vt.default.gzip);X=null,Ao={enableCompression:!1,compressThresholdBytes:Do}});async function M(e,t=Qt){try{let r=await t().request(e);return qt("network response: %o",{...zt.default.omit(r,"request","config"),url:r.config.url,method:r.config.method}),r}catch(r){let o=r;throw qt("network error: %o",{code:o.code,message:o.message,url:o.config?.url,method:o.config?.method,status:o.response?.status,headers:o.response?.headers,data:o.response?.data}),yt(o),o}}var zt,qt,Xt=u(()=>{"use strict";n();zt=l(require("lodash"));m();Pe();De();qt=c.extend("http")});var ye=u(()=>{"use strict";n();Xt()});var Zt={};de(Zt,{getDebugUrl:()=>Po});var Po,er=u(()=>{"use strict";n();ye();Po=({runId:e,type:t})=>M({method:"POST",url:"runs/debug-logs",data:{type:t,runId:e}}).then(r=>r.data)});function yo(e,t){return nr({path:e,name:null,uploadUrl:t,contentType:"text/plain"},"text/plain",void 0)}async function nr(e,t,r){let o=await rr.default.readFile(e.path);return be("Uploading file %s",e.uploadUrl,{buffer:Buffer.byteLength(o)}),sr(o,e.uploadUrl,t,r)}async function bo(e,t,r){return be("Uploading buffer %s",e.name,{buffer:Buffer.byteLength(e.buffer)}),sr(e.buffer,e.uploadUrl,t,r)}async function Mo(e,t,r,o){return V().request({method:"put",url:t,data:e,onUploadProgress:o,headers:{"Content-Disposition":"inline","Content-Type":r}})}async function sr(...e){await(0,tr.default)(async()=>{await Mo(...e)},{retries:5,onRetry:(t,r)=>{if(be(`Upload failed %d out of 5 attempts: %s
%o`,r,t.message,t.response?.data),r===5){T(`Cannot upload after ${r} times: ${t.message}`);return}E(`Upload failed ${r} out of 5 attempts: ${t.message}`)}})}var tr,rr,be,or,ir=u(()=>{"use strict";n();tr=l(require("async-retry")),rr=l(require("fs/promises"));m();ge();S();be=c.extend("upload"),or=(s=>(s.PNG="image/png",s.WEBM="video/webm",s.TEXT="text/plain",s.ZIP="application/zip",s))(or||{})});var ar={};de(ar,{ContentType:()=>or,sendBuffer:()=>bo,sendPath:()=>nr,uploadText:()=>yo});var ur=u(()=>{"use strict";n();ir()});async function z(e){let{getDebugUrl:t}=await Promise.resolve().then(()=>(er(),Zt));try{let{readUrl:r,uploadUrl:o}=await t({runId:e.id,type:"pw-debug"}),{uploadText:s,sendBuffer:a}=await Promise.resolve().then(()=>(ur(),ar));return"text"in e&&await a({name:`${e.id}-discovery-debug.log`,buffer:Buffer.from(e.text,"utf-8"),contentType:"text/plain",uploadUrl:o},"text/plain",void 0),"path"in e&&await s(e.path,o),r}catch{return null}}var Me,ve=u(()=>{"use strict";n();Me=l(require("debug"))});function vo(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var lr,cr,Er=u(()=>{"use strict";n();lr=require("@commander-js/extra-typings"),cr=new lr.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(vo).env("CURRENTS_DEBUG")});var pr,dr,_r=u(()=>{"use strict";n();pr=require("@commander-js/extra-typings");Er();dr=()=>new pr.Command().allowUnknownOption().allowExcessArguments(!0).addOption(cr).helpOption(!1)});var N,gr,xe,Ir,mr,we,Z,Ge=u(()=>{"use strict";n();N=l(require("debug")),gr=l(require("fs")),xe=l(require("path")),Ir=l(require("util")),mr=require("fs/promises");q();S();_r();ve();N.default.useColors=function(){return!1};we=N.default.log,Z=class e{constructor(t="core"){this.source=t;if(this.mode=dr().parse().opts().pwcDebug??!1,this.debug=(0,N.default)(`currents:remote-debug:${this.source}`),!this.mode)return this;if(!this.shouldEnableDebug())return this;let r=process.env.DEBUG?`${process.env.DEBUG},currents*`:"currents*";if(N.default.enable(r),!this.shouldUploadRemoteDebug())return this;let o=P(),s=xe.default.resolve(".currents-debug"),a=xe.default.resolve(s,`${o}.log`);(0,mr.mkdir)(s,{recursive:!0}),D(d(`\u{1F47E} Initiated remote ${this.source} debug log collection:`),d(a));let p=gr.default.createWriteStream(a,{flags:"a"});return N.default.log=(...C)=>{this.mode&&(p.write(`${Ir.default.formatWithOptions({colors:!1},...C)}
`),this.shouldMuteLocalStdout()||we(...C))},this.pipelines[o]={id:o,writeStream:p,type:this.source,tempFilePath:a},this}source;static instance;static factory(t="core"){return this.instance||(this.instance=new e(t)),this.instance}pipelines={};mode;debug;getDebugMode(){return this.mode}async finalize({runId:t}={runId:void 0}){try{let r=Object.keys(this.pipelines);r.length===0&&(this.debug("No debug pipelines found"),N.default.log=we);for(let o of r)await this.uploadDebug(o,t??P())}catch{}finally{N.default.log=we}}async uploadDebug(t,r){let o=this.pipelines[t];if(!o){this.debug("No debug pipeline found for id %s",t);return}D(d(`\u{1F47E} ${o.type} debug log written:`),d(o?.tempFilePath));try{let s=await z({id:r,path:o.tempFilePath});o?.writeStream.end(),D(d(`\u{1F47E} ${o.type} debug log uploaded:`),d(s))}catch(s){E(`Failed to upload ${o.type}} debug log ${d(o.tempFilePath)}: ${s.message}`)}}shouldEnableDebug(){return this.mode==="full"||this.mode==="remote"||this.mode===!0}shouldUploadRemoteDebug(){return this.mode==="full"||this.mode==="remote"}shouldMuteLocalStdout(){return this.mode==="remote"}}});var Le=u(()=>{"use strict";n();ve();Ge()});var c,m=u(()=>{"use strict";n();Le();c=(0,Me.default)("currents")});var ee,fr=u(()=>{"use strict";n();ee=class extends Error{}});var k,He=u(()=>{"use strict";n();k={guide:{ciBuildId:"https://docs.currents.dev/guides/ci-build-id",integration:"https://docs.currents.dev/integration-with-playwright/currents-playwright"}}});function Rr(e){if(!e)return;if(e==="false")return!1;let t=parseInt(e,10);if(isNaN(t)||t<1)throw new Cr.CommanderError(255,"Invalid argument provided.","--pwc-cancel-after-failures must be a positive integer or 'false', provided: "+e);return t}var Cr,Tr=u(()=>{"use strict";n();Cr=require("commander")});function te(e){return I[e]?.env}function re(e){return I[e].cli}function Or(e){return I[e].name}function Fe(){return{projectId:process.env[I.projectId.env],recordKey:process.env[I.recordKey.env],ciBuildId:process.env[I.ciBuildId.env],tag:process.env[I.tag.env]?process.env[I.tag.env]?.split(",").map(e=>e.trim()):void 0,cancelAfterFailures:Rr(process.env[I.cancelAfterFailures.env]),disableTestTags:process.env[I.disableTestTags.env]||process.env[I.disableTitleTags.env],consoleOutput:process.env[I.consoleOutput.env],testSuiteFile:process.env[I.testSuiteFile.env],machineId:process.env[I.machineId.env],orchestrationId:process.env[I.orchestrationId.env],outputFile:process.env[I.outputFile.env],orchestration:{discoveryOutputFile:process.env[I.discoveryOutputFile.env]}}}var I,ke=u(()=>{"use strict";n();Tr();I={currentsConfigFile:{name:"Currents Config File Path",env:"CURRENTS_CONFIG_FILE_PATH",cli:"--pwc-config"},ciBuildId:{name:"CI Build ID",env:"CURRENTS_CI_BUILD_ID",cli:"--ci-build-id"},recordKey:{name:"Record Key",env:"CURRENTS_RECORD_KEY",cli:"--key"},projectId:{name:"Project ID",env:"CURRENTS_PROJECT_ID",cli:"--project-id"},tag:{name:"Currents Tag",env:"CURRENTS_TAG",cli:"--tag"},cancelAfterFailures:{name:"Currents Cancel After Failures",env:"CURRENTS_CANCEL_AFTER_FAILURES",cli:"--pwc-cancel-after-failures"},disableTestTags:{name:"Disable Test Tags",env:"CURRENTS_DISABLE_TEST_TAGS",cli:"--pwc-disable-test-tags"},disableTitleTags:{name:"Disable Title Tags",env:"CURRENTS_DISABLE_TITLE_TAGS",cli:"--pwc-disable-title-tags"},testSuiteFile:{name:"Test Suite File",env:"CURRENTS_TEST_SUITE_FILE",cli:"--pwc-test-suite-file"},machineId:{name:"Machine ID",env:"CURRENTS_MACHINE_ID",cli:"--pwc-machine-id"},orchestrationId:{name:"Orchestration ID",env:"CURRENTS_ORCHESTRATION_ID",cli:"--pwc-orchestration-id"},outputFile:{name:"Output File",env:"CURRENTS_OUTPUT_FILE",cli:"--pwc-output-file"},consoleOutput:{name:"Console Output",env:"CURRENTS_CONSOLE_OUTPUT",cli:"--pwc-console-output"},batchSize:{name:"Batch Size",env:"CURRENTS_BATCH_SIZE",cli:"--pwc-batch-size"},discoveryOutputFile:{name:"Discovery Output File",env:"CURRENTS_DISCOVERY_OUTPUT_FILE",cli:"--pwc-discovery-output"}}});function v(){if(Ke)return Ke;if(process.env.CURRENTS_PWC_CLI_CONFIG_PATH)try{let e=JSON.parse(Sr.default.readFileSync(process.env.CURRENTS_PWC_CLI_CONFIG_PATH).toString());return Ur("Options from serialized CLI config file: %o",e),Ke=e,e}catch(e){return Ur("Could not read CLI config file: %o",e),{}}return{}}var Sr,Ur,Ke,je=u(()=>{"use strict";n();Sr=l(require("fs"));m();Ur=c.extend("cli-options-serializer"),Ke=null});function hr(e,t,r={validationFn:Ve}){We("reporter options: %o",e),We("config file options: %o",t);let o={...O(Ye),...O(t),...O(e),...O(v()),...O(Fe()),orchestration:{...O(Ye.orchestration),...O(t?.orchestration),...O(e?.orchestration),...O(v().orchestration),...O(Fe().orchestration)},coverage:{...O(Ye.coverage),...O(t?.coverage),...O(e?.coverage),...O(v().coverage)}};o.disableTitleTags!==void 0&&(o.disableTestTags=o.disableTestTags||o.disableTitleTags),r.validationFn(o),oe=o,dt(lt(oe?.consoleOutput)),We("resolved currents config: %o",oe)}function Ve(e){wo.forEach(t=>{if(!e[t])throw T(`${Or(t)} is required for Currents Reporter. Use the following methods:
- environment variable: ${d(te(t))}

@@ -19,11 +19,11 @@ - CLI flag: ${d(re(t))}

\u{1F4D6} ${H.guide.integration}`),new ee("Missing required config variable")})}function O(e){return Object.entries(e??{}).reduce((t,[r,n])=>n===void 0?t:{...t,[r]:n},{})}function N(){return ne}function Nr(e){e.preserveOutput!=="always"&&p(`The "preserveOutput" property in your Playwright config is set to ${e.preserveOutput}. This may cause artifacts to be removed before they are uploaded to Currents. We recommend setting it to "always".`)}var Ve,kn,$e,ne,De=u(()=>{"use strict";o();I();Cr();Ke();S();V();je();Ye();V();Ve=c.extend("config"),kn=["projectId","recordKey"],$e={removeTitleTags:!1,disableTestTags:!1,consoleOutput:b.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},ne=null});function qe(e){let t=new WeakMap;function r(n){if(typeof n=="object"&&n!==null){if(t.has(n))return"[Circular]";t.set(n,!0)}}return(0,Br.cloneDeepWith)(e,r)}function oe(e){let r=Object.getOwnPropertySymbols(e).find(s=>s.toString().match(/configInternalSymbol/))??Object.getOwnPropertyNames(e).find(s=>s.match(/_internal/));return r?e[r]:(p("Could not extract internal playwright configuration"),null)}function Pr(e){return e.reduce((t,r)=>(r&&r.id&&r.workers!==void 0&&(t[r.id]=r.workers),t),{})}function yr(e){return e?.fullConfig?.config?.projects?.reduce((t,r)=>(r&&r.name&&r.use&&r.use.currentsBatchSize!==void 0&&(t[r.name]=r.use.currentsBatchSize),t),{})}var Br,br=u(()=>{"use strict";o();Br=require("lodash");S()});var y=u(()=>{"use strict";o();De();je();Ye();br()});var Do={};fe(Do,{default:()=>ho});module.exports=fn(Do);o();o();var ln=require("nanoid");y();o();y();I();S();o();var k=l(require("path")),Mr=require("url"),xr=l(require("jiti")),wr=[".ts",".js",".mjs"];function Kn(e){return e.replace(/\\/g,"/")}function vr(e){e||(e="currents.config");let t=process.cwd(),r=(0,xr.default)(t,{interopDefault:!0,cache:!1,extensions:[...wr]}),n=jn(e,{cwd:t,jiti:r});return n?{config:n.config,configFile:Kn(n.configFile)}:{config:{},configFile:""}}function jn(e,t){let r=Wn(e,t);if(!r)return null;let n=k.default.extname(r);if(!wr.includes(n))return null;let s;try{s=t.jiti(r)}catch{return null}let i=s?.default??s??null;if(i instanceof Function){try{i=i()}catch{return null}i&&i instanceof Promise&&(i=null)}return{config:i??{},configFile:r}}function Wn(e,t){let r=n=>{let s=t.jiti.esmResolve(n,{try:!0});return s?(0,Mr.fileURLToPath)(s):void 0};return r(k.default.resolve(t.cwd,e))||r(k.default.resolve(t.cwd,".config",e.replace(/\.config$/,"")))||r(k.default.resolve(t.cwd,".config",e))||e}var La=c.extend("config-loader"),se=class{constructor(t,r=i=>{},n=()=>{process.exit(1)},s={validationFn:Je}){this.reporterOptions=t;this.onSuccess=r;this.onFailure=n;this.options=s;this._loadedConfig=null}start(){let t=x();try{let r=vr(t.pwcConfigPath);this._loadedConfig=r,this.onSuccess(r)}catch(r){T("Could not load currents configuration: %O",r),this.onFailure()}return this}loadAndValidate(){if(this._loadedConfig||this.start(),!this._loadedConfig)return this;try{Ar(this.reporterOptions,this._loadedConfig.config,{validationFn:this.options.validationFn})}catch(t){T("Could not load currents configuration: %O",t),this.onFailure()}return this}};I();o();var g=require("lodash");I();Q();var ie=c.extend("ci"),Yn=(e,...t)=>(0,g.chain)(t).compact().join(e).value(),Vn=(e,t)=>(0,g.set)(e,(0,g.camelCase)(t),process.env[t]),f=e=>(0,g.transform)(e,Vn,{}),$n=()=>process.env.TF_BUILD&&process.env.AZURE_HTTP_USER_AGENT,Jn=()=>(0,g.some)(process.env,(e,t)=>/^CODEBUILD_/.test(t)),qn=()=>process.env.bamboo_buildNumber,Qn=()=>(0,g.some)(process.env,(e,t)=>/^CONCOURSE_/.test(t)),zn=()=>process.env.GITLAB_CI||process.env.CI_SERVER_NAME&&/^GitLab/.test(process.env.CI_SERVER_NAME),Xn=()=>!!(process.env.BUILD_ID&&process.env.PROJECT_ID&&process.env.PROJECT_NUMBER||process.env.GCP_PROJECT||process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT),Zn=()=>process.env.JENKINS_URL||process.env.JENKINS_HOME||process.env.JENKINS_VERSION||process.env.HUDSON_URL||process.env.HUDSON_HOME,eo={appveyor:"APPVEYOR",azure:$n,awsCodeBuild:Jn,bamboo:qn,bitbucket:"BITBUCKET_BUILD_NUMBER",buildkite:"BUILDKITE",circle:"CIRCLECI",concourse:Qn,codeFresh:"CF_BUILD_ID",drone:"DRONE",githubActions:"GITHUB_ACTIONS",gitlab:zn,goCD:"GO_JOB_NAME",jenkins:Zn,googleCloud:Xn,semaphore:"SEMAPHORE",teamcity:"TEAMCITY_VERSION",travis:"TRAVIS",netlify:"NETLIFY"};function to(){let{env:e}=process;return(0,g.findKey)(eo,t=>{if((0,g.isString)(t))return e[t];if((0,g.isFunction)(t))return t()})}var Gr=()=>({appveyor:f(["APPVEYOR_JOB_ID","APPVEYOR_ACCOUNT_NAME","APPVEYOR_PROJECT_SLUG","APPVEYOR_BUILD_NUMBER","APPVEYOR_BUILD_VERSION","APPVEYOR_PULL_REQUEST_NUMBER","APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"]),azure:f(["AGENT_BUILDDIRECTORY","AGENT_ID","AGENT_JOBNAME","AGENT_JOBSTATUS","AGENT_MACHINENAME","AGENT_NAME","AGENT_OS","AGENT_OSARCHITECTURE","BUILD_BUILDID","BUILD_BUILDNUMBER","BUILD_BUILDURI","BUILD_CONTAINERID","BUILD_CRONSCHEDULE_DISPLAYNAME","BUILD_DEFINITIONNAME","BUILD_DEFINITIONVERSION","BUILD_QUEUEDBY","BUILD_QUEUEDBYID","BUILD_REASON","BUILD_REPOSITORY_ID","BUILD_REPOSITORY_NAME","BUILD_REPOSITORY_PROVIDER","BUILD_REPOSITORY_URI","BUILD_REQUESTEDFOR","BUILD_REQUESTEDFOREMAIL","BUILD_REQUESTEDFORID","BUILD_SOURCEBRANCH","BUILD_SOURCEBRANCHNAME","BUILD_SOURCESDIRECTORY","BUILD_SOURCEVERSION","BUILD_SOURCEVERSIONAUTHOR","BUILD_SOURCEVERSIONMESSAGE","BUILD_STAGINGDIRECTORY","BUILD_TRIGGEREDBY_BUILDID","BUILD_TRIGGEREDBY_BUILDNUMBER","BUILD_TRIGGEREDBY_DEFINITIONID","BUILD_TRIGGEREDBY_DEFINITIONNAME","BUILD_TRIGGEREDBY_PROJECTID","COMMON_TESTRESULTSDIRECTORY","PIPELINE_WORKSPACE","SYSTEM_COLLECTIONID","SYSTEM_COLLECTIONURI","SYSTEM_DEFAULTWORKINGDIRECTORY","SYSTEM_DEFINITIONID","SYSTEM_HOSTTYPE","SYSTEM_JOBATTEMPT","SYSTEM_JOBDISPLAYNAME","SYSTEM_JOBID","SYSTEM_JOBNAME","SYSTEM_PHASEATTEMPT","SYSTEM_PHASEDISPLAYNAME","SYSTEM_PHASENAME","SYSTEM_PLANID","SYSTEM_PULLREQUEST_ISFORK","SYSTEM_PULLREQUEST_PULLREQUESTID","SYSTEM_PULLREQUEST_PULLREQUESTNUMBER","SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI","SYSTEM_PULLREQUEST_SOURCEBRANCH","SYSTEM_PULLREQUEST_SOURCECOMMITID","SYSTEM_PULLREQUEST_TARGETBRANCH","SYSTEM_PULLREQUEST_TARGETBRANCHNAME","SYSTEM_STAGEATTEMPT","SYSTEM_STAGEDISPLAYNAME","SYSTEM_STAGENAME","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI","SYSTEM_TEAMPROJECT","SYSTEM_TEAMPROJECTID","SYSTEM_TIMELINEID"]),awsCodeBuild:f(["AWS_DEFAULT_REGION","AWS_REGION","CODEBUILD_BATCH_BUILD_IDENTIFIER","CODEBUILD_BUILD_ARN","CODEBUILD_BUILD_ID","CODEBUILD_BUILD_IMAGE","CODEBUILD_BUILD_NUMBER","CODEBUILD_BUILD_SUCCEEDING","CODEBUILD_BUILD_URL","CODEBUILD_INITIATOR","CODEBUILD_PROJECT_ARN","CODEBUILD_PUBLIC_BUILD_URL","CODEBUILD_RESOLVED_SOURCE_VERSION","CODEBUILD_SOURCE_REPO_URL","CODEBUILD_SOURCE_VERSION","CODEBUILD_SRC_DIR","CODEBUILD_START_TIME","CODEBUILD_WEBHOOK_ACTOR_ACCOUNT_ID","CODEBUILD_WEBHOOK_BASE_REF","CODEBUILD_WEBHOOK_EVENT","CODEBUILD_WEBHOOK_HEAD_REF","CODEBUILD_WEBHOOK_MERGE_COMMIT","CODEBUILD_WEBHOOK_PREV_COMMIT","CODEBUILD_WEBHOOK_TRIGGER","CODEBUILD_WEBHOOK_LABEL","CODEBUILD_WEBHOOK_RUN_ID","CODEBUILD_WEBHOOK_JOB_ID","CODEBUILD_WEBHOOK_WORKFLOW_NAME","CODEBUILD_RUNNER_OWNER","CODEBUILD_RUNNER_REPO","CODEBUILD_RUNNER_REPO_DOMAIN","CODEBUILD_RUNNER_WITH_BUILDSPEC"]),bamboo:f(["bamboo_buildNumber","bamboo_buildResultsUrl","bamboo_planRepository_repositoryUrl","bamboo_buildKey"]),bitbucket:f(["CI","BITBUCKET_WORKSPACE","BITBUCKET_REPO_SLUG","BITBUCKET_REPO_UUID","BITBUCKET_REPO_FULL_NAME","BITBUCKET_REPO_IS_PRIVATE","BITBUCKET_REPO_OWNER","BITBUCKET_REPO_OWNER_UUID","BITBUCKET_PROJECT_KEY","BITBUCKET_PROJECT_UUID","BITBUCKET_BUILD_NUMBER","BITBUCKET_PIPELINE_UUID","BITBUCKET_STEP_UUID","BITBUCKET_STEP_RUN_NUMBER","BITBUCKET_STEP_TRIGGERER_UUID","BITBUCKET_PARALLEL_STEP","BITBUCKET_PARALLEL_STEP_COUNT","BITBUCKET_CLONE_DIR","BITBUCKET_COMMIT","BITBUCKET_BRANCH","BITBUCKET_TAG","BITBUCKET_BOOKMARK","BITBUCKET_GIT_HTTP_ORIGIN","BITBUCKET_GIT_SSH_ORIGIN","BITBUCKET_PR_ID","BITBUCKET_PR_DESTINATION_BRANCH","BITBUCKET_PR_DESTINATION_COMMIT","BITBUCKET_DEPLOYMENT_ENVIRONMENT","BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID","BITBUCKET_EXIT_CODE"]),buildkite:f(["BUILDKITE_ORGANIZATION_SLUG","BUILDKITE_PIPELINE_ID","BUILDKITE_PIPELINE_NAME","BUILDKITE_PIPELINE_SLUG","BUILDKITE_PIPELINE_DEFAULT_BRANCH","BUILDKITE_REPO","BUILDKITE_SOURCE","BUILDKITE_BRANCH","BUILDKITE_TAG","BUILDKITE_COMMIT","BUILDKITE_MESSAGE","BUILDKITE_BUILD_AUTHOR","BUILDKITE_BUILD_AUTHOR_EMAIL","BUILDKITE_JOB_ID","BUILDKITE_BUILD_ID","BUILDKITE_BUILD_URL","BUILDKITE_BUILD_NUMBER","BUILDKITE_LABEL","BUILDKITE_COMMAND","BUILDKITE_STEP_ID","BUILDKITE_STEP_KEY","BUILDKITE_PARALLEL_JOB","BUILDKITE_PARALLEL_JOB_COUNT","BUILDKITE_RETRY_COUNT","BUILDKITE_COMPUTE_TYPE","BUILDKITE_CLUSTER_NAME","BUILDKITE_PULL_REQUEST","BUILDKITE_PULL_REQUEST_REPO","BUILDKITE_PULL_REQUEST_BASE_BRANCH","BUILDKITE_PULL_REQUEST_DRAFT","BUILDKITE_PULL_REQUEST_LABELS","BUILDKITE_MERGE_QUEUE_BASE_BRANCH","BUILDKITE_MERGE_QUEUE_BASE_COMMIT","BUILDKITE_REBUILT_FROM_BUILD_ID","BUILDKITE_REBUILT_FROM_BUILD_NUMBER","BUILDKITE_TRIGGERED_FROM_BUILD_ID","BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER","BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG"]),circle:f(["CI","CIRCLECI","CIRCLE_BRANCH","CIRCLE_BUILD_NUM","CIRCLE_BUILD_URL","CIRCLE_PREVIOUS_BUILD_NUM","CIRCLE_JOB","CIRCLE_WORKFLOW_ID","CIRCLE_WORKFLOW_JOB_ID","CIRCLE_WORKFLOW_WORKSPACE_ID","CIRCLE_PIPELINE_ID","CIRCLE_ORGANIZATION_ID","CIRCLE_PROJECT_ID","CIRCLE_PROJECT_REPONAME","CIRCLE_PROJECT_USERNAME","CIRCLE_REPOSITORY_URL","CIRCLE_WORKING_DIRECTORY","CIRCLE_SHA1","CIRCLE_TAG","CIRCLE_USERNAME","CIRCLE_NODE_INDEX","CIRCLE_NODE_TOTAL","CIRCLE_PR_NUMBER","CIRCLE_PR_REPONAME","CIRCLE_PR_USERNAME","CIRCLE_PULL_REQUEST","CIRCLE_PULL_REQUESTS","CI_PULL_REQUEST"]),concourse:f(["BUILD_ID","BUILD_NAME","BUILD_JOB_NAME","BUILD_PIPELINE_NAME","BUILD_TEAM_NAME","ATC_EXTERNAL_URL"]),codeFresh:f(["CF_BUILD_ID","CF_BUILD_URL","CF_CURRENT_ATTEMPT","CF_STEP_NAME","CF_PIPELINE_NAME","CF_PIPELINE_TRIGGER_ID","CF_PULL_REQUEST_ID","CF_PULL_REQUEST_IS_FORK","CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_TARGET"]),drone:f(["DRONE_BUILD_LINK","DRONE_BUILD_NUMBER","DRONE_PULL_REQUEST"]),githubActions:f(["CI","GITHUB_ACTIONS","GITHUB_WORKFLOW","GITHUB_WORKFLOW_REF","GITHUB_WORKFLOW_SHA","GITHUB_ACTION","GITHUB_ACTION_PATH","GITHUB_ACTION_REPOSITORY","GITHUB_JOB","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_RUN_ATTEMPT","GITHUB_REPOSITORY","GITHUB_REPOSITORY_ID","GITHUB_REPOSITORY_OWNER","GITHUB_REPOSITORY_OWNER_ID","GITHUB_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REF_PROTECTED","GITHUB_BASE_REF","GITHUB_HEAD_REF","GITHUB_SHA","GITHUB_ACTOR","GITHUB_ACTOR_ID","GITHUB_TRIGGERING_ACTOR","GITHUB_SERVER_URL","GITHUB_API_URL","GITHUB_GRAPHQL_URL","GITHUB_WORKSPACE","GITHUB_RETENTION_DAYS","RUNNER_OS","RUNNER_ARCH","RUNNER_NAME","RUNNER_ENVIRONMENT","RUNNER_DEBUG"]),gitlab:f(["CI_PIPELINE_ID","CI_PIPELINE_URL","CI_BUILD_ID","CI_JOB_ID","CI_JOB_URL","CI_JOB_NAME","GITLAB_HOST","CI_PROJECT_ID","CI_PROJECT_URL","CI_REPOSITORY_URL","CI_ENVIRONMENT_URL","CI_DEFAULT_BRANCH","CI_MERGE_REQUEST_IID","CI_MERGE_REQUEST_PROJECT_URL","CI_MERGE_REQUEST_TITLE","CI_MERGE_REQUEST_SOURCE_BRANCH_NAME","CI_MERGE_REQUEST_TARGET_BRANCH_NAME","CI_OPEN_MERGE_REQUESTS"]),goCD:f(["GO_SERVER_URL","GO_ENVIRONMENT_NAME","GO_PIPELINE_NAME","GO_PIPELINE_COUNTER","GO_PIPELINE_LABEL","GO_STAGE_NAME","GO_STAGE_COUNTER","GO_JOB_NAME","GO_TRIGGER_USER","GO_REVISION","GO_TO_REVISION","GO_FROM_REVISION","GO_MATERIAL_HAS_CHANGED"]),googleCloud:f(["BUILD_ID","PROJECT_ID","REPO_NAME","BRANCH_NAME","TAG_NAME","COMMIT_SHA","SHORT_SHA"]),jenkins:f(["BRANCH_NAME","BUILD_DISPLAY_NAME","BUILD_ID","BUILD_NUMBER","BUILD_TAG","BUILD_URL","CHANGE_AUTHOR","CHANGE_AUTHOR_DISPLAY_NAME","CHANGE_AUTHOR_EMAIL","CHANGE_BRANCH","CHANGE_FORK","CHANGE_ID","CHANGE_TARGET","CHANGE_TITLE","CHANGE_URL","CI","EXECUTOR_NUMBER","JAVA_HOME","JENKINS_HOME","JENKINS_URL","JOB_BASE_NAME","JOB_NAME","JOB_URL","NODE_LABELS","NODE_NAME","RUN_ARTIFACTS_DISPLAY_URL","RUN_CHANGES_DISPLAY_URL","TAG_NAME","WORKSPACE","WORKSPACE_TMP","GIT_AUTHOR_EMAIL","GIT_AUTHOR_NAME","GIT_BRANCH","GIT_COMMIT","GIT_COMMITTER_EMAIL","GIT_COMMITTER_NAME","GIT_LOCAL_BRANCH","GIT_PREVIOUS_COMMIT","GIT_PREVIOUS_SUCCESSFUL_COMMIT","GIT_URL","ghprbActualCommit","ghprbGhRepository","ghprbPullId","ghprbPullLink","ghprbSourceBranch","ghprbTargetBranch","ghprbTriggerAuthorLogin"]),semaphore:f(["SEMAPHORE_BRANCH_ID","SEMAPHORE_BUILD_NUMBER","SEMAPHORE_CURRENT_JOB","SEMAPHORE_CURRENT_THREAD","SEMAPHORE_EXECUTABLE_UUID","SEMAPHORE_GIT_BRANCH","SEMAPHORE_GIT_DIR","SEMAPHORE_GIT_REF","SEMAPHORE_GIT_REF_TYPE","SEMAPHORE_GIT_REPO_SLUG","SEMAPHORE_GIT_SHA","SEMAPHORE_GIT_URL","SEMAPHORE_JOB_COUNT","SEMAPHORE_JOB_ID","SEMAPHORE_JOB_NAME","SEMAPHORE_JOB_UUID","SEMAPHORE_PIPELINE_ID","SEMAPHORE_PLATFORM","SEMAPHORE_PROJECT_DIR","SEMAPHORE_PROJECT_HASH_ID","SEMAPHORE_PROJECT_ID","SEMAPHORE_PROJECT_NAME","SEMAPHORE_PROJECT_UUID","SEMAPHORE_REPO_SLUG","SEMAPHORE_TRIGGER_SOURCE","SEMAPHORE_WORKFLOW_ID","PULL_REQUEST_NUMBER"]),teamcity:null,travis:f(["TRAVIS_JOB_ID","TRAVIS_BUILD_ID","TRAVIS_BUILD_WEB_URL","TRAVIS_REPO_SLUG","TRAVIS_JOB_NUMBER","TRAVIS_EVENT_TYPE","TRAVIS_COMMIT_RANGE","TRAVIS_BUILD_NUMBER","TRAVIS_PULL_REQUEST","TRAVIS_PULL_REQUEST_BRANCH","TRAVIS_PULL_REQUEST_SHA"]),netlify:f(["BUILD_ID","CONTEXT","URL","DEPLOY_URL","DEPLOY_PRIME_URL","DEPLOY_ID"])}),ro=()=>{let{env:e}=process;return{appveyor:{sha:e.APPVEYOR_REPO_COMMIT,branch:e.APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH||e.APPVEYOR_REPO_BRANCH,message:Yn(`
`,e.APPVEYOR_REPO_COMMIT_MESSAGE,e.APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED),authorName:e.APPVEYOR_REPO_COMMIT_AUTHOR,authorEmail:e.APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL},awsCodeBuild:{sha:e.CODEBUILD_RESOLVED_SOURCE_VERSION,remoteOrigin:e.CODEBUILD_SOURCE_REPO_URL},azure:{sha:e.BUILD_SOURCEVERSION,branch:e.BUILD_SOURCEBRANCHNAME,message:e.BUILD_SOURCEVERSIONMESSAGE,authorName:e.BUILD_SOURCEVERSIONAUTHOR,authorEmail:e.BUILD_REQUESTEDFOREMAIL},bamboo:{sha:e.bamboo_planRepository_revision,branch:e.bamboo_planRepository_branch,authorName:e.bamboo_planRepository_username,remoteOrigin:e.bamboo_planRepository_repositoryURL},bitbucket:{sha:e.BITBUCKET_COMMIT,branch:e.BITBUCKET_BRANCH},buildkite:{sha:e.BUILDKITE_COMMIT,branch:e.BUILDKITE_BRANCH,message:e.BUILDKITE_MESSAGE,authorName:e.BUILDKITE_BUILD_CREATOR,authorEmail:e.BUILDKITE_BUILD_CREATOR_EMAIL,remoteOrigin:e.BUILDKITE_REPO,defaultBranch:e.BUILDKITE_PIPELINE_DEFAULT_BRANCH},circle:{sha:e.CIRCLE_SHA1,branch:e.CIRCLE_BRANCH,authorName:e.CIRCLE_USERNAME,remoteOrigin:e.CIRCLE_REPOSITORY_URL},codeFresh:{sha:e.CF_REVISION,branch:e.CF_BRANCH,message:e.CF_COMMIT_MESSAGE,authorName:e.CF_COMMIT_AUTHOR},drone:{sha:e.DRONE_COMMIT_SHA,branch:e.DRONE_SOURCE_BRANCH,message:e.DRONE_COMMIT_MESSAGE,authorName:e.DRONE_COMMIT_AUTHOR,authorEmail:e.DRONE_COMMIT_AUTHOR_EMAIL,remoteOrigin:e.DRONE_GIT_HTTP_URL,defaultBranch:e.DRONE_REPO_BRANCH},githubActions:{sha:e.GITHUB_SHA,branch:e.GH_BRANCH||e.GITHUB_REF,defaultBranch:e.GITHUB_BASE_REF,remoteBranch:e.GITHUB_HEAD_REF,runAttempt:e.GITHUB_RUN_ATTEMPT},gitlab:{sha:e.CI_COMMIT_SHA,branch:e.CI_COMMIT_REF_NAME,message:e.CI_COMMIT_MESSAGE,authorName:e.GITLAB_USER_NAME,authorEmail:e.GITLAB_USER_EMAIL,remoteOrigin:e.CI_REPOSITORY_URL,defaultBranch:e.CI_DEFAULT_BRANCH},googleCloud:{sha:e.COMMIT_SHA,branch:e.BRANCH_NAME},jenkins:{sha:e.GIT_COMMIT,branch:e.GIT_BRANCH},semaphore:{sha:e.SEMAPHORE_GIT_SHA,branch:e.SEMAPHORE_GIT_BRANCH,remoteOrigin:e.SEMAPHORE_GIT_REPO_SLUG},snap:null,teamcity:null,travis:{sha:e.TRAVIS_PULL_REQUEST_SHA||e.TRAVIS_COMMIT,branch:e.TRAVIS_PULL_REQUEST_BRANCH||e.TRAVIS_BRANCH,message:e.TRAVIS_COMMIT_MESSAGE},netlify:{sha:e.COMMIT_REF,branch:e.BRANCH,remoteOrigin:e.REPOSITORY_URL}}},Fr=e=>{let t=Hr();return t?(0,g.chain)(e()).get(t).value():{}};function no(){return(0,g.chain)(Gr()).omitBy(g.isNull).keys().value()}function Hr(){let e=to();return ie("detected CI provider name: %s",e),e||null}function oo(){return Fr(Gr)}function kr(){return Fr(ro)}function so(e){return e&&no().includes(e)}function Kr(e){let t=oo(),r=Hr(),n=io(e,r);return ie("detected CI provider: %s",r),ie("detected CI params: %O",t),ie("detected CI build ID: %o",n),{params:t,provider:r,ciBuildId:n}}function io(e,t){return e?{source:"user",value:e}:so(t)?{source:"server",value:null}:{source:"random",value:`auto:${P()}`}}o();var Wr=require("@currents/commit-info"),Yr=require("lodash");o();var ae=require("lodash");I();var Qe=c.extend("ci-git");function jr(e){Qe("git commit existing info: %O",e);let t=kr();Qe("commit info from provider environment variables: %O",t);let r=(0,ae.transform)(e,(n,s,i)=>{let E=s||(t?t[i]:null);return n[i]=(0,ae.defaultTo)(E,null)});return Qe("combined git and environment variables from provider: %O",r),r}var ao=async()=>{let e=await(0,Wr.commitInfo)();return jr({branch:e.branch,remoteOrigin:e.remote,authorEmail:e.email,authorName:e.author,message:e.message,sha:e.sha,ghaEventData:e.ghaEventData})},Vr=(0,Yr.memoize)(ao);o();var $r=require("@babel/code-frame"),Jr=l(require("chalk")),ze=l(require("fs")),w=l(require("path")),qr=l(require("stack-utils")),Qr=l(require("url"));function uo(e){let t=e.split(`
`),r=t.findIndex(E=>E.startsWith(" at "));r===-1&&(r=t.length);let n=t.slice(0,r).join(`
`),s=t.slice(r),i;for(let E of s){let{frame:_,fileName:L}=Eo(E);if(!(!_||!L)&&!lo(L)){i={file:L,column:_.column||0,line:_.line||0};break}}return{message:n,stackLines:s,location:i}}function lo(e){return e.includes(`${w.default.sep}node_modules${w.default.sep}`)}function co(e,t){return w.default.relative(e.rootDir,t)||w.default.basename(t)}function zr(e,t,r,n){let s=t.stack,i=[],E;if(s){let _=uo(s);if(i.push(_.message),E=_.location,E)if(!t.snippet&&(!n||ze.default.realpathSync(n)!==E.file)&&(i.push(""),i.push(Jr.default.gray(" at ")+`${co(e,E.file)}:${E.line}`)),i.push(""),t.snippet)i.push(t.snippet);else try{let L=ze.default.readFileSync(E.file,"utf8"),_e=(0,$r.codeFrameColumns)(L,{start:E},{highlightCode:r});i.push(_e)}catch{}i.push(""),i.push(_.stackLines.join(`
`))}else t.message?i.push(t.message):t.value&&i.push(t.value);return{location:E,message:i.join(`
`)}}var po=new qr.default;function Eo(e){let t=po.parseLine(e);if(!t)return{frame:null,fileName:null};let r=null;return t.file&&(r=t.file.startsWith("file://")?Qr.default.fileURLToPath(t.file):w.default.resolve(process.cwd(),t.file)),{frame:t,fileName:r}}Me();o();var _o=l(require("fs")),Zr=require("path");y();I();o();var ue=l(require("fs")),go=require("tmp-promise");function Xr(e){try{let t=ue.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}var le=c.extend("last-failed"),fo=".last-run.json";function en(e){let t=oe(e);if(!t?.cliLastFailed&&!t?.testIdMatcher)return le("CLI last failed option is not enabled. Skipping retrieval of last run data."),null;let r=(t.projects??[]).reduce((s,{project:i})=>(i.name&&i.outputDir&&(s[i.name]=i.outputDir),s),{});if(Object.keys(r).length===0)return le("No projects with outputDir found. Skipping retrieval."),null;let n=Object.entries(r).map(([s,i])=>{let E=(0,Zr.join)(i,fo),_=Xr(E);return _||le("No last run data found for project %s",s),{project:s,path:E,data:_}});return le("Last run data retrieved: %O",n),n}Ke();o();y();o();var mo=require("lodash");o();var ce=l(require("path"));function tn(e,t){return Io(ce.default.relative(t,e.file))}function Io(e){return e.split(ce.default.sep).join(ce.default.posix.sep)}function Xe(e){let t=e.titlePath(),r=rn(e).title;return t.slice(t.indexOf(r)+1,t.length)}function rn(e){let t=e.parent;for(;t.parent?.location;)t=t.parent;return t}function nn(e,t){let r=rn(e).location;return tn(r,t.rootDir)}function on(e){return e.id??e._id}function sn(e){if(e._only)return!0;let t=e.parent;for(;t.parent;){if(t._only)return!0;t=t.parent}return!1}function pe(e){if(!e)return"__currents_no_project__";let r=("__projectId"in e?e.__projectId:"").trim(),n=e.name.trim()?r:`project${r?`-0${r}`:""}`;if(n.length>256)throw new Error(`Project name is too long for ${n}`);return n}function an(e,t){return e.suites.map(r=>{let n=t.projects.find(s=>s.name===r.title);return{name:pe(r.project()),tags:(n?.metadata?.pwc?.tags??[]).map(s=>s.trim()),tests:Ro(r,t)}})}function Ro(e,t){let r=e.allTests().map(n=>({isOnly:sn(n),title:Xe(n),spec:nn(n,t),tags:Co(n),testId:on(n)}));return r.some(n=>n.isOnly)?r.filter(n=>n.isOnly):r}function Co(e){let{disableTestTags:t}=To();if(t)return[];let r=(Xe(e).join(" ").match(/@(\S+)/g)??[]).filter(Boolean).map(n=>n);return Array.from(new Set([...r,...e.tags??[]].map(n=>n.trim()).map(n=>n.replace("@",""))))}function To(){return{disableTestTags:N()?.disableTestTags??process.env.CURRENTS_DISCOVERY_DISABLE_TEST_TAGS==="true"}}S();ke();o();Ue();o();var Oo=l(require("http"));I();var So=l(require("lil-http-terminator")),un=require("ts-pattern"),Uo=l(require("ws")),au=c.extend("wss");o();xe();var Ee=class{async create(t){return M({url:"/orchestration-v1",method:"POST",data:JSON.stringify(t)})}async createTask(t){return M({url:`/orchestration-v1/${t.id}/task`,method:"POST",data:JSON.stringify({machineId:t.machineId,runId:t.runId})})}async resetRun(t){return M({url:`/runs/v1/${t.runId}/reset`,method:"PUT",data:JSON.stringify({...t,isBatchedOr8n:!0})})}};o();var Ze=l(require("pluralize"));y();Ie();S();var de=class{constructor(t,r,n=N()){this.pwConfig=t;this.suite=r;this.currentsConfig=n}getIntro(t){return[`\u{1F4E6} Currents reporter: ${d([`${Se(j)}`,t.ciBuildId?` - ci build id: ${t.ciBuildId}`:null,` - project id: ${this.currentsConfig?.projectId}`,` - orchestration id: ${t.sessionId}`,t.machineId?` - machine id: ${t.machineId}`:null].filter(Boolean).join(`
`))}`,[`\u{1F3AD} Playwright: ${d([`${Se(this.pwConfig.version)}`,`${this.suite.allTests().length} ${(0,Ze.default)("test",this.suite.allTests().length)} in ${this.suite.suites.length} ${(0,Ze.default)("project",this.suite.suites.length)} [${this.suite.suites.map(r=>pe(r.project())).join(", ")}]`,this.pwConfig.shard?["shard",`${this.pwConfig.shard.current}/${this.pwConfig.shard.total}`].join(" "):null].filter(r=>r).join(" "))} `].filter(r=>r).join(" | ")].join(`
`)}};var U=c.extend("orchestration-reporter"),ge=class{constructor(t){this.pwConfig=null;this.pwSuite=null;this.lastRunData=null;this.fullSuite=null;this.printer=null;this.remoteDebug=Z.factory("or8n"),this.configLoader=new se(t).start()}printsToStdio(){return!0}onBegin(t,r){Qt(t.version),this.configLoader.loadAndValidate(),U("Starting orchestration discovery"),this.pwConfig=t,this.pwSuite=r,Nr(t),U("Discovering test suite config: %O",t),this.fullSuite=an(this.pwSuite,t),U("Full suite response %O",this.fullSuite),this.printer=new de(t,r),this.lastRunData=en(t),U("Last run data %O",this.lastRunData)}onError(t){T(`Global error reported by test runner:
%s`,zr(this.pwConfig,t,!0).message)}getOrchestrationAPI(){return new Ee}async onEnd(){if(U("onEnd() called - starting orchestration finalization"),this.pwConfig?.projects.forEach(h=>{if(!h.name)throw new Error("currents panic: playwright projects must have a name for orchestration")}),!this.fullSuite)throw new Error("currents panic: cannot detect full test suite");U("Validated config, fetching currents config...");let t=N();U("Currents config fetched, getting git info...");let r=await Vr();U("Git info retrieved, getting CI info...");let n=Kr(t?.ciBuildId);if(U("CI info retrieved: %O",{provider:n.provider,ciBuildId:n.ciBuildId}),n.ciBuildId.source==="random")throw T(`Currents failed to detect CI build ID for this environment. Please use one of the following to set CI build ID:
\u{1F4D6} ${k.guide.integration}`),new ee("Missing required config variable")})}function O(e){return Object.entries(e??{}).reduce((t,[r,o])=>o===void 0?t:{...t,[r]:o},{})}function B(){return oe}function Dr(e){e.preserveOutput!=="always"&&E(`The "preserveOutput" property in your Playwright config is set to ${e.preserveOutput}. This may cause artifacts to be removed before they are uploaded to Currents. We recommend setting it to "always".`)}var We,wo,Ye,oe,Ue=u(()=>{"use strict";n();m();fr();He();S();$();ke();je();$();We=c.extend("config"),wo=["projectId","recordKey"],Ye={removeTitleTags:!1,disableTestTags:!1,consoleOutput:y.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},oe=null});function $e(e){let t=new WeakMap;function r(o){if(typeof o=="object"&&o!==null){if(t.has(o))return"[Circular]";t.set(o,!0)}}return(0,Lr.cloneDeepWith)(e,r)}function Ar(e){let r=Object.getOwnPropertySymbols(e).find(s=>s.toString().match(/configInternalSymbol/))??Object.getOwnPropertyNames(e).find(s=>s.match(/_internal/));return r?e[r]:(E("Could not extract internal playwright configuration"),null)}function Br(e){return e.reduce((t,r)=>(r&&r.id&&r.workers!==void 0&&(t[r.id]=r.workers),t),{})}function Nr(e){return e?.fullConfig?.config?.projects?.reduce((t,r)=>(r&&r.name&&r.use&&r.use.currentsBatchSize!==void 0&&(t[r.name]=r.use.currentsBatchSize),t),{})}var Lr,Pr=u(()=>{"use strict";n();Lr=require("lodash");S()});var b=u(()=>{"use strict";n();Ue();ke();je();Pr()});var fn={};de(fn,{default:()=>mn});module.exports=co(fn);n();n();var oo=require("nanoid");b();n();b();m();S();n();var K=l(require("path")),yr=require("url"),br=l(require("jiti")),Mr=[".ts",".js",".mjs"];function xo(e){return e.replace(/\\/g,"/")}function vr(e){e||(e="currents.config");let t=process.cwd(),r=(0,br.default)(t,{interopDefault:!0,cache:!1,extensions:[...Mr]}),o=Go(e,{cwd:t,jiti:r});return o?{config:o.config,configFile:xo(o.configFile)}:{config:{},configFile:""}}function Go(e,t){let r=Ho(e,t);if(!r)return null;let o=K.default.extname(r);if(!Mr.includes(o))return null;let s;try{s=t.jiti(r)}catch{return null}let a=s?.default??s??null;if(a instanceof Function){try{a=a()}catch{return null}a&&a instanceof Promise&&(a=null)}return{config:a??{},configFile:r}}function Ho(e,t){let r=o=>{let s=t.jiti.esmResolve(o,{try:!0});return s?(0,yr.fileURLToPath)(s):void 0};return r(K.default.resolve(t.cwd,e))||r(K.default.resolve(t.cwd,".config",e.replace(/\.config$/,"")))||r(K.default.resolve(t.cwd,".config",e))||e}var Ca=c.extend("config-loader"),ne=class{constructor(t,r=a=>{},o=()=>{process.exit(1)},s={validationFn:Ve}){this.reporterOptions=t;this.onSuccess=r;this.onFailure=o;this.options=s}reporterOptions;onSuccess;onFailure;options;_loadedConfig=null;start(){let t=v();try{let r=vr(t.pwcConfigPath);this._loadedConfig=r,this.onSuccess(r)}catch(r){T("Could not load currents configuration: %O",r),this.onFailure()}return this}loadAndValidate(){if(this._loadedConfig||this.start(),!this._loadedConfig)return this;try{hr(this.reporterOptions,this._loadedConfig.config,{validationFn:this.options.validationFn})}catch(t){T("Could not load currents configuration: %O",t),this.onFailure()}return this}};m();n();var _=require("lodash");m();q();var se=c.extend("ci"),Fo=(e,...t)=>(0,_.chain)(t).compact().join(e).value(),ko=(e,t)=>(0,_.set)(e,(0,_.camelCase)(t),process.env[t]),g=e=>(0,_.transform)(e,ko,{}),Ko=()=>process.env.TF_BUILD&&process.env.AZURE_HTTP_USER_AGENT,jo=()=>(0,_.some)(process.env,(e,t)=>/^CODEBUILD_/.test(t)),Wo=()=>process.env.bamboo_buildNumber,Yo=()=>(0,_.some)(process.env,(e,t)=>/^CONCOURSE_/.test(t)),Vo=()=>process.env.GITLAB_CI||process.env.CI_SERVER_NAME&&/^GitLab/.test(process.env.CI_SERVER_NAME),$o=()=>!!(process.env.BUILD_ID&&process.env.PROJECT_ID&&process.env.PROJECT_NUMBER||process.env.GCP_PROJECT||process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT),Jo=()=>process.env.JENKINS_URL||process.env.JENKINS_HOME||process.env.JENKINS_VERSION||process.env.HUDSON_URL||process.env.HUDSON_HOME,Qo={appveyor:"APPVEYOR",azure:Ko,awsCodeBuild:jo,bamboo:Wo,bitbucket:"BITBUCKET_BUILD_NUMBER",buildkite:"BUILDKITE",circle:"CIRCLECI",concourse:Yo,codeFresh:"CF_BUILD_ID",drone:"DRONE",githubActions:"GITHUB_ACTIONS",gitlab:Vo,goCD:"GO_JOB_NAME",jenkins:Jo,googleCloud:$o,semaphore:"SEMAPHORE",teamcity:"TEAMCITY_VERSION",travis:"TRAVIS",netlify:"NETLIFY"};function qo(){let{env:e}=process;return(0,_.findKey)(Qo,t=>{if((0,_.isString)(t))return e[t];if((0,_.isFunction)(t))return t()})}var wr=()=>({appveyor:g(["APPVEYOR_JOB_ID","APPVEYOR_ACCOUNT_NAME","APPVEYOR_PROJECT_SLUG","APPVEYOR_BUILD_NUMBER","APPVEYOR_BUILD_VERSION","APPVEYOR_PULL_REQUEST_NUMBER","APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"]),azure:g(["AGENT_BUILDDIRECTORY","AGENT_ID","AGENT_JOBNAME","AGENT_JOBSTATUS","AGENT_MACHINENAME","AGENT_NAME","AGENT_OS","AGENT_OSARCHITECTURE","BUILD_BUILDID","BUILD_BUILDNUMBER","BUILD_BUILDURI","BUILD_CONTAINERID","BUILD_CRONSCHEDULE_DISPLAYNAME","BUILD_DEFINITIONNAME","BUILD_DEFINITIONVERSION","BUILD_QUEUEDBY","BUILD_QUEUEDBYID","BUILD_REASON","BUILD_REPOSITORY_ID","BUILD_REPOSITORY_NAME","BUILD_REPOSITORY_PROVIDER","BUILD_REPOSITORY_URI","BUILD_REQUESTEDFOR","BUILD_REQUESTEDFOREMAIL","BUILD_REQUESTEDFORID","BUILD_SOURCEBRANCH","BUILD_SOURCEBRANCHNAME","BUILD_SOURCESDIRECTORY","BUILD_SOURCEVERSION","BUILD_SOURCEVERSIONAUTHOR","BUILD_SOURCEVERSIONMESSAGE","BUILD_STAGINGDIRECTORY","BUILD_TRIGGEREDBY_BUILDID","BUILD_TRIGGEREDBY_BUILDNUMBER","BUILD_TRIGGEREDBY_DEFINITIONID","BUILD_TRIGGEREDBY_DEFINITIONNAME","BUILD_TRIGGEREDBY_PROJECTID","COMMON_TESTRESULTSDIRECTORY","PIPELINE_WORKSPACE","SYSTEM_COLLECTIONID","SYSTEM_COLLECTIONURI","SYSTEM_DEFAULTWORKINGDIRECTORY","SYSTEM_DEFINITIONID","SYSTEM_HOSTTYPE","SYSTEM_JOBATTEMPT","SYSTEM_JOBDISPLAYNAME","SYSTEM_JOBID","SYSTEM_JOBNAME","SYSTEM_PHASEATTEMPT","SYSTEM_PHASEDISPLAYNAME","SYSTEM_PHASENAME","SYSTEM_PLANID","SYSTEM_PULLREQUEST_ISFORK","SYSTEM_PULLREQUEST_PULLREQUESTID","SYSTEM_PULLREQUEST_PULLREQUESTNUMBER","SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI","SYSTEM_PULLREQUEST_SOURCEBRANCH","SYSTEM_PULLREQUEST_SOURCECOMMITID","SYSTEM_PULLREQUEST_TARGETBRANCH","SYSTEM_PULLREQUEST_TARGETBRANCHNAME","SYSTEM_STAGEATTEMPT","SYSTEM_STAGEDISPLAYNAME","SYSTEM_STAGENAME","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI","SYSTEM_TEAMPROJECT","SYSTEM_TEAMPROJECTID","SYSTEM_TIMELINEID"]),awsCodeBuild:g(["AWS_DEFAULT_REGION","AWS_REGION","CODEBUILD_BATCH_BUILD_IDENTIFIER","CODEBUILD_BUILD_ARN","CODEBUILD_BUILD_ID","CODEBUILD_BUILD_IMAGE","CODEBUILD_BUILD_NUMBER","CODEBUILD_BUILD_SUCCEEDING","CODEBUILD_BUILD_URL","CODEBUILD_INITIATOR","CODEBUILD_PROJECT_ARN","CODEBUILD_PUBLIC_BUILD_URL","CODEBUILD_RESOLVED_SOURCE_VERSION","CODEBUILD_SOURCE_REPO_URL","CODEBUILD_SOURCE_VERSION","CODEBUILD_SRC_DIR","CODEBUILD_START_TIME","CODEBUILD_WEBHOOK_ACTOR_ACCOUNT_ID","CODEBUILD_WEBHOOK_BASE_REF","CODEBUILD_WEBHOOK_EVENT","CODEBUILD_WEBHOOK_HEAD_REF","CODEBUILD_WEBHOOK_MERGE_COMMIT","CODEBUILD_WEBHOOK_PREV_COMMIT","CODEBUILD_WEBHOOK_TRIGGER","CODEBUILD_WEBHOOK_LABEL","CODEBUILD_WEBHOOK_RUN_ID","CODEBUILD_WEBHOOK_JOB_ID","CODEBUILD_WEBHOOK_WORKFLOW_NAME","CODEBUILD_RUNNER_OWNER","CODEBUILD_RUNNER_REPO","CODEBUILD_RUNNER_REPO_DOMAIN","CODEBUILD_RUNNER_WITH_BUILDSPEC"]),bamboo:g(["bamboo_buildNumber","bamboo_buildResultsUrl","bamboo_planRepository_repositoryUrl","bamboo_buildKey"]),bitbucket:g(["CI","BITBUCKET_WORKSPACE","BITBUCKET_REPO_SLUG","BITBUCKET_REPO_UUID","BITBUCKET_REPO_FULL_NAME","BITBUCKET_REPO_IS_PRIVATE","BITBUCKET_REPO_OWNER","BITBUCKET_REPO_OWNER_UUID","BITBUCKET_PROJECT_KEY","BITBUCKET_PROJECT_UUID","BITBUCKET_BUILD_NUMBER","BITBUCKET_PIPELINE_UUID","BITBUCKET_STEP_UUID","BITBUCKET_STEP_RUN_NUMBER","BITBUCKET_STEP_TRIGGERER_UUID","BITBUCKET_PARALLEL_STEP","BITBUCKET_PARALLEL_STEP_COUNT","BITBUCKET_CLONE_DIR","BITBUCKET_COMMIT","BITBUCKET_BRANCH","BITBUCKET_TAG","BITBUCKET_BOOKMARK","BITBUCKET_GIT_HTTP_ORIGIN","BITBUCKET_GIT_SSH_ORIGIN","BITBUCKET_PR_ID","BITBUCKET_PR_DESTINATION_BRANCH","BITBUCKET_PR_DESTINATION_COMMIT","BITBUCKET_DEPLOYMENT_ENVIRONMENT","BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID","BITBUCKET_EXIT_CODE"]),buildkite:g(["BUILDKITE_ORGANIZATION_SLUG","BUILDKITE_PIPELINE_ID","BUILDKITE_PIPELINE_NAME","BUILDKITE_PIPELINE_SLUG","BUILDKITE_PIPELINE_DEFAULT_BRANCH","BUILDKITE_REPO","BUILDKITE_SOURCE","BUILDKITE_BRANCH","BUILDKITE_TAG","BUILDKITE_COMMIT","BUILDKITE_MESSAGE","BUILDKITE_BUILD_AUTHOR","BUILDKITE_BUILD_AUTHOR_EMAIL","BUILDKITE_JOB_ID","BUILDKITE_BUILD_ID","BUILDKITE_BUILD_URL","BUILDKITE_BUILD_NUMBER","BUILDKITE_LABEL","BUILDKITE_COMMAND","BUILDKITE_STEP_ID","BUILDKITE_STEP_KEY","BUILDKITE_PARALLEL_JOB","BUILDKITE_PARALLEL_JOB_COUNT","BUILDKITE_RETRY_COUNT","BUILDKITE_COMPUTE_TYPE","BUILDKITE_CLUSTER_NAME","BUILDKITE_PULL_REQUEST","BUILDKITE_PULL_REQUEST_REPO","BUILDKITE_PULL_REQUEST_BASE_BRANCH","BUILDKITE_PULL_REQUEST_DRAFT","BUILDKITE_PULL_REQUEST_LABELS","BUILDKITE_MERGE_QUEUE_BASE_BRANCH","BUILDKITE_MERGE_QUEUE_BASE_COMMIT","BUILDKITE_REBUILT_FROM_BUILD_ID","BUILDKITE_REBUILT_FROM_BUILD_NUMBER","BUILDKITE_TRIGGERED_FROM_BUILD_ID","BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER","BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG"]),circle:g(["CI","CIRCLECI","CIRCLE_BRANCH","CIRCLE_BUILD_NUM","CIRCLE_BUILD_URL","CIRCLE_PREVIOUS_BUILD_NUM","CIRCLE_JOB","CIRCLE_WORKFLOW_ID","CIRCLE_WORKFLOW_JOB_ID","CIRCLE_WORKFLOW_WORKSPACE_ID","CIRCLE_PIPELINE_ID","CIRCLE_ORGANIZATION_ID","CIRCLE_PROJECT_ID","CIRCLE_PROJECT_REPONAME","CIRCLE_PROJECT_USERNAME","CIRCLE_REPOSITORY_URL","CIRCLE_WORKING_DIRECTORY","CIRCLE_SHA1","CIRCLE_TAG","CIRCLE_USERNAME","CIRCLE_NODE_INDEX","CIRCLE_NODE_TOTAL","CIRCLE_PR_NUMBER","CIRCLE_PR_REPONAME","CIRCLE_PR_USERNAME","CIRCLE_PULL_REQUEST","CIRCLE_PULL_REQUESTS","CI_PULL_REQUEST"]),concourse:g(["BUILD_ID","BUILD_NAME","BUILD_JOB_NAME","BUILD_PIPELINE_NAME","BUILD_TEAM_NAME","ATC_EXTERNAL_URL"]),codeFresh:g(["CF_BUILD_ID","CF_BUILD_URL","CF_CURRENT_ATTEMPT","CF_STEP_NAME","CF_PIPELINE_NAME","CF_PIPELINE_TRIGGER_ID","CF_PULL_REQUEST_ID","CF_PULL_REQUEST_IS_FORK","CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_TARGET"]),drone:g(["DRONE_BUILD_LINK","DRONE_BUILD_NUMBER","DRONE_PULL_REQUEST"]),githubActions:g(["CI","GITHUB_ACTIONS","GITHUB_WORKFLOW","GITHUB_WORKFLOW_REF","GITHUB_WORKFLOW_SHA","GITHUB_ACTION","GITHUB_ACTION_PATH","GITHUB_ACTION_REPOSITORY","GITHUB_JOB","GITHUB_EVENT_NAME","GITHUB_EVENT_PATH","GITHUB_RUN_ID","GITHUB_RUN_NUMBER","GITHUB_RUN_ATTEMPT","GITHUB_REPOSITORY","GITHUB_REPOSITORY_ID","GITHUB_REPOSITORY_OWNER","GITHUB_REPOSITORY_OWNER_ID","GITHUB_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REF_PROTECTED","GITHUB_BASE_REF","GITHUB_HEAD_REF","GITHUB_SHA","GITHUB_ACTOR","GITHUB_ACTOR_ID","GITHUB_TRIGGERING_ACTOR","GITHUB_SERVER_URL","GITHUB_API_URL","GITHUB_GRAPHQL_URL","GITHUB_WORKSPACE","GITHUB_RETENTION_DAYS","RUNNER_OS","RUNNER_ARCH","RUNNER_NAME","RUNNER_ENVIRONMENT","RUNNER_DEBUG"]),gitlab:g(["CI_PIPELINE_ID","CI_PIPELINE_URL","CI_BUILD_ID","CI_JOB_ID","CI_JOB_URL","CI_JOB_NAME","GITLAB_HOST","CI_PROJECT_ID","CI_PROJECT_URL","CI_REPOSITORY_URL","CI_ENVIRONMENT_URL","CI_DEFAULT_BRANCH","CI_MERGE_REQUEST_IID","CI_MERGE_REQUEST_PROJECT_URL","CI_MERGE_REQUEST_TITLE","CI_MERGE_REQUEST_SOURCE_BRANCH_NAME","CI_MERGE_REQUEST_TARGET_BRANCH_NAME","CI_OPEN_MERGE_REQUESTS"]),goCD:g(["GO_SERVER_URL","GO_ENVIRONMENT_NAME","GO_PIPELINE_NAME","GO_PIPELINE_COUNTER","GO_PIPELINE_LABEL","GO_STAGE_NAME","GO_STAGE_COUNTER","GO_JOB_NAME","GO_TRIGGER_USER","GO_REVISION","GO_TO_REVISION","GO_FROM_REVISION","GO_MATERIAL_HAS_CHANGED"]),googleCloud:g(["BUILD_ID","PROJECT_ID","REPO_NAME","BRANCH_NAME","TAG_NAME","COMMIT_SHA","SHORT_SHA"]),jenkins:g(["BRANCH_NAME","BUILD_DISPLAY_NAME","BUILD_ID","BUILD_NUMBER","BUILD_TAG","BUILD_URL","CHANGE_AUTHOR","CHANGE_AUTHOR_DISPLAY_NAME","CHANGE_AUTHOR_EMAIL","CHANGE_BRANCH","CHANGE_FORK","CHANGE_ID","CHANGE_TARGET","CHANGE_TITLE","CHANGE_URL","CI","EXECUTOR_NUMBER","JAVA_HOME","JENKINS_HOME","JENKINS_URL","JOB_BASE_NAME","JOB_NAME","JOB_URL","NODE_LABELS","NODE_NAME","RUN_ARTIFACTS_DISPLAY_URL","RUN_CHANGES_DISPLAY_URL","TAG_NAME","WORKSPACE","WORKSPACE_TMP","GIT_AUTHOR_EMAIL","GIT_AUTHOR_NAME","GIT_BRANCH","GIT_COMMIT","GIT_COMMITTER_EMAIL","GIT_COMMITTER_NAME","GIT_LOCAL_BRANCH","GIT_PREVIOUS_COMMIT","GIT_PREVIOUS_SUCCESSFUL_COMMIT","GIT_URL","ghprbActualCommit","ghprbGhRepository","ghprbPullId","ghprbPullLink","ghprbSourceBranch","ghprbTargetBranch","ghprbTriggerAuthorLogin"]),semaphore:g(["SEMAPHORE_BRANCH_ID","SEMAPHORE_BUILD_NUMBER","SEMAPHORE_CURRENT_JOB","SEMAPHORE_CURRENT_THREAD","SEMAPHORE_EXECUTABLE_UUID","SEMAPHORE_GIT_BRANCH","SEMAPHORE_GIT_DIR","SEMAPHORE_GIT_REF","SEMAPHORE_GIT_REF_TYPE","SEMAPHORE_GIT_REPO_SLUG","SEMAPHORE_GIT_SHA","SEMAPHORE_GIT_URL","SEMAPHORE_JOB_COUNT","SEMAPHORE_JOB_ID","SEMAPHORE_JOB_NAME","SEMAPHORE_JOB_UUID","SEMAPHORE_PIPELINE_ID","SEMAPHORE_PLATFORM","SEMAPHORE_PROJECT_DIR","SEMAPHORE_PROJECT_HASH_ID","SEMAPHORE_PROJECT_ID","SEMAPHORE_PROJECT_NAME","SEMAPHORE_PROJECT_UUID","SEMAPHORE_REPO_SLUG","SEMAPHORE_TRIGGER_SOURCE","SEMAPHORE_WORKFLOW_ID","PULL_REQUEST_NUMBER"]),teamcity:null,travis:g(["TRAVIS_JOB_ID","TRAVIS_BUILD_ID","TRAVIS_BUILD_WEB_URL","TRAVIS_REPO_SLUG","TRAVIS_JOB_NUMBER","TRAVIS_EVENT_TYPE","TRAVIS_COMMIT_RANGE","TRAVIS_BUILD_NUMBER","TRAVIS_PULL_REQUEST","TRAVIS_PULL_REQUEST_BRANCH","TRAVIS_PULL_REQUEST_SHA"]),netlify:g(["BUILD_ID","CONTEXT","URL","DEPLOY_URL","DEPLOY_PRIME_URL","DEPLOY_ID"])}),zo=()=>{let{env:e}=process;return{appveyor:{sha:e.APPVEYOR_REPO_COMMIT,branch:e.APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH||e.APPVEYOR_REPO_BRANCH,message:Fo(`
`,e.APPVEYOR_REPO_COMMIT_MESSAGE,e.APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED),authorName:e.APPVEYOR_REPO_COMMIT_AUTHOR,authorEmail:e.APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL},awsCodeBuild:{sha:e.CODEBUILD_RESOLVED_SOURCE_VERSION,remoteOrigin:e.CODEBUILD_SOURCE_REPO_URL},azure:{sha:e.BUILD_SOURCEVERSION,branch:e.BUILD_SOURCEBRANCHNAME,message:e.BUILD_SOURCEVERSIONMESSAGE,authorName:e.BUILD_SOURCEVERSIONAUTHOR,authorEmail:e.BUILD_REQUESTEDFOREMAIL},bamboo:{sha:e.bamboo_planRepository_revision,branch:e.bamboo_planRepository_branch,authorName:e.bamboo_planRepository_username,remoteOrigin:e.bamboo_planRepository_repositoryURL},bitbucket:{sha:e.BITBUCKET_COMMIT,branch:e.BITBUCKET_BRANCH},buildkite:{sha:e.BUILDKITE_COMMIT,branch:e.BUILDKITE_BRANCH,message:e.BUILDKITE_MESSAGE,authorName:e.BUILDKITE_BUILD_CREATOR,authorEmail:e.BUILDKITE_BUILD_CREATOR_EMAIL,remoteOrigin:e.BUILDKITE_REPO,defaultBranch:e.BUILDKITE_PIPELINE_DEFAULT_BRANCH},circle:{sha:e.CIRCLE_SHA1,branch:e.CIRCLE_BRANCH,authorName:e.CIRCLE_USERNAME,remoteOrigin:e.CIRCLE_REPOSITORY_URL},codeFresh:{sha:e.CF_REVISION,branch:e.CF_BRANCH,message:e.CF_COMMIT_MESSAGE,authorName:e.CF_COMMIT_AUTHOR},drone:{sha:e.DRONE_COMMIT_SHA,branch:e.DRONE_SOURCE_BRANCH,message:e.DRONE_COMMIT_MESSAGE,authorName:e.DRONE_COMMIT_AUTHOR,authorEmail:e.DRONE_COMMIT_AUTHOR_EMAIL,remoteOrigin:e.DRONE_GIT_HTTP_URL,defaultBranch:e.DRONE_REPO_BRANCH},githubActions:{sha:e.GITHUB_SHA,branch:e.GH_BRANCH||e.GITHUB_REF,defaultBranch:e.GITHUB_BASE_REF,remoteBranch:e.GITHUB_HEAD_REF,runAttempt:e.GITHUB_RUN_ATTEMPT},gitlab:{sha:e.CI_COMMIT_SHA,branch:e.CI_COMMIT_REF_NAME,message:e.CI_COMMIT_MESSAGE,authorName:e.GITLAB_USER_NAME,authorEmail:e.GITLAB_USER_EMAIL,remoteOrigin:e.CI_REPOSITORY_URL,defaultBranch:e.CI_DEFAULT_BRANCH},googleCloud:{sha:e.COMMIT_SHA,branch:e.BRANCH_NAME},jenkins:{sha:e.GIT_COMMIT,branch:e.GIT_BRANCH},semaphore:{sha:e.SEMAPHORE_GIT_SHA,branch:e.SEMAPHORE_GIT_BRANCH,remoteOrigin:e.SEMAPHORE_GIT_REPO_SLUG},snap:null,teamcity:null,travis:{sha:e.TRAVIS_PULL_REQUEST_SHA||e.TRAVIS_COMMIT,branch:e.TRAVIS_PULL_REQUEST_BRANCH||e.TRAVIS_BRANCH,message:e.TRAVIS_COMMIT_MESSAGE},netlify:{sha:e.COMMIT_REF,branch:e.BRANCH,remoteOrigin:e.REPOSITORY_URL}}},xr=e=>{let t=Gr();return t?(0,_.chain)(e()).get(t).value():{}};function Xo(){return(0,_.chain)(wr()).omitBy(_.isNull).keys().value()}function Gr(){let e=qo();return se("detected CI provider name: %s",e),e||null}function Zo(){return xr(wr)}function Hr(){return xr(zo)}function en(e){return e&&Xo().includes(e)}function Fr(e){let t=Zo(),r=Gr(),o=tn(e,r);return se("detected CI provider: %s",r),se("detected CI params: %O",t),se("detected CI build ID: %o",o),{params:t,provider:r,ciBuildId:o}}function tn(e,t){return e?{source:"user",value:e}:en(t)?{source:"server",value:null}:{source:"random",value:`auto:${P()}`}}n();var Kr=require("@currents/commit-info"),jr=require("lodash");n();var ie=require("lodash");m();var Je=c.extend("ci-git");function kr(e){Je("git commit existing info: %O",e);let t=Hr();Je("commit info from provider environment variables: %O",t);let r=(0,ie.transform)(e,(o,s,a)=>{let p=s||(t?t[a]:null);return o[a]=(0,ie.defaultTo)(p,null)});return Je("combined git and environment variables from provider: %O",r),r}var rn=async()=>{let e=await(0,Kr.commitInfo)();return kr({branch:e.branch,remoteOrigin:e.remote,authorEmail:e.email,authorName:e.author,message:e.message,sha:e.sha,ghaEventData:e.ghaEventData})},Wr=(0,jr.memoize)(rn);n();var Yr=require("@babel/code-frame"),Vr=l(require("chalk")),Qe=l(require("fs")),w=l(require("path")),$r=l(require("stack-utils")),Jr=l(require("url"));function on(e){let t=e.split(`
`),r=t.findIndex(p=>p.startsWith(" at "));r===-1&&(r=t.length);let o=t.slice(0,r).join(`
`),s=t.slice(r),a;for(let p of s){let{frame:C,fileName:L}=un(p);if(!(!C||!L)&&!nn(L)){a={file:L,column:C.column||0,line:C.line||0};break}}return{message:o,stackLines:s,location:a}}function nn(e){return e.includes(`${w.default.sep}node_modules${w.default.sep}`)}function sn(e,t){return w.default.relative(e.rootDir,t)||w.default.basename(t)}function Qr(e,t,r,o){let s=t.stack,a=[],p;if(s){let C=on(s);if(a.push(C.message),p=C.location,p)if(!t.snippet&&(!o||Qe.default.realpathSync(o)!==p.file)&&(a.push(""),a.push(Vr.default.gray(" at ")+`${sn(e,p.file)}:${p.line}`)),a.push(""),t.snippet)a.push(t.snippet);else try{let L=Qe.default.readFileSync(p.file,"utf8"),pe=(0,Yr.codeFrameColumns)(L,{start:p},{highlightCode:r});a.push(pe)}catch{}a.push(""),a.push(C.stackLines.join(`
`))}else t.message?a.push(t.message):t.value&&a.push(t.value);return{location:p,message:a.join(`
`)}}var an=new $r.default;function un(e){let t=an.parseLine(e);if(!t)return{frame:null,fileName:null};let r=null;return t.file&&(r=t.file.startsWith("file://")?Jr.default.fileURLToPath(t.file):w.default.resolve(process.cwd(),t.file)),{frame:t,fileName:r}}Pe();He();n();b();n();var cn=require("lodash");n();var ae=l(require("path"));function qr(e,t){return ln(ae.default.relative(t,e.file))}function ln(e){return e.split(ae.default.sep).join(ae.default.posix.sep)}function qe(e){let t=e.titlePath(),r=zr(e).title;return t.slice(t.indexOf(r)+1,t.length)}function zr(e){let t=e.parent;for(;t.parent?.location;)t=t.parent;return t}function Xr(e,t){let r=zr(e).location;return qr(r,t.rootDir)}function Zr(e){return e.id??e._id}function eo(e){if(e._only)return!0;let t=e.parent;for(;t.parent;){if(t._only)return!0;t=t.parent}return!1}function ue(e){if(!e)return"__currents_no_project__";let r=("__projectId"in e?e.__projectId:"").trim(),o=e.name.trim()?r:`project${r?`-0${r}`:""}`;if(o.length>256)throw new Error(`Project name is too long for ${o}`);return o}function to(e,t){return e.suites.map(r=>{let o=t.projects.find(s=>s.name===r.title);return{name:ue(r.project()),tags:(o?.metadata?.pwc?.tags??[]).map(s=>s.trim()),tests:En(r,t)}})}function En(e,t){let r=e.allTests().map(o=>({isOnly:eo(o),title:qe(o),spec:Xr(o,t),tags:pn(o),testId:Zr(o)}));return r.some(o=>o.isOnly)?r.filter(o=>o.isOnly):r}function pn(e){let{disableTestTags:t}=dn();if(t)return[];let r=(qe(e).join(" ").match(/@(\S+)/g)??[]).filter(Boolean).map(o=>o);return Array.from(new Set([...r,...e.tags??[]].map(o=>o.trim()).map(o=>o.replace("@",""))))}function dn(){return{disableTestTags:B()?.disableTestTags??process.env.CURRENTS_DISCOVERY_DISABLE_TEST_TAGS==="true"}}S();Ge();n();Te();n();var _n=l(require("http"));m();var gn=l(require("lil-http-terminator")),ro=require("ts-pattern"),In=l(require("ws")),Va=c.extend("wss");n();ye();var le=class{async create(t){return M({url:"/orchestration-v1",method:"POST",data:JSON.stringify(t)})}async createTask(t){return M({url:`/orchestration-v1/${t.id}/task`,method:"POST",data:JSON.stringify({machineId:t.machineId,runId:t.runId})})}async resetRun(t){return M({url:`/runs/v1/${t.runId}/reset`,method:"PUT",data:JSON.stringify({...t,isBatchedOr8n:!0})})}};n();var ze=l(require("pluralize"));b();_e();S();var ce=class{constructor(t,r,o=B()){this.pwConfig=t;this.suite=r;this.currentsConfig=o}pwConfig;suite;currentsConfig;getIntro(t){return[`\u{1F4E6} Currents reporter: ${d([`${Re(W)}`,t.ciBuildId?` - ci build id: ${t.ciBuildId}`:null,` - project id: ${this.currentsConfig?.projectId}`,` - orchestration id: ${t.sessionId}`,t.machineId?` - machine id: ${t.machineId}`:null].filter(Boolean).join(`
`))}`,[`\u{1F3AD} Playwright: ${d([`${Re(this.pwConfig.version)}`,`${this.suite.allTests().length} ${(0,ze.default)("test",this.suite.allTests().length)} in ${this.suite.suites.length} ${(0,ze.default)("project",this.suite.suites.length)} [${this.suite.suites.map(r=>ue(r.project())).join(", ")}]`,this.pwConfig.shard?["shard",`${this.pwConfig.shard.current}/${this.pwConfig.shard.total}`].join(" "):null].filter(r=>r).join(" "))} `].filter(r=>r).join(" | ")].join(`
`)}};var U=c.extend("orchestration-reporter"),Ee=class{configLoader;pwConfig=null;pwSuite=null;fullSuite=null;printer=null;remoteDebug;parentNotified=!1;constructor(t){this.remoteDebug=Z.factory("or8n"),this.configLoader=new ne(t).start()}printsToStdio(){return!0}onBegin(t,r){Jt(t.version),this.configLoader.loadAndValidate(),U("Starting orchestration discovery"),this.pwConfig=t,this.pwSuite=r,Dr(t),U("Discovering test suite config: %O",t),this.fullSuite=to(this.pwSuite,t),U("Full suite response %O",this.fullSuite),this.printer=new ce(t,r)}onError(t){T(`Global error reported by test runner:
%s`,Qr(this.pwConfig,t,!0).message)}async onExit(){if(U("onExit() called - cleaning up"),!this.parentNotified)try{await H({type:"discovery:creation-failure",payload:new Error("Orchestration reporter exited without notifying parent")})}catch(t){U("Error notifying parent of discovery failure: %O",t)}try{await It(),U("WS closed")}catch(t){U("Error closing WS: %O",t)}try{await this.remoteDebug.finalize()}catch(t){U("Error finalizing remoteDebug: %O",t)}}getOrchestrationAPI(){return new le}async onEnd(){if(U("onEnd() called - starting orchestration finalization"),this.pwConfig?.projects.forEach(h=>{if(!h.name)throw new Error("currents panic: playwright projects must have a name for orchestration")}),!this.fullSuite)throw new Error("currents panic: cannot detect full test suite");U("Validated config, fetching currents config...");let t=B();U("Currents config fetched, getting git info...");let r=await Wr();U("Git info retrieved, getting CI info...");let o=Fr(t?.ciBuildId);if(U("CI info retrieved: %O",{provider:o.provider,ciBuildId:o.ciBuildId}),o.ciBuildId.source==="random")throw T(`Currents failed to detect CI build ID for this environment. Please use one of the following to set CI build ID:

@@ -34,6 +34,6 @@ - use environment variable: ${d(te("ciBuildId"))}

\u{1F4D6} ${H.guide.ciBuildId}
\u{1F4D6} ${H.guide.integration}
`),new Error("We could not determine a unique CI Build ID");this.fullSuite.flatMap(h=>h.tests).length===0&&(Oe(),p("No tests detected"),Oe());let s=this.pwConfig?oe(this.pwConfig):null,i=t?.orchestration?.batchSize,E=qe(s?.projects),_=this.pwConfig?.workers,L=Pr(E),_e=yr(E[0]),cn={ci:n,suite:this.fullSuite,commit:r,clientId:(0,ln.nanoid)(),config:qe(this.pwConfig),projectId:t?.projectId,ciBuildId:n.ciBuildId.value,recordKey:t?.recordKey,machineId:t?.machineId,globalWorkers:_,globalBatchSize:i,projectWorkers:L,projectBatchSizes:_e};if(D("\u{1F680} Starting orchestration session..."),process.env.CURRENTS_PWCP_DRY_RUN){D("Dry run enabled, skipping orchestration creation");return}try{let{data:h}=await this.getOrchestrationAPI().create(cn);D(this.printer.getIntro({sessionId:h.id,ciBuildId:n.ciBuildId.value,machineId:h.machineId})),process.env.CURRENTS_PWCP_DRY_RUN||await q({type:"discovery:creation-success",payload:{...h,cliArgs:s?.cliArgs??null,suite:this.fullSuite,lastRunData:this.lastRunData}})}catch(h){D(this.printer.getIntro({sessionId:void 0,machineId:null,ciBuildId:n.ciBuildId.value})),T("Could not create new orchestration session"),await q({type:"discovery:creation-failure",payload:h})}finally{U("Discovery done"),await mt(),U("WS closed"),await this.remoteDebug.finalize()}}};var ho=ge;
\u{1F4D6} ${k.guide.ciBuildId}
\u{1F4D6} ${k.guide.integration}
`),new Error("We could not determine a unique CI Build ID");this.fullSuite.flatMap(h=>h.tests).length===0&&(Ce(),E("No tests detected"),Ce());let s=this.pwConfig?Ar(this.pwConfig):null,a=t?.orchestration?.batchSize,p=$e(s?.projects),C=this.pwConfig?.workers,L=Br(p),pe=Nr(p[0]),no={ci:o,suite:this.fullSuite,commit:r,clientId:(0,oo.nanoid)(),config:$e(this.pwConfig),projectId:t?.projectId,ciBuildId:o.ciBuildId.value,recordKey:t?.recordKey,machineId:t?.machineId,globalWorkers:C,globalBatchSize:a,projectWorkers:L,projectBatchSizes:pe};if(D("\u{1F680} Starting orchestration session..."),process.env.CURRENTS_PWCP_DRY_RUN){D("Dry run enabled, skipping orchestration creation");return}try{let{data:h}=await this.getOrchestrationAPI().create(no);D(this.printer.getIntro({sessionId:h.id,ciBuildId:o.ciBuildId.value,machineId:h.machineId})),process.env.CURRENTS_PWCP_DRY_RUN||(await H({type:"discovery:creation-success",payload:{...h,suite:this.fullSuite}}),this.parentNotified=!0)}catch(h){D(this.printer.getIntro({sessionId:void 0,machineId:null,ciBuildId:o.ciBuildId.value})),T("Could not create new orchestration session"),await H({type:"discovery:creation-failure",payload:h}),this.parentNotified=!0}}};var mn=Ee;
/*! For license information please see index.js.LEGAL.txt */
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

"use strict";var oe=Object.create;var d=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var s=(e,r)=>()=>(e&&(r=e(e=0)),r);var ae=(e,r)=>{for(var o in r)d(e,o,{get:r[o],enumerable:!0})},v=(e,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of ie(r))!ue.call(e,u)&&u!==o&&d(e,u,{get:()=>r[u],enumerable:!(n=ne(r,u))||n.enumerable});return e};var l=(e,r,o)=>(o=e!=null?oe(se(e)):{},v(r||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),le=e=>v(d({},"__esModule",{value:!0}),e);var t=s(()=>{"use strict"});var b,h=s(()=>{"use strict";t();b=l(require("debug"))});var O,ce,E=s(()=>{"use strict";t();O=require("nanoid"),ce=(0,O.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});function P(e){pe.push(e)}var pe,y=s(()=>{"use strict";t();pe=[]});var p,ge,fe,de,Ge,m=s(()=>{"use strict";t();p={None:"none",Summary:"summary",Detailed:"detailed"},ge={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},fe={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},de={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},Ge={[p.None]:ge,[p.Summary]:fe,[p.Detailed]:de}});var F=s(()=>{"use strict";t()});function me(e){return _?!!_[e]:!0}function Ce(e,r){P(r),me(e)&&console.log(r)}var a,A,_,S,rt,ot,nt,it,st,ut,at,lt,ct,D,pt,j=s(()=>{"use strict";t();a=l(require("chalk")),A=l(require("util"));m();g();y();F();_=null;S=(...e)=>{Ce("introAndSummary",A.default.format(...e))},rt=a.default.cyan,ot=a.default.blueBright,nt=a.default.red,it=a.default.yellow,st=a.default.green,ut=a.default.gray,at=a.default.white,lt=a.default.black,ct=a.default.magenta,D=a.default.dim,pt=a.default.bold});var f=s(()=>{"use strict";t();y();j()});function be(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var N,Te,U=s(()=>{"use strict";t();N=require("@commander-js/extra-typings"),Te=new N.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(be).env("CURRENTS_DEBUG")});var he,k=s(()=>{"use strict";t();he=require("@commander-js/extra-typings");U()});var x,ye,Se,xe,Ie,_t,W=s(()=>{"use strict";t();x=l(require("debug")),ye=l(require("fs")),Se=l(require("path")),xe=l(require("util")),Ie=require("fs/promises");E();f();k();h();x.default.useColors=function(){return!1};_t=x.default.log});var M=s(()=>{"use strict";t();h();W()});var c,g=s(()=>{"use strict";t();M();c=(0,b.default)("currents")});var $=s(()=>{"use strict";t()});var B=s(()=>{"use strict";t()});var we,G=s(()=>{"use strict";t();we=require("commander")});var I=s(()=>{"use strict";t();G()});var Re,Qt,w=s(()=>{"use strict";t();Re=l(require("fs"));g();Qt=c.extend("cli-options-serializer")});function K(){return ve}var br,hr,ve,z=s(()=>{"use strict";t();g();$();B();f();m();I();w();m();br=c.extend("config"),hr={removeTitleTags:!1,disableTestTags:!1,consoleOutput:p.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},ve=null});var Oe,V=s(()=>{"use strict";t();Oe=require("lodash");f()});var H=s(()=>{"use strict";t();z();I();w();V()});var je={};ae(je,{DiscoveryReporter:()=>T,default:()=>De});module.exports=le(je);t();var re=l(require("fs"));g();f();t();H();t();var Pe=require("lodash");t();var C=l(require("path"));function Y(e,r){return Ee(C.default.relative(r,e.file))}function Ee(e){return e.split(C.default.sep).join(C.default.posix.sep)}function R(e){let r=e.titlePath(),o=J(e).title;return r.slice(r.indexOf(o)+1,r.length)}function J(e){let r=e.parent;for(;r.parent?.location;)r=r.parent;return r}function q(e,r){let o=J(e).location;return Y(o,r.rootDir)}function Z(e){return e.id??e._id}function Q(e){if(e._only)return!0;let r=e.parent;for(;r.parent;){if(r._only)return!0;r=r.parent}return!1}function X(e){if(!e)return"__currents_no_project__";let o=("__projectId"in e?e.__projectId:"").trim(),n=e.name.trim()?o:`project${o?`-0${o}`:""}`;if(n.length>256)throw new Error(`Project name is too long for ${n}`);return n}function ee(e,r){return e.suites.map(o=>{let n=r.projects.find(u=>u.name===o.title);return{name:X(o.project()),tags:(n?.metadata?.pwc?.tags??[]).map(u=>u.trim()),tests:Fe(o,r)}})}function Fe(e,r){let o=e.allTests().map(n=>({isOnly:Q(n),title:R(n),spec:q(n,r),tags:_e(n),testId:Z(n)}));return o.some(n=>n.isOnly)?o.filter(n=>n.isOnly):o}function _e(e){let{disableTestTags:r}=Ae();if(r)return[];let o=(R(e).join(" ").match(/@(\S+)/g)??[]).filter(Boolean).map(n=>n);return Array.from(new Set([...o,...e.tags??[]].map(n=>n.trim()).map(n=>n.replace("@",""))))}function Ae(){return{disableTestTags:K()?.disableTestTags??process.env.CURRENTS_DISCOVERY_DISABLE_TEST_TAGS==="true"}}var te=c.extend("reporter:discovery"),T=class{onBegin(r,o){let n=process.env.CURRENTS_DISCOVERY_PATH;if(te("Discovery path: %s",n),!n)throw new Error("CURRENTS_DISCOVERY_PATH is not set");let u=this.getFullTestSuite(o,r);te("Writing discovery file to %s",n),re.default.writeFileSync(n,JSON.stringify(u,null,2)),S(n)}getFullTestSuite(r,o){return ee(r,o)}printsToStdio(){return!0}},De=T;0&&(module.exports={DiscoveryReporter});
"use strict";var oe=Object.create;var d=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var s=(e,r)=>()=>(e&&(r=e(e=0)),r);var ae=(e,r)=>{for(var o in r)d(e,o,{get:r[o],enumerable:!0})},O=(e,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of ie(r))!ue.call(e,u)&&u!==o&&d(e,u,{get:()=>r[u],enumerable:!(n=ne(r,u))||n.enumerable});return e};var l=(e,r,o)=>(o=e!=null?oe(se(e)):{},O(r||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),le=e=>O(d({},"__esModule",{value:!0}),e);var t=s(()=>{"use strict"});var T,h=s(()=>{"use strict";t();T=l(require("debug"))});var R,ce,E=s(()=>{"use strict";t();R=require("nanoid"),ce=(0,R.customAlphabet)("abcdefghijklmnopqrstuvwxyz",10)});function P(e){pe.push(e)}var pe,y=s(()=>{"use strict";t();pe=[]});var p,ge,fe,de,Ge,m=s(()=>{"use strict";t();p={None:"none",Summary:"summary",Detailed:"detailed"},ge={introAndSummary:!1,testOutput:!1,progress:!1,tables:!1,warningsAndErrors:!1},fe={introAndSummary:!0,testOutput:"line",progress:!1,tables:!1,warningsAndErrors:!0},de={introAndSummary:!0,testOutput:"full",progress:!0,tables:!0,warningsAndErrors:!0},Ge={[p.None]:ge,[p.Summary]:fe,[p.Detailed]:de}});var F=s(()=>{"use strict";t()});function me(e){return _?!!_[e]:!0}function Ce(e,r){P(r),me(e)&&console.log(r)}var a,A,_,S,rt,ot,nt,it,st,ut,at,lt,ct,D,pt,N=s(()=>{"use strict";t();a=l(require("chalk")),A=l(require("util"));m();g();y();F();_=null;S=(...e)=>{Ce("introAndSummary",A.default.format(...e))},rt=a.default.cyan,ot=a.default.blueBright,nt=a.default.red,it=a.default.yellow,st=a.default.green,ut=a.default.gray,at=a.default.white,lt=a.default.black,ct=a.default.magenta,D=a.default.dim,pt=a.default.bold});var f=s(()=>{"use strict";t();y();N()});function Te(e){return e==="false"?!1:e==="remote"?"remote":e==="full"?"full":!!e}var j,be,U=s(()=>{"use strict";t();j=require("@commander-js/extra-typings"),be=new j.Option("--pwc-debug [boolean | 'remote' | 'full']","enable debug logs for the reporter. Specify 'remote' to upload logs to Currents. Specify 'full' to dump the debug logs to stdout and upload to Currents.").argParser(Te).env("CURRENTS_DEBUG")});var he,k=s(()=>{"use strict";t();he=require("@commander-js/extra-typings");U()});var x,ye,Se,xe,Ie,_t,W=s(()=>{"use strict";t();x=l(require("debug")),ye=l(require("fs")),Se=l(require("path")),xe=l(require("util")),Ie=require("fs/promises");E();f();k();h();x.default.useColors=function(){return!1};_t=x.default.log});var $=s(()=>{"use strict";t();h();W()});var c,g=s(()=>{"use strict";t();$();c=(0,T.default)("currents")});var M=s(()=>{"use strict";t()});var B=s(()=>{"use strict";t()});var we,G=s(()=>{"use strict";t();we=require("commander")});var I=s(()=>{"use strict";t();G()});var ve,Qt,w=s(()=>{"use strict";t();ve=l(require("fs"));g();Qt=c.extend("cli-options-serializer")});function K(){return Oe}var Tr,hr,Oe,z=s(()=>{"use strict";t();g();M();B();f();m();I();w();m();Tr=c.extend("config"),hr={removeTitleTags:!1,disableTestTags:!1,consoleOutput:p.Detailed,orchestration:{skipReporterInjection:!1},coverage:{projects:!1}},Oe=null});var Re,V=s(()=>{"use strict";t();Re=require("lodash");f()});var H=s(()=>{"use strict";t();z();I();w();V()});var Ne={};ae(Ne,{DiscoveryReporter:()=>b,default:()=>De});module.exports=le(Ne);t();var re=l(require("fs"));g();t();H();t();var Pe=require("lodash");t();var C=l(require("path"));function Y(e,r){return Ee(C.default.relative(r,e.file))}function Ee(e){return e.split(C.default.sep).join(C.default.posix.sep)}function v(e){let r=e.titlePath(),o=J(e).title;return r.slice(r.indexOf(o)+1,r.length)}function J(e){let r=e.parent;for(;r.parent?.location;)r=r.parent;return r}function q(e,r){let o=J(e).location;return Y(o,r.rootDir)}function Z(e){return e.id??e._id}function Q(e){if(e._only)return!0;let r=e.parent;for(;r.parent;){if(r._only)return!0;r=r.parent}return!1}function X(e){if(!e)return"__currents_no_project__";let o=("__projectId"in e?e.__projectId:"").trim(),n=e.name.trim()?o:`project${o?`-0${o}`:""}`;if(n.length>256)throw new Error(`Project name is too long for ${n}`);return n}function ee(e,r){return e.suites.map(o=>{let n=r.projects.find(u=>u.name===o.title);return{name:X(o.project()),tags:(n?.metadata?.pwc?.tags??[]).map(u=>u.trim()),tests:Fe(o,r)}})}function Fe(e,r){let o=e.allTests().map(n=>({isOnly:Q(n),title:v(n),spec:q(n,r),tags:_e(n),testId:Z(n)}));return o.some(n=>n.isOnly)?o.filter(n=>n.isOnly):o}function _e(e){let{disableTestTags:r}=Ae();if(r)return[];let o=(v(e).join(" ").match(/@(\S+)/g)??[]).filter(Boolean).map(n=>n);return Array.from(new Set([...o,...e.tags??[]].map(n=>n.trim()).map(n=>n.replace("@",""))))}function Ae(){return{disableTestTags:K()?.disableTestTags??process.env.CURRENTS_DISCOVERY_DISABLE_TEST_TAGS==="true"}}f();var te=c.extend("reporter:discovery"),b=class{onBegin(r,o){let n=process.env.CURRENTS_DISCOVERY_PATH;if(te("Discovery path: %s",n),!n)throw new Error("CURRENTS_DISCOVERY_PATH is not set");let u=this.getFullTestSuite(o,r);te("Writing discovery file to %s",n),re.default.writeFileSync(n,JSON.stringify(u,null,2)),S(n)}getFullTestSuite(r,o){return ee(r,o)}printsToStdio(){return!0}},De=b;0&&(module.exports={DiscoveryReporter});
//# sourceMappingURL=discovery.js.map

@@ -1,2 +0,2 @@

Copyright 2024 Currents Software Inc
Copyright 2026 Currents Software Inc

@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

{
"name": "@currents/playwright",
"version": "1.23.3",
"version": "2.0.0-alpha.0",
"main": "./dist/index.js",

@@ -16,12 +16,2 @@ "author": {

},
"scripts": {
"test": "vitest",
"rm": "rimraf dist",
"lint": "TIMING=1 eslint \"**/*.ts*\"",
"build": "tsup-node --minify --dts",
"dev": "tsup-node --watch --dts",
"release": "release-it --verbose",
"publish:npm": "npm run rm && npm run build && ./publish.js",
"release-ci": "npm run rm && npm run build && ./publish.js -t latest"
},
"bin": {

@@ -61,3 +51,3 @@ "pwc": "./dist/bin/pwc.js",

"regexp.escape": "^2.0.1",
"safe-regex2": "^5.0.0",
"safe-regex2": "^5.1.1",
"source-map-support": "^0.5.21",

@@ -64,0 +54,0 @@ "stack-utils": "^2.0.6",

@@ -74,2 +74,18 @@ # @currents/playwright

### `pwc-p` CLI (orchestration)
`pwc-p` runs **orchestrated** Playwright sessions (parallel tasks coordinated via Currents). Use subcommands:
- **`pwc-p discover`** — runs test discovery with the same argv passthrough as `pwc` (grep, last-failed, config paths, etc.) and writes the discovery output to the file set by **`--pwc-discovery-output`**, or **`CURRENTS_DISCOVERY_OUTPUT_FILE`**, or **`orchestration.discoveryOutputFile`** in `currents.config.ts`.
- **`pwc-p run`** — orchestrates the suite. It does **not** accept arbitrary Playwright filter argv passthrough.
**Supported Playwright flags on `pwc-p run`:** `-c`/`--config`, `--tsconfig`, `--test-list`, `--project` (variadic, discovery only), `-j`/`--workers`, `--timeout`, `--headed`, `--output`, `--ignore-snapshots`, `--fail-on-flaky-tests`.
**Not supported on `pwc-p run`:** `--grep`/`-g`, `--grep-invert`, `--last-failed`, `--shard`, `--update-snapshots`/`-u`, or positional spec paths. Use **`pwc-p discover`** (or `playwright test --list …`) with filters, then **`pwc-p run`** with **`--pwc-discovery-output`** pointing at the same file. Alternatively, set **`orchestration.discoveryOutputFile`** or **`CURRENTS_DISCOVERY_OUTPUT_FILE`** so **`pwc-p run`** uses that path without **`--test-list`**. For a manually curated list, pass **`--test-list`** instead.
```sh
pwc-p discover -c playwright.config.ts --pwc-discovery-output tests.txt --grep @smoke
pwc-p run --project-id PROJECT_ID --key RECORD_KEY --ci-build-id "$CI_BUILD_ID"
```
### `@currents/playwright` reporter

@@ -76,0 +92,0 @@

/**
* The last known status of the current orchestration session, contains results from all the machines participating in the orchestration.
*
* @example
* When all the tests are completed, the status will look like this:
* ```json
* {
* specs: {
* overall: 10,
* claimed: 5,
* completed: 3,
* passes: 2,
* failures: 1,
* },
* tests: {
* overall: 100,
* failures: 10,
* passes: 80,
* ignored: 5,
* flaky: 5,
* },
* }
* ```
*
*
* @example
* If no results were reported, all the value are `-1`
*
* ```json
* {
* specs: {
* overall: -1,
* claimed: -1,
* completed: -1,
* passes: -1,
* failures: -1,
* },
* tests: {
* overall: -1,
* failures: -1,
* passes: -1,
* ignored: -1,
* flaky: -1,
* },
* }
* ```
*/
type OrchestrationStatus = {
specs: {
overall: number;
claimed: number;
completed: number;
passes: number;
failures: number;
};
tests: {
overall: number;
failures: number;
passes: number;
ignored: number;
flaky: number;
};
};
type ConsoleOutputPreset = "none" | "summary" | "detailed";
declare const ConsoleOutputPreset: {
readonly None: "none";
readonly Summary: "summary";
readonly Detailed: "detailed";
};
type ResetSignal = "SIGUSR1" | "SIGUSR2";
type CurrentsConfigOrchestration = {
/**
* OS signal to use for resetting the currently running spec files.
*/
resetSignal?: ResetSignal;
/**
* Prevents injecting Currents reporter when running orchestrated tasks. Requires manually adding Currents reporter to Playwright configuration.
*/
skipReporterInjection?: boolean;
/**
* An optional callback that will be called when the orchestration completed. * @see {@link OrchestrationStatus} for the returned data structure
*
* @param result the last knowns orchestration status
* @returns
*/
onFinish?: (status: OrchestrationStatus) => Promise<void>;
/**
* Configuration for setting the batch size for the orchestration. If provided batched orchestration will be executed.
*/
batchSize?: "auto" | number;
};
type CurrentsConfigCoverage = {
/**
* The projects for which coverage will be collected.
*
* If set to `true`, coverage will be collected for all projects.
* If set to an array of project names, coverage will be collected only for those specified projects.
* If set to an empty array, coverage will be collected for all projects.
* If not set or set to `false`, coverage collection will be disabled.
*/
projects?: boolean | string[];
/**
* The directory where the coverage report will be read from.
*/
dir?: string;
};
type CurrentsConfig = {
/**
* The id of the build to record the test run. Read more: https://docs.currents.dev/guides/ci-build-id
*/
ciBuildId?: string;
/**
* The id of the project to record the test run.
*/
projectId: string;
/**
* The record key to be used to record the results on the remote dashboard. Read more: https://docs.currents.dev/guides/record-key
*/
recordKey: string;
/**
* A list of tags to be added to the test run.
*/
tag?: string[];
/**
* experimental - enable reporting test-level results
*/
enableTestResults?: boolean;
/**
* remove tags from test names, for example `Test name @smoke` becomes `Test name`
*/
removeTitleTags?: boolean;
/**
* Disable reporting tags defined on the test or suite level,
* or extracted from the test title
*/
disableTestTags?: boolean;
/** @deprecated - use disableTestTags instead */
disableTitleTags?: boolean;
/**
* Abort the run after the specified number of failed tests. Overrides the default Currents Project settings.
* If set, must be a positive integer or "false" to disable
*/
cancelAfterFailures?: number | false;
/**
* Path to the full test suite file for orchestration and reporting
*/
testSuiteFile?: string;
/**
* Unique identifier of the machine running the tests. If not provided, it will be generated automatically. See: https://docs.currents.dev/?q=machineId
*/
machineId?: string;
/**
* The orchestration id to be used to record the results on the remote dashboard. See: https://docs.currents.dev/?q=orchestrationId
*/
orchestrationId?: string;
/**
* Path to the file where the run summary output will be written.
* See: https://docs.currents.dev/?q=outputFile
*/
outputFile?: string;
/**
* Configuration for Currents Orchestration
*/
orchestration?: CurrentsConfigOrchestration;
/**
* Configuration for Currents Coverage
*/
coverage?: CurrentsConfigCoverage;
/**
* Reporter console output: "none" (no stdout), "summary" (intro, one line per test, summary), "detailed" (full per-test output).
* Extensible for future options (e.g. dot-style reporter).
*/
consoleOutput?: ConsoleOutputPreset;
};
export { type CurrentsConfig as C, type OrchestrationStatus as O, ConsoleOutputPreset as a };
# Reference
## Orchestration
```mermaid
sequenceDiagram
pwc-p ->> or8n-reporter: playwright list --report @currents/orchestration
Note over or8n-reporter: CURRENTS_PWCP_WSS_PORT
or8n-reporter ->> or8n-reporter: ConfigLoader -> setCurrentsConfig<br />skipConfigValidation: true
or8n-reporter ->> backend: create or8n session
backend -->> or8n-reporter: or8n session
or8n-reporter -->> pwc-p: ws://<creation-success>
pwc-p ->> pwc-p: TaskExecutor.runTaskLoop
loop while or8n task != null
pwc-p ->> backend: create or8n task
backend -->> pwc-p: or8n task
pwc-p ->> pwc-p: TaskExecutor.runPWTask
pwc-p ->> playwright-currents-reporter: test --project --spec
Note over playwright-currents-reporter: CURRENTS_PWCP_WSS_PORT<br />CURRENTS_OR8N_SEND_RESULTS_TO_WSS<br />CURRENTS_TEST_SUITE_FILE<br />CURRENTS_PWC_CLI_CONFIG_PATH
playwright-currents-reporter ->> playwright-currents-reporter: ConfigLoader -> setCurrentsConfig<br />skipConfigValidation: true
playwright-currents-reporter -->> pwc-p: sendJSONSummaryToWSS() via
end
```
## Configuration
- `pwc` and `pwc-p` are CLI utils - they get CLI arguments which can have values set via env variables according to `Option` configuraiton.
- `pwc` and `pwc-p` serialize CLI flags and save it to `CURRENTS_PWC_CLI_CONFIG_PATH`
- `reporter-config` is the configuration that users provide via `playwright.config.ts`
- `c12` is the configurtion from `currents.config.ts` and alike
- reporters read the file contents from `CURRENTS_PWC_CLI_CONFIG_PATH` and merge the config using `setConfig()` function
```mermaid
graph TD;
CliManager.cliOptions --> CURRENTS_PWC_CLI_CONFIG_PATH;
pwc-->CliManager.cliOptions;
pwc-p-->CliManager.cliOptions;
CURRENTS_PWC_CLI_CONFIG_PATH --> main-reporter;
CURRENTS_PWC_CLI_CONFIG_PATH --> discovery-reporter;
reporter-config --> ConfigLoader;
discovery-reporter --> ConfigLoader;
main-reporter --> ConfigLoader;
env-var --> pwc;
flags --> pwc;
env-var --> pwc-p;
flags --> pwc-p;
subgraph "setConfig()"
ConfigLoader --> defaultConfig --> c12 --> reporter-configuration --> cli --> envVars;
end
```
## Tips
- use `getConfig` whenever it's possible
- don't use defaults in CLI options - they will override c12 configuration, use `defaultConfig` instead
- you can access certain config values directly from source - for example `debug` or `inspect`
# Coverage Reference
- User instruments the app to collect coverage
- User enables coverage fixtures
- We collect coverage data:
- each attempt can have multiple pages, we merge
those with `saveCoverageForTestAttempt`
at `path.join(projectDir, `${testId}-${retry}.json`);`
- we end up with a bunch of files for each test + attempt
- At the end of spec execution we merge and upload coverage data, see `SpecExecution.finish`:
## Re-runs for or8n
### The idea
1. on rerun`npx currents api get-run` loads failing test ids for all known specs and writes them to `test-results/.last-run.json`
2. orchestration discovery reporters runs playwright with `--last-failed` flag and uses `.last.run.json` files
3. the orchestration is created, the tasks are added to queue
4. for each task
1. obtain test ids for the current or8n task:
- get from full test suite only the test ids the specs + group included in the task
- it will be only failed test ids because the full test suite was created from "last run" file generated by the api request.
2. re-write the "last run" file using the filtered test ids
3. execute the pw test command for the task with `-last-failed` flag, so it will use the filtered test ids not the entire spec
5. restore the original `.last-run.json` file
### Testing locally
1. run `cd currents-playwright` and `npm run dev`
2. in another tab:
1. run `cd examples/or8n-results`
2. run `pwc` command to generate the initial `.last-run.json` with all test ids - `CURRENTS_API_URL=https://cy-staging.currents.dev npx pwc --key xxx --project-id yyy --ci-build-id date +%s` . This will result in the same output as running the `npx currents api get-run` command
3. run `pwc-p` command with `--last-failed` - `CURRENTS_API_URL=https://cy-staging.currents.dev npx pwc-p --key xxx --project-id yyy --ci-build-id date +%s --last-failed`.
3. analyze:
- how `.last-run.json` is changing
- what tests are executed for each or8n task
- what test records are created

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display