@checksum-ai/runtime 1.0.36 → 1.0.38

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.
Files changed (3) hide show
  1. package/cli.js +1 -1
  2. package/package.json +3 -2
  3. package/postinstall.js +24 -1
package/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- var f=Object.create;var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var u=(n,t)=>g(n,"name",{value:t,configurable:!0});var k=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of w(t))!P.call(n,o)&&o!==e&&g(n,o,{get:()=>t[o],enumerable:!(s=C(t,o))||s.enumerable});return n};var R=(n,t,e)=>(e=n!=null?f(y(n)):{},k(t||!n||!n.__esModule?g(e,"default",{value:n,enumerable:!0}):e,n));var i=require("fs"),l=R(require("child_process")),r=require("path");var m="checksum";var h=class{constructor(){this.TEST_RUN_MONITOR_PATH=(0,r.join)(__dirname,"test-run-monitor.js");this.CHECKSUM_API_URL="https://api.checksum.ai";this.CHECKSUM_APP_URL="https://app.checksum.ai";this.didFail=!1;this.isolationMode=!1;this.completeIndicators={upload:!1,tests:!1,report:!1};this.guardReturn=async(t,e=1e3,s="action hang guard timed out")=>{let o="guard-timed-out",a=u(async()=>(await this.awaitSleep(e+1e3),o),"guard"),c=await Promise.race([t,a()]);if(typeof c=="string"&&c===o)throw new Error(s);return c};this.awaitSleep=t=>new Promise(e=>setTimeout(e,t));this.printError=t=>{console.log("\x1B[31m%s\x1B[0m",t)}}async execute(){switch(process.argv.find(t=>t==="--help"||t==="-h")&&(await this.printHelp(process.argv[2]),process.exit(0)),process.argv[2]){case"init":this.install();break;case"test":await this.test(process.argv.slice(3));break;case"show-report":this.showReport(process.argv.slice(3));break;default:await this.printHelp()}process.exit(0)}async execCmd(t){let e=await l.spawn(t,{shell:!0,stdio:"inherit"});return new Promise((o,a)=>{e.on("exit",c=>{c===0?o(!0):a(new Error(`Checksum failed execution with code: ${c} `))})})}async getCmdOutput(t){return new Promise(function(e,s){l.exec(t,(o,a,c)=>{if(o){s(`Error executing command: ${o.message}`);return}e(a)})})}async printHelp(t){switch(t){default:console.log(`
1
+ var f=Object.create;var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var u=(n,t)=>g(n,"name",{value:t,configurable:!0});var k=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of w(t))!P.call(n,o)&&o!==e&&g(n,o,{get:()=>t[o],enumerable:!(s=C(t,o))||s.enumerable});return n};var R=(n,t,e)=>(e=n!=null?f(y(n)):{},k(t||!n||!n.__esModule?g(e,"default",{value:n,enumerable:!0}):e,n));var i=require("fs"),l=R(require("child_process")),r=require("path");var m="checksum";var h=class{constructor(){this.TEST_RUN_MONITOR_PATH=(0,r.join)(__dirname,"test-run-monitor.js");this.CHECKSUM_API_URL="https://api.checksum.ai";this.CHECKSUM_APP_URL="https://app.checksum.ai";this.didFail=!1;this.isolationMode=!1;this.completeIndicators={upload:!1,tests:!1,report:!1};this.guardReturn=async(t,e=1e3,s="action hang guard timed out")=>{let o="guard-timed-out",a=u(async()=>(await this.awaitSleep(e+1e3),o),"guard"),c=await Promise.race([t,a()]);if(typeof c=="string"&&c===o)throw new Error(s);return c};this.awaitSleep=t=>new Promise(e=>setTimeout(e,t));this.printError=t=>{console.log("\x1B[31m%s\x1B[0m",t)}}async execute(){switch(process.argv.find(t=>t==="--help"||t==="-h")&&(await this.printHelp(process.argv[2]),process.exit(0)),process.argv[2]){case"init":this.install();break;case"test":await this.test(process.argv.slice(3));break;case"show-report":this.showReport(process.argv.slice(3));break;default:await this.printHelp()}process.exit(0)}async execCmd(t){let e=await l.spawn(t,{shell:!0,stdio:"inherit"});return new Promise((o,a)=>{e.on("exit",c=>{c===0?o(!0):a(new Error(`Checsum failed execution with code: ${c} `))})})}async getCmdOutput(t){return new Promise(function(e,s){l.exec(t,(o,a,c)=>{if(o){s(`Error executing command: ${o.message}`);return}e(a)})})}async printHelp(t){switch(t){default:console.log(`
2
2
  Checksum CLI
3
3
  Usage: checksum [command] [options]
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksum-ai/runtime",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Checksum.ai test runtime",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "dependencies": {
10
10
  "@playwright/test": "1.37.0",
11
11
  "ts-node": "^10.9.1",
12
- "jsdom": "^22.1.0"
12
+ "jsdom": "^22.1.0",
13
+ "dotenv": "^16.3.1"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
package/postinstall.js CHANGED
@@ -21,5 +21,28 @@ try {
21
21
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
22
22
  } catch (e) {
23
23
  console.log("Failed adding checksum scripts to package.json, ", e);
24
- process.exit(1);
24
+ }
25
+
26
+ try {
27
+ function installPlaywright() {
28
+ return new Promise((resolve, reject) => {
29
+ exec("npx playwright install", (error, stdout, stderr) => {
30
+ if (error) {
31
+ reject(`Error: ${error.message}`);
32
+ return;
33
+ }
34
+ if (stderr) {
35
+ reject(`Stderr: ${stderr}`);
36
+ return;
37
+ }
38
+ resolve(stdout);
39
+ });
40
+ });
41
+ }
42
+
43
+ console.log("Installing playwright");
44
+ await installPlaywright();
45
+ console.log("Playwright installed successfully");
46
+ } catch (e) {
47
+ console.error("Playwright installation failed", error);
25
48
  }