debugbear
Advanced tools
Comparing version 2.0.22 to 2.1.0
@@ -58,2 +58,3 @@ "use strict"; | ||
.option("--ngrokWebPort <ngrokWebPort>") | ||
.option("--output <output>", "Write test result including metrics to this path") | ||
.option("--commitHash <commitHash>") | ||
@@ -101,4 +102,4 @@ .option("--commitBranch <commitBranch>") | ||
baseUrl: baseUrl, | ||
isCli: true, | ||
isCliFail: options.fail, | ||
output: options.output, | ||
}, { | ||
@@ -146,3 +147,3 @@ customHeaders: options.customHeader, | ||
dbbClient = new DebugBear_1.DebugBear(process.env.DEBUGBEAR_API_KEY); | ||
if (!options) { | ||
if (!options || !options.pageId) { | ||
console.log("The pageId option is required. You can find the page ID in the top right corner on the results page."); | ||
@@ -155,23 +156,20 @@ } | ||
console.log("| Commit: " + (analysis.commitHash || "(no commit hash)") + " " + (analysis.buildTitle || "(no build title)")); | ||
if (options.isCli) { | ||
console.log("When the result is ready you can see it here: " + analysis.url); | ||
} | ||
console.log("When the result is ready you can see it here: " + analysis.url); | ||
result = null; | ||
if (!options.waitForResult) return [3 /*break*/, 3]; | ||
if (options.isCli) { | ||
console.log("Waiting for result"); | ||
} | ||
console.log("Waiting for result"); | ||
return [4 /*yield*/, analysis.waitForResult()]; | ||
case 2: | ||
result = _a.sent(); | ||
if (options.isCli) { | ||
console.log("Build complete: ", result.build.oneLineSummary); | ||
console.log("Build status: " + result.build.status); | ||
if (options.isCliFail && result.build.status === "failure") { | ||
process.exit(2); | ||
} | ||
console.log("Build complete: ", result.build.oneLineSummary); | ||
console.log("Build status: " + result.build.status); | ||
if (options.output) { | ||
require("fs").writeFileSync(options.output, JSON.stringify(result, null, 2)); | ||
console.log("Wrote test result JSON to " + options.output); | ||
} | ||
if (options.isCliFail && result.build.status === "failure") { | ||
process.exit(2); | ||
} | ||
_a.label = 3; | ||
case 3: return [2 /*return*/, { | ||
resultUrl: analysis.url, | ||
}]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
@@ -178,0 +176,0 @@ }); |
{ | ||
"name": "debugbear", | ||
"version": "2.0.22", | ||
"version": "2.1.0", | ||
"description": "Use DebugBear to test web performance as part of your Continuous Integration process.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import * as commander from "commander"; | ||
import { pick } from "lodash"; | ||
import { AnalysisResultObject } from "ResponseTypes"; | ||
import { DebugBear } from "./DebugBear"; | ||
@@ -20,2 +21,6 @@ | ||
.option("--ngrokWebPort <ngrokWebPort>") | ||
.option( | ||
"--output <output>", | ||
"Write test result including metrics to this path" | ||
) | ||
.option("--commitHash <commitHash>") | ||
@@ -81,4 +86,4 @@ .option("--commitBranch <commitBranch>") | ||
baseUrl, | ||
isCli: true, | ||
isCliFail: options.fail, | ||
output: options.output, | ||
}, | ||
@@ -119,3 +124,3 @@ { | ||
const dbbClient = new DebugBear(process.env.DEBUGBEAR_API_KEY); | ||
if (!options) { | ||
if (!options || !options.pageId) { | ||
console.log( | ||
@@ -135,26 +140,25 @@ "The pageId option is required. You can find the page ID in the top right corner on the results page." | ||
if (options.isCli) { | ||
console.log( | ||
"When the result is ready you can see it here: " + analysis.url | ||
); | ||
} | ||
console.log("When the result is ready you can see it here: " + analysis.url); | ||
let result: AnalysisResultObject | null = null; | ||
if (options.waitForResult) { | ||
if (options.isCli) { | ||
console.log("Waiting for result"); | ||
console.log("Waiting for result"); | ||
result = await analysis.waitForResult(); | ||
console.log("Build complete: ", result.build!.oneLineSummary); | ||
console.log("Build status: " + result.build!.status); | ||
if (options.output) { | ||
require("fs").writeFileSync( | ||
options.output, | ||
JSON.stringify(result, null, 2) | ||
); | ||
console.log("Wrote test result JSON to " + options.output); | ||
} | ||
const result = await analysis.waitForResult(); | ||
if (options.isCli) { | ||
console.log("Build complete: ", result.build!.oneLineSummary); | ||
console.log("Build status: " + result.build!.status); | ||
if (options.isCliFail && result.build!.status === "failure") { | ||
process.exit(2); | ||
} | ||
if (options.isCliFail && result.build!.status === "failure") { | ||
process.exit(2); | ||
} | ||
} | ||
return { | ||
resultUrl: analysis.url, | ||
}; | ||
} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
71759
9