@checksum-ai/runtime 1.2.4 → 1.2.6-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -1
- package/cli.js +1 -1
- package/index.js +47 -47
- package/package.json +1 -1
- package/test-run-monitor.js +14 -14
- package/vtg-pw-bridge-runner.js +42 -42
package/.env
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
CHECKSUM_RUNTIME_BUILD_TIME=2025-08-
|
|
1
|
+
CHECKSUM_RUNTIME_BUILD_TIME=2025-08-23T19:45:33.366Z
|
package/cli.js
CHANGED
|
@@ -1533,7 +1533,7 @@ ${De}${me}${Pe}${zVr.default.cursorHide}`});var T7t=jh(require("child_process"))
|
|
|
1533
1533
|
import { RunMode, getChecksumConfig } from "@checksum-ai/runtime";
|
|
1534
1534
|
|
|
1535
1535
|
export default getChecksumConfig(${JSON.stringify(this.config,null,2)});
|
|
1536
|
-
`;(0,aI.writeFileSync)(n,a)}async cleanup(){this.runtimeAnalytics&&(eS("Flushing events..."),await ow(this.runtimeAnalytics.close(),2e4)),this.deleteVolatileConfig(),this.childProcesses.
|
|
1536
|
+
`;(0,aI.writeFileSync)(n,a)}async cleanup(){this.runtimeAnalytics&&(eS("Flushing events..."),await ow(this.runtimeAnalytics.close(),2e4)),this.deleteVolatileConfig(),await this.killAllChildProcesses()}async killAllChildProcesses(){let n=this.childProcesses.map(a=>new Promise(u=>{if(a.killed){u();return}let f=setTimeout(()=>{a.killed||a.kill("SIGKILL"),u()},5e3);a.once("exit",()=>{clearTimeout(f),u()}),a.kill("SIGTERM")}));await Promise.all(n),this.childProcesses=[]}async getEnvInfo(){let n={commitHash:"",branch:"branch",environment:process.env.CI?"CI":"local",name:"name",startedAt:Date.now(),runtimeVersion:this.checksumRuntimeVersion,request:zy.testRun.request,platform:zy.testRun.platform};try{n.commitHash=await this.getCmdOutput("git rev-parse HEAD")}catch(a){console.log("Error getting git hash",a.message)}try{n.branch=await this.getCmdOutput("git rev-parse --abbrev-ref HEAD")}catch(a){console.log("Error getting branch",a.message)}return n.name=await this.getEnvName(),n}async getEnvName(){let n=this.getChecksumArg("title");if(typeof n=="string"&&(n==null?void 0:n.length)>0)return n;try{return await this.getCmdOutput("git log -1 --pretty=%B")}catch(a){console.log("Error getting name",a.message);return}}getVolatileConfigPath(){return(0,yB.join)(this.checksumRoot??"","checksum.config.tmp.ts")}deleteVolatileConfig(){let n=this.getVolatileConfigPath();(0,aI.existsSync)(n)&&(0,aI.rmSync)(n)}loadChecksumConfig(n={}){this.config={...this.readChecksumConfigFile(n)||{},...this.volatileChecksumConfig||{}},this.debugMode&&(this.config.options.printLogs=!0),this.traceChecksumConfig()}readChecksumConfigFile(n={}){let a=(0,yB.join)(this.checksumRoot,"checksum.config.ts");try{return require(a).default}catch(u){return n.muteChecksumConfigMissingError||console.warn("There was an error loading checksum.config.ts. Continuing with default configuration.",u.message),{}}}traceChecksumConfig(){if(!this.runtimeAnalytics)return;let n=Object.keys(this.config).reduce((a,u)=>({...a,[u]:typeof this.config[u]=="string"?this.config[u]:JSON.stringify(this.config[u])}),{});this.runtimeAnalytics.checksumConfig(this.config)}processConfigArg(){this.deleteVolatileConfig();let n=this.getChecksumArg("config");if(n)try{this.volatileChecksumConfig=JSON.parse(n)}catch(a){this.volatileChecksumConfig=void 0,console.log("Error parsing cksm config",a.message)}}getNonChecksumArgs(){return this.args.filter(n=>!this.isChecksumArg(n))}getArg(n){var f;let a=this.args.find(g=>g.startsWith(`${n}`)),u=(f=a==null?void 0:a.split("=")[1])==null?void 0:f.trim();return u||!!a}getChecksumArg(n){return this.getArg(`--cksm-${n}`)}getChecksumRootOrigin(){return(0,yB.join)(this.projectRootDirectory,"node_modules","@checksum-ai","runtime","checksum-root")}locateChecksumLibs(){try{this.findProjectRoot(),this.findChecksumRoot()}catch(n){console.log(n.message),process.exit(1)}}findProjectRoot(){let n=process.cwd();for(let a=0;a<6;a++){let u=(0,yB.join)(n,"node_modules","@checksum-ai","runtime");if((0,aI.existsSync)(u)){this.projectRootDirectory=n,eS("Project root directory found at",this.projectRootDirectory);return}if((0,yB.parse)(n).root===n)break;n=(0,yB.join)(n,"..")}throw new Error(process.env.CHECKSUM_RUNTIME_DEV_MODE?"Could not resolve checksum root origins, tried to look in node modules. please build the runtime":"Could not resolve checksum root origins")}setChecksumRoot(n){this.checksumRoot=n,eS("Checksum root directory found at",this.checksumRoot),this.createInternalFilesDir()}findChecksumRoot(){if(zy.checksumRootFolderBypass){let u=(0,yB.isAbsolute)(zy.checksumRootFolderBypass)?zy.checksumRootFolderBypass:(0,yB.join)(this.projectRootDirectory,zy.checksumRootFolderBypass);this.setChecksumRoot(u);return}let n=e(u=>{try{return(0,aI.readdirSync)(u).includes("checksum.config.ts")}catch{return!1}},"containsChecksumConfig"),a=[this.projectRootDirectory];for(;a.length;){let u=a.pop(),f=(0,aI.readdirSync)(u,{withFileTypes:!0});for(let g of f){let A=(0,yB.join)(u,g.name),E=A;if(g.isSymbolicLink())try{let D=(0,aI.readlinkSync)(A);if(!(0,aI.lstatSync)(D).isDirectory())continue;E=D}catch{continue}else if(!g.isDirectory())continue;if(g.name===mvt){if(n(E)){this.setChecksumRoot(E);return}}else a.push(A)}}throw new Error("Could not find checksum root folder. Run `npx checksumai init` to create one.")}log(n,a=!1){a?this.printError(n):console.log(n)}runtimeTrace(n,a){this.runtimeAnalytics.eventWithMessage(a,n)}isChecksumArg(n){return n.startsWith("--cksm-")}};e(qdr,"CLICommandBase");var aP=qdr;var Vdr=require("crypto");function YVr(i,n){return{testSuiteRunId:n,appName:"generic-app",commitHash:"generic-commit-hash",envName:"generic-env-name",branch:"generic-branch",checksumRuntimeVersion:i}}e(YVr,"createDefaultTestSuiteRunInfo");function XVr(i,n,a={}){let u=["mock-app","mock-app-2","mock-app-3"];return{...{appName:u[Math.floor(Math.random()*u.length)],commitHash:(0,Vdr.randomUUID)(),envName:"test-environment",branch:(0,Vdr.randomUUID)(),testSuiteRunId:n,checksumRuntimeVersion:i},...a}}e(XVr,"createMockTestSuiteRunInfo");var ZVr=`test.setTimeout(0);
|
|
1537
1537
|
globalThis.declarations = {};
|
|
1538
1538
|
globalThis.isDeclared = (name, evalCode) => {
|
|
1539
1539
|
try {
|