@flakiness/sdk
Advanced tools
@@ -390,2 +390,13 @@ // src/cli/cmd-show-report.ts | ||
| static async create(options) { | ||
| const report = JSON.parse(await fs5.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| const commits = await listLocalCommits(process.cwd(), report.commitId, 100); | ||
| const app = express(); | ||
@@ -416,19 +427,3 @@ app.set("etag", false); | ||
| router: localReportRouter, | ||
| createRootContext: async ({ req, res, input }) => { | ||
| const report = JSON.parse(await fs5.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| return { | ||
| report, | ||
| commits: await listLocalCommits(process.cwd(), report.commitId, 100), | ||
| attachmentIdToPath | ||
| }; | ||
| } | ||
| createRootContext: async ({ req, res, input }) => ({ report, commits, attachmentIdToPath }) | ||
| })); | ||
@@ -471,3 +466,3 @@ app.use((err, req, res, next) => { | ||
| const projectPublicId = config.projectPublicId(); | ||
| const project = projectPublicId && session ? await session.api.project.getProject.GET({ projectPublicId }) : void 0; | ||
| const project = projectPublicId && session ? await session.api.project.getProject.GET({ projectPublicId }).catch((e) => void 0) : void 0; | ||
| const endpoint = session?.endpoint() ?? "https://flakiness.io"; | ||
@@ -474,0 +469,0 @@ const server = await LocalReportServer.create({ |
| #!/usr/bin/env node | ||
| // src/cli/cmd-upload.ts | ||
| import chalk from "chalk"; | ||
| import fs3 from "fs/promises"; | ||
@@ -287,6 +288,9 @@ import path2 from "path"; | ||
| // src/cli/cmd-upload.ts | ||
| var warn = (txt) => console.warn(chalk.yellow(`[flakiness.io] WARN: ${txt}`)); | ||
| var err = (txt) => console.error(chalk.red(`[flakiness.io] Error: ${txt}`)); | ||
| var log = (txt) => console.log(`[flakiness.io] ${txt}`); | ||
| async function cmdUpload(relativePath, options) { | ||
| const fullPath = path2.resolve(relativePath); | ||
| if (!await fs3.access(fullPath, fs3.constants.F_OK).then(() => true).catch(() => false)) { | ||
| console.error(`Error: path ${fullPath} is not accessible`); | ||
| err(`Path ${fullPath} is not accessible!`); | ||
| process.exit(1); | ||
@@ -298,5 +302,4 @@ } | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length && !options.ignoreMissingAttachments) { | ||
| console.log(`Missing ${missingAttachments.length} attachments - exiting. Use --ignore-missing-attachments to force upload.`); | ||
| process.exit(1); | ||
| if (missingAttachments.length) { | ||
| warn(`Missing ${missingAttachments.length} attachments`); | ||
| } | ||
@@ -310,5 +313,5 @@ const uploader = new ReportUploader({ | ||
| if (!uploadResult.success) { | ||
| console.log(`[flakiness.io] X Failed to upload to ${options.endpoint}: ${uploadResult.message}`); | ||
| err(`Failed to upload to ${options.endpoint}: ${uploadResult.message}`); | ||
| } else { | ||
| console.log(`[flakiness.io] \u2713 Report uploaded ${uploadResult.reportUrl ?? uploadResult.message ?? ""}`); | ||
| log(`\u2713 Uploaded ${uploadResult.reportUrl ?? uploadResult.message ?? ""}`); | ||
| } | ||
@@ -315,0 +318,0 @@ } |
+12
-17
@@ -225,2 +225,13 @@ // src/localReportServer.ts | ||
| static async create(options) { | ||
| const report = JSON.parse(await fs3.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| const commits = await listLocalCommits(process.cwd(), report.commitId, 100); | ||
| const app = express(); | ||
@@ -251,19 +262,3 @@ app.set("etag", false); | ||
| router: localReportRouter, | ||
| createRootContext: async ({ req, res, input }) => { | ||
| const report = JSON.parse(await fs3.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| return { | ||
| report, | ||
| commits: await listLocalCommits(process.cwd(), report.commitId, 100), | ||
| attachmentIdToPath | ||
| }; | ||
| } | ||
| createRootContext: async ({ req, res, input }) => ({ report, commits, attachmentIdToPath }) | ||
| })); | ||
@@ -270,0 +265,0 @@ app.use((err, req, res, next) => { |
+13
-18
@@ -521,2 +521,13 @@ // src/playwright-test.ts | ||
| static async create(options) { | ||
| const report = JSON.parse(await fs5.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| const commits = await listLocalCommits(process.cwd(), report.commitId, 100); | ||
| const app = express(); | ||
@@ -547,19 +558,3 @@ app.set("etag", false); | ||
| router: localReportRouter, | ||
| createRootContext: async ({ req, res, input }) => { | ||
| const report = JSON.parse(await fs5.promises.readFile(options.reportPath, "utf-8")); | ||
| const attachmentsDir = options.attachmentsFolder; | ||
| const { attachmentIdToPath, missingAttachments } = await resolveAttachmentPaths(report, attachmentsDir); | ||
| if (missingAttachments.length) { | ||
| const first = missingAttachments.slice(0, 3); | ||
| for (let i = 0; i < 3 && i < missingAttachments.length; ++i) | ||
| console.warn(`Missing attachment with id ${missingAttachments[i]}`); | ||
| if (missingAttachments.length > 3) | ||
| console.warn(`...and ${missingAttachments.length - 3} more missing attachments.`); | ||
| } | ||
| return { | ||
| report, | ||
| commits: await listLocalCommits(process.cwd(), report.commitId, 100), | ||
| attachmentIdToPath | ||
| }; | ||
| } | ||
| createRootContext: async ({ req, res, input }) => ({ report, commits, attachmentIdToPath }) | ||
| })); | ||
@@ -602,3 +597,3 @@ app.use((err2, req, res, next) => { | ||
| const projectPublicId = config.projectPublicId(); | ||
| const project = projectPublicId && session ? await session.api.project.getProject.GET({ projectPublicId }) : void 0; | ||
| const project = projectPublicId && session ? await session.api.project.getProject.GET({ projectPublicId }).catch((e) => void 0) : void 0; | ||
| const endpoint = session?.endpoint() ?? "https://flakiness.io"; | ||
@@ -605,0 +600,0 @@ const server = await LocalReportServer.create({ |
+4
-4
| { | ||
| "name": "@flakiness/sdk", | ||
| "version": "0.98.0", | ||
| "version": "0.99.0", | ||
| "private": false, | ||
@@ -48,3 +48,3 @@ "bin": { | ||
| "devDependencies": { | ||
| "@flakiness/server": "0.98.0", | ||
| "@flakiness/server": "0.99.0", | ||
| "@playwright/test": "^1.54.0", | ||
@@ -57,4 +57,4 @@ "@types/babel__code-frame": "^7.0.6", | ||
| "@babel/code-frame": "^7.26.2", | ||
| "@flakiness/report": "0.98.0", | ||
| "@flakiness/shared": "0.98.0", | ||
| "@flakiness/report": "0.99.0", | ||
| "@flakiness/shared": "0.99.0", | ||
| "@rgrove/parse-xml": "^4.2.0", | ||
@@ -61,0 +61,0 @@ "body-parser": "^1.20.3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 3 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 8 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 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 8 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
541808
-0.04%8694
-0.17%+ Added
+ Added
- Removed
- Removed
Updated
Updated