@flakiness/sdk
Advanced tools
| import { FlakinessReport } from '@flakiness/flakiness-report'; | ||
| /** | ||
| * Validates a report object against the Flakiness Report schema. | ||
| * | ||
| * @param report - The report object to validate | ||
| * @returns A formatted error string if validation fails, or `undefined` if the report is valid | ||
| */ | ||
| export declare function validateReport(report: FlakinessReport.Report): string | undefined; | ||
| //# sourceMappingURL=validateReport.d.ts.map |
| {"version":3,"file":"validateReport.d.ts","sourceRoot":"","sources":["../../src/validateReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,6BAA6B,CAAC;AAGtE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,GAAG,MAAM,GAAC,SAAS,CAe/E"} |
+21
-2
@@ -8,3 +8,3 @@ var __defProp = Object.defineProperty; | ||
| // src/browser.ts | ||
| import { FlakinessReport } from "@flakiness/flakiness-report"; | ||
| import { FlakinessReport as FlakinessReport2 } from "@flakiness/flakiness-report"; | ||
@@ -16,2 +16,3 @@ // src/reportUtilsBrowser.ts | ||
| stripAnsi: () => stripAnsi, | ||
| validateReport: () => validateReport, | ||
| visitTests: () => visitTests | ||
@@ -178,2 +179,20 @@ }); | ||
| // src/validateReport.ts | ||
| import { Schema } from "@flakiness/flakiness-report"; | ||
| import z from "zod"; | ||
| function validateReport(report) { | ||
| const validation = Schema.Report.safeParse(report); | ||
| if (!validation.success) { | ||
| const MAX_ISSUES = 5; | ||
| const allIssues = validation.error.issues; | ||
| const shownIssues = allIssues.slice(0, MAX_ISSUES); | ||
| const remaining = allIssues.length - shownIssues.length; | ||
| const base = [z.prettifyError(new z.ZodError(shownIssues))]; | ||
| if (remaining > 0) | ||
| base.push(`... and ${remaining} more issue${remaining === 1 ? "" : "s"} ...`); | ||
| return base.join("\n"); | ||
| } | ||
| return void 0; | ||
| } | ||
| // src/stripAnsi.ts | ||
@@ -201,5 +220,5 @@ var ansiRegex = new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "g"); | ||
| export { | ||
| FlakinessReport, | ||
| FlakinessReport2 as FlakinessReport, | ||
| reportUtilsBrowser_exports as ReportUtils | ||
| }; | ||
| //# sourceMappingURL=browser.js.map |
+22
-2
@@ -8,3 +8,3 @@ var __defProp = Object.defineProperty; | ||
| // src/index.ts | ||
| import { FlakinessReport } from "@flakiness/flakiness-report"; | ||
| import { FlakinessReport as FlakinessReport2, Schema as Schema2 } from "@flakiness/flakiness-report"; | ||
@@ -477,2 +477,3 @@ // src/ciUtils.ts | ||
| stripAnsi: () => stripAnsi, | ||
| validateReport: () => validateReport, | ||
| visitTests: () => visitTests | ||
@@ -782,2 +783,20 @@ }); | ||
| // src/validateReport.ts | ||
| import { Schema } from "@flakiness/flakiness-report"; | ||
| import z from "zod"; | ||
| function validateReport(report) { | ||
| const validation = Schema.Report.safeParse(report); | ||
| if (!validation.success) { | ||
| const MAX_ISSUES = 5; | ||
| const allIssues = validation.error.issues; | ||
| const shownIssues = allIssues.slice(0, MAX_ISSUES); | ||
| const remaining = allIssues.length - shownIssues.length; | ||
| const base = [z.prettifyError(new z.ZodError(shownIssues))]; | ||
| if (remaining > 0) | ||
| base.push(`... and ${remaining} more issue${remaining === 1 ? "" : "s"} ...`); | ||
| return base.join("\n"); | ||
| } | ||
| return void 0; | ||
| } | ||
| // src/stripAnsi.ts | ||
@@ -1317,6 +1336,7 @@ var ansiRegex = new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "g"); | ||
| FlakinessProjectConfig, | ||
| FlakinessReport, | ||
| FlakinessReport2 as FlakinessReport, | ||
| GitWorktree, | ||
| RAMUtilization, | ||
| reportUtils_exports as ReportUtils, | ||
| Schema2 as Schema, | ||
| showReport, | ||
@@ -1323,0 +1343,0 @@ uploadReport, |
+4
-3
| { | ||
| "name": "@flakiness/sdk", | ||
| "version": "0.152.0", | ||
| "version": "0.153.0", | ||
| "private": false, | ||
@@ -40,8 +40,9 @@ "repository": { | ||
| "dependencies": { | ||
| "@flakiness/flakiness-report": "^0.18.0", | ||
| "@flakiness/flakiness-report": "^0.20.0", | ||
| "chalk": "^5.6.2", | ||
| "debug": "^4.4.3", | ||
| "open": "^10.2.0", | ||
| "stable-hash": "^0.0.6" | ||
| "stable-hash": "^0.0.6", | ||
| "zod": "^4.3.5" | ||
| } | ||
| } |
+4
-3
@@ -43,4 +43,4 @@ # Flakiness Node.js SDK | ||
| environmentIdx: 0, | ||
| status: 'passed', | ||
| expectedStatus: 'passed', | ||
| actualStatus: 'passed', | ||
| duration: 100 as FlakinessReport.DurationMS, | ||
@@ -91,7 +91,8 @@ }], | ||
| - `normalizeReport()` - Deduplicate environments, suites, and tests | ||
| - `createTestStepSnippetsInplace()` - Generate code snippets for test steps | ||
| - `collectSources()` - Extract source code snippets for locations in the report | ||
| - `stripAnsi()` - Remove ANSI escape codes from strings | ||
| - `visitTests()` - Recursively visit all tests in a report | ||
| - `createFileAttachment()` / `createDataAttachment()` - Create report attachments | ||
| - **`SystemUtilizationSampler`** - Monitor and record CPU/memory utilization during test runs | ||
| - **`CPUUtilization`** - Track CPU utilization over time via periodic sampling | ||
| - **`RAMUtilization`** - Track RAM utilization over time via periodic sampling | ||
@@ -98,0 +99,0 @@ ### Working with Reports |
@@ -1,2 +0,2 @@ | ||
| export { FlakinessReport } from '@flakiness/flakiness-report'; | ||
| export { FlakinessReport, Schema } from '@flakiness/flakiness-report'; | ||
| export { CIUtils } from './ciUtils.js'; | ||
@@ -3,0 +3,0 @@ export { CPUUtilization } from './cpuUtilization.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"} |
| export { collectSources } from './collectSources.js'; | ||
| export { createEnvironment } from './createEnvironment.js'; | ||
| export { normalizeReport } from './normalizeReport.js'; | ||
| export { validateReport } from './validateReport.js'; | ||
| export { stripAnsi } from './stripAnsi.js'; | ||
@@ -5,0 +6,0 @@ export { createDataAttachment, createFileAttachment } from './uploadReport.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"reportUtils.d.ts","sourceRoot":"","sources":["../../src/reportUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EAAE,cAAc,EAC1B,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"} | ||
| {"version":3,"file":"reportUtils.d.ts","sourceRoot":"","sources":["../../src/reportUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EAAE,cAAc,EAC1B,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"} |
| export { normalizeReport } from './normalizeReport.js'; | ||
| export { validateReport } from './validateReport.js'; | ||
| export { stripAnsi } from './stripAnsi.js'; | ||
| export { visitTests } from './visitTests.js'; | ||
| //# sourceMappingURL=reportUtilsBrowser.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"reportUtilsBrowser.d.ts","sourceRoot":"","sources":["../../src/reportUtilsBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"} | ||
| {"version":3,"file":"reportUtilsBrowser.d.ts","sourceRoot":"","sources":["../../src/reportUtilsBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"} |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 14 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 14 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
101682
2.45%47
4.44%2302
2.08%105
0.96%6
20%+ Added
+ Added
- Removed